Avoid warnings in some tests and do more checks

This commit is contained in:
Antony Polukhin
2015-06-18 22:01:45 +03:00
parent 3e6695971d
commit c0f75c27fa
3 changed files with 37 additions and 4 deletions

View File

@ -1,4 +1,4 @@
// Copyright 2013-2014 Antony Polukhin
// Copyright 2013-2015 Antony Polukhin
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
@ -17,7 +17,20 @@
#include <boost/type_index.hpp>
#include <iostream>
#include <stdexcept>
//<-
// Making `#include <cassert>` visible in docs, while actually using hand-made check
// instead of `assert`. This is required to verify correct behavior even if NDEBUG
// is defined and to avoid `unused local variable` warnings with defined NDEBUG.
#ifdef assert
# undef assert
#endif
#define assert(X) if (!(X)) std::exit(__LINE__)
/* !Comment block is not closed intentionaly!
//->
#include <cassert>
//<-
!Closing comment block! */
//->
class type_erased_unary_function {
void* function_ptr_;

View File

@ -1,4 +1,4 @@
// Copyright 2013-2014 Antony Polukhin
// Copyright 2013-2015 Antony Polukhin
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
@ -13,7 +13,20 @@
#include <boost/type_index.hpp>
#include <boost/unordered_set.hpp>
#include <boost/functional/hash.hpp>
//<-
// Making `#include <cassert>` visible in docs, while actually using hand-made check
// instead of `assert`. This is required to verify correct behavior even if NDEBUG
// is defined and to avoid `unused local variable` warnings with defined NDEBUG.
#ifdef assert
# undef assert
#endif
#define assert(X) if (!(X)) std::exit(__LINE__)
/* !Comment block is not closed intentionaly!
//->
#include <cassert>
//<-
!Closing comment block! */
//->
int main() {
boost::unordered_set<boost::typeindex::type_index> types;

View File

@ -1,4 +1,4 @@
// Copyright 2013-2014 Antony Polukhin
// Copyright 2013-2015 Antony Polukhin
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
@ -21,7 +21,14 @@
using namespace my_namespace;
#include <cassert>
//<-
// Using hand-made check
// instead of `assert`. This is required to verify correct behavior even if NDEBUG
// is defined and to avoid `unused local variable` warnings with defined NDEBUG.
#ifdef assert
# undef assert
#endif
#define assert(X) if (!(X)) std::exit(__LINE__)
int main() {
//[type_index_my_type_index_usage