diff --git a/include/boost/contract/aux_/condition/check_base.hpp b/include/boost/contract/aux_/condition/check_base.hpp index a3ee1a4..6875098 100644 --- a/include/boost/contract/aux_/condition/check_base.hpp +++ b/include/boost/contract/aux_/condition/check_base.hpp @@ -84,7 +84,7 @@ protected: #if BOOST_CONTRACT_POSTCONDITIONS void copy_old() { if(failed()) return; - // TODO: Document that when old copies throw, using .old() calls post failure handler (more correct), while using = OLDOF makes enclosing user function throw (less correct). Plus of course using .old() makes old copies after inv and pre are checked, while using = OLDOF makes old copies before inv and pre checking (this is less correct in theory, but it should not really matter in most practical cases unless the old copy are programmed assuming inv and pre are satisfied). + // TODO: Document that when old copies throw, using .old() calls post failure handler (more correct), while using = OLDOF makes enclosing user function throw (less correct). Plus of course using .old() makes old copies after inv and pre are checked, while using = OLDOF makes old copies before inv and pre checking (this is less correct in theory, but it should not really matter in most practical cases unless the old copy are programmed assuming inv and pre are satisfied). Also document in a rationale that it would be possible to wrap all old.hpp operations (old_ptr copy constructor, make_old, etc.) in try-catch statements so for this lib to call postcondition_failure handler also when ... = OLDOF is used. However, in that case this lib cannot populate the from parameter (and destructors can have postconditions so from would be necessary for ... = OLDOF used in a destructor) so the authors decided to not do that and leave that in the hands of the programmers (that can manually wrap ... = OLDOF with a try-catch in their user code if necessary, or better just use .old(...) when calling the failure handler for old value copies is important). try { if(old_) old_(); } catch(...) { fail(&boost::contract::postcondition_failure); } } diff --git a/include/boost/contract/aux_/condition/check_pre_post_inv.hpp b/include/boost/contract/aux_/condition/check_pre_post_inv.hpp index c6dfdb9..ffbea41 100644 --- a/include/boost/contract/aux_/condition/check_pre_post_inv.hpp +++ b/include/boost/contract/aux_/condition/check_pre_post_inv.hpp @@ -27,7 +27,6 @@ template class check_pre_post_inv : public check_pre_post { // Non-copyable base. public: #if BOOST_CONTRACT_INVARIANTS && !defined(BOOST_CONTRACT_CONFIG_PERMISSIVE) - // TODO: Document all static assert errors. BOOST_STATIC_ASSERT_MSG( !boost::contract::access::has_static_invariant_f< C, void, boost::mpl:: vector<> diff --git a/include/boost/contract/base_types.hpp b/include/boost/contract/base_types.hpp index 481fa7e..2101a21 100644 --- a/include/boost/contract/base_types.hpp +++ b/include/boost/contract/base_types.hpp @@ -2,6 +2,8 @@ #ifndef BOOST_CONTRACT_BASE_TYPES_HPP_ #define BOOST_CONTRACT_BASE_TYPES_HPP_ +// TODO: Document the max number of bases in 20 because of Boost.MPL vector limit. If Boost.MPL vector and related alg impl was to change to use variadic templates in the future there will be not limit to max bases (but for now this high limit is better than the extra complexity of reimpl all Boost.MPL vector, etc. within this lib with variadic templates). + /** @file */ #include diff --git a/include/boost/contract/constructor.hpp b/include/boost/contract/constructor.hpp index 3d47b3b..17bdbbf 100644 --- a/include/boost/contract/constructor.hpp +++ b/include/boost/contract/constructor.hpp @@ -32,11 +32,11 @@ public: template explicit constructor_precondition(F const& f) { - if(check_guard::checking()) return; + if(boost::contract::aux::check_guard::checking()) return; #if BOOST_CONTRACT_PRECONDITIONS try { #ifndef BOOST_CONTRACT_CONFIG_PRECONDITIONS_DISABLE_NOTHING - check_guard checking; + boost::contract::aux::check_guard checking; #endif f(); } catch(...) { precondition_failure(from_constructor); } diff --git a/include/boost/contract/destructor.hpp b/include/boost/contract/destructor.hpp index 45e31ab..63c7a95 100644 --- a/include/boost/contract/destructor.hpp +++ b/include/boost/contract/destructor.hpp @@ -11,8 +11,8 @@ namespace boost { namespace contract { template set_old_postcondition<> destructor(C* obj) { - // Must check ..._PRECONDITIONS here because set_... is generic. - #if BOOST_CONTRACT_DESTRUCTURS + // Must #if also on ..._PRECONDITIONS here because set_... is generic. + #if BOOST_CONTRACT_DESTRUCTORS || BOOST_CONTRACT_PRECONDITIONS return set_old_postcondition<>( new boost::contract::aux::destructor(obj)); #else diff --git a/include/boost/contract/public_function.hpp b/include/boost/contract/public_function.hpp index 5b8577d..596490c 100644 --- a/include/boost/contract/public_function.hpp +++ b/include/boost/contract/public_function.hpp @@ -2,7 +2,9 @@ #ifndef BOOST_CONTRACT_PUBLIC_FUNCTION_HPP_ #define BOOST_CONTRACT_PUBLIC_FUNCTION_HPP_ -// TODO: See if by reimplementing a few Boost.MPL constructs (vector, for_each, etc.) using variadic template, I can support truly any number of function arguments on C++11. +// TODO: Document that even with variadic templates there's a hard limit to function max args (18 works, but MAX_ARGS=19 does not). This limit comes from Boost.MPL (vector, push_back, etc.), Boost.FunctionTypes, and other Boost algorithm that do not currently have a variadic template implementation. However, re-impl all these Boost alg would be too much work for this lib, plus the 19 max args limit seems high enough, and it would eventually be removed if Boost.MPL, Boost.FunctionTypes are ever ported to impl that use variadic templates. + +// TODO: Document that not using variadic templates (i.e., using pp meta-programming impl instead) does not increase compilation times (I measured this with the max_arg test program). // TODO: Check all #includes for all files... and make sure that #include not of this library are within @cond ... @endcond. Also disable #include when not needed based on BOOST_CONTRACT_PRECONDITIONS, etc. Also all public header files should include *all* core/*.hpp so users never have to (I could use a aux_/all_core_headers.hpp that includes all core/*.hpp and always #include aux_/core.hpp in all public headers instead of including core/... directly from public headers). diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index ff5a730..4ddee82 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -130,6 +130,8 @@ test-suite public_function [ subdir-run-withno public_function : max_args ] [ subdir-run-withno public_function : max_args_no_tva ] + [ subdir-run-withno public_function : max_bases ] + [ subdir-run-withno public_function : overload ] [ subdir-run-withno public_function : overload_no_tva ] diff --git a/test/aux_/counter.hpp b/test/aux_/counter.hpp index e8f0c42..8822333 100644 --- a/test/aux_/counter.hpp +++ b/test/aux_/counter.hpp @@ -1,8 +1,8 @@ -#ifndef BOOST_CONTRACT_AUX_TEST_COUNTER_HPP_ -#define BOOST_CONTRACT_AUX_TEST_COUNTER_HPP_ +#ifndef BOOST_CONTRACT_TEST_AUX_COUNTER_HPP_ +#define BOOST_CONTRACT_TEST_AUX_COUNTER_HPP_ -namespace boost { namespace contract { namespace aux { namespace test { +namespace boost { namespace contract { namespace test { namespace aux { // Helper to count copies and evaluations of type (e.g., for old values). template diff --git a/test/aux_/oteststream.hpp b/test/aux_/oteststream.hpp index 4d19420..4e2cba7 100644 --- a/test/aux_/oteststream.hpp +++ b/test/aux_/oteststream.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_AUX_TEST_OTESTSTREAM_HPP_ -#define BOOST_CONTRACT_AUX_TEST_OTESTSTREAM_HPP_ +#ifndef BOOST_CONTRACT_TEST_AUX_OTESTSTREAM_HPP_ +#define BOOST_CONTRACT_TEST_AUX_OTESTSTREAM_HPP_ #include #include @@ -8,7 +8,7 @@ #include #include -namespace boost { namespace contract { namespace aux { namespace test { +namespace boost { namespace contract { namespace test { namespace aux { namespace oteststream_ { struct oss_base { // Wrap oss data member for proper initialization order. diff --git a/test/call_if/advance_cxx14.cpp b/test/call_if/advance_cxx14.cpp index fde0b52..ff05909 100644 --- a/test/call_if/advance_cxx14.cpp +++ b/test/call_if/advance_cxx14.cpp @@ -11,7 +11,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; template struct is_random_access_iterator : std::is_same< diff --git a/test/call_if/equal_to.cpp b/test/call_if/equal_to.cpp index 3f6ac1e..b825c87 100644 --- a/test/call_if/equal_to.cpp +++ b/test/call_if/equal_to.cpp @@ -9,7 +9,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; template struct void_equal_to { diff --git a/test/call_if/equal_to_cxx14.cpp b/test/call_if/equal_to_cxx14.cpp index 8eac42e..9467ed0 100644 --- a/test/call_if/equal_to_cxx14.cpp +++ b/test/call_if/equal_to_cxx14.cpp @@ -8,7 +8,7 @@ #include // std::bind for generic lambdas. #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct x {}; // Does not have operator==. diff --git a/test/call_if/false_.cpp b/test/call_if/false_.cpp index 7aef3ad..a088997 100644 --- a/test/call_if/false_.cpp +++ b/test/call_if/false_.cpp @@ -8,7 +8,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct eq { typedef bool result_type; // Test non-void result type. diff --git a/test/call_if/false_void.cpp b/test/call_if/false_void.cpp index e682828..283138f 100644 --- a/test/call_if/false_void.cpp +++ b/test/call_if/false_void.cpp @@ -8,7 +8,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct eq { typedef void result_type; // Test void result type. diff --git a/test/call_if/true_.cpp b/test/call_if/true_.cpp index 4000920..10e6d01 100644 --- a/test/call_if/true_.cpp +++ b/test/call_if/true_.cpp @@ -8,7 +8,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct eq { typedef bool result_type; // Test non-void result type. diff --git a/test/call_if/true_void.cpp b/test/call_if/true_void.cpp index d0957d1..77c0044 100644 --- a/test/call_if/true_void.cpp +++ b/test/call_if/true_void.cpp @@ -8,7 +8,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct eq { typedef void result_type; // Test void result type. diff --git a/test/constructor/access.cpp b/test/constructor/access.cpp index 85a3c14..5d2517e 100644 --- a/test/constructor/access.cpp +++ b/test/constructor/access.cpp @@ -8,7 +8,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; class b #define BASES private boost::contract::constructor_precondition diff --git a/test/constructor/bases.cpp b/test/constructor/bases.cpp index 1a0565d..f1a7575 100644 --- a/test/constructor/bases.cpp +++ b/test/constructor/bases.cpp @@ -14,7 +14,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; template struct t @@ -35,11 +35,11 @@ struct t } struct l_tag; - typedef boost::contract::aux::test::counter l_type; + typedef boost::contract::test::aux::counter l_type; static l_type l; struct z_tag; - typedef boost::contract::aux::test::counter z_type; + typedef boost::contract::test::aux::counter z_type; explicit t(z_type& z) : boost::contract::constructor_precondition >([&] { @@ -97,11 +97,11 @@ struct c } struct m_tag; - typedef boost::contract::aux::test::counter m_type; + typedef boost::contract::test::aux::counter m_type; static m_type m; struct y_tag; - typedef boost::contract::aux::test::counter y_type; + typedef boost::contract::test::aux::counter y_type; explicit c(y_type& y, t<'d'>::z_type& dz, t<'p'>::z_type& pz, t<'q'>::z_type& qz, t<'e'>::z_type& ez) : @@ -173,11 +173,11 @@ struct a } struct n_tag; - typedef boost::contract::aux::test::counter n_type; + typedef boost::contract::test::aux::counter n_type; static n_type n; struct x_tag; - typedef boost::contract::aux::test::counter x_type; + typedef boost::contract::test::aux::counter x_type; explicit a(x_type& x, c::y_type& y, t<'d'>::z_type& dz, t<'p'>::z_type& pz, t<'q'>::z_type& qz, t<'e'>::z_type& ez) : diff --git a/test/constructor/body_throw.cpp b/test/constructor/body_throw.cpp index e012746..b8b0a3c 100644 --- a/test/constructor/body_throw.cpp +++ b/test/constructor/body_throw.cpp @@ -8,7 +8,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct c #define BASES private boost::contract::constructor_precondition diff --git a/test/constructor/decl.hpp b/test/constructor/decl.hpp index 9251aef..cba4530 100644 --- a/test/constructor/decl.hpp +++ b/test/constructor/decl.hpp @@ -10,48 +10,48 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; bool c_pre = true, c_post = true; bool c_entering_static_inv = true, c_entry_static_inv = true, c_exit_static_inv = true; bool c_exit_inv = true; // Only exit non-static inv for ctors. struct c -#ifndef BOOST_CONTRACT_AUX_TEST_NO_C_PRE - : private boost::contract::constructor_precondition -#endif + #ifndef BOOST_CONTRACT_TEST_NO_C_PRE + : private boost::contract::constructor_precondition + #endif { -#ifndef BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV - static void static_invariant() { - out << "c::static_inv" << std::endl; - if(c_entering_static_inv) BOOST_CONTRACT_ASSERT(c_entry_static_inv); - else BOOST_CONTRACT_ASSERT(c_exit_static_inv); - c_entering_static_inv = false; - } -#endif -#ifndef BOOST_CONTRACT_AUX_TEST_NO_C_INV - void invariant() const { - out << "c::inv" << std::endl; - BOOST_CONTRACT_ASSERT(c_exit_inv); - } -#endif + #ifndef BOOST_CONTRACT_TEST_NO_C_STATIC_INV + static void static_invariant() { + out << "c::static_inv" << std::endl; + if(c_entering_static_inv) BOOST_CONTRACT_ASSERT(c_entry_static_inv); + else BOOST_CONTRACT_ASSERT(c_exit_static_inv); + c_entering_static_inv = false; + } + #endif + #ifndef BOOST_CONTRACT_TEST_NO_C_INV + void invariant() const { + out << "c::inv" << std::endl; + BOOST_CONTRACT_ASSERT(c_exit_inv); + } + #endif c() -#ifndef BOOST_CONTRACT_AUX_TEST_NO_C_PRE - : boost::contract::constructor_precondition([] { - out << "c::ctor::pre" << std::endl; - BOOST_CONTRACT_ASSERT(c_pre); - }) -#endif + #ifndef BOOST_CONTRACT_TEST_NO_C_PRE + : boost::contract::constructor_precondition([] { + out << "c::ctor::pre" << std::endl; + BOOST_CONTRACT_ASSERT(c_pre); + }) + #endif { boost::contract::guard c = boost::contract::constructor(this) .old([] { out << "c::ctor::old" << std::endl; }) -#ifndef BOOST_CONTRACT_AUX_TEST_NO_C_POST - .postcondition([] { - out << "c::ctor::post" << std::endl; - BOOST_CONTRACT_ASSERT(c_post); - }) -#endif + #ifndef BOOST_CONTRACT_TEST_NO_C_POST + .postcondition([] { + out << "c::ctor::post" << std::endl; + BOOST_CONTRACT_ASSERT(c_post); + }) + #endif ; out << "c::ctor::body" << std::endl; } @@ -62,47 +62,48 @@ bool b_entering_static_inv = true, b_entry_static_inv = true, b_exit_static_inv = true; bool b_exit_inv = true; // Only exit non-static inv for ctors. struct b -#ifndef BOOST_CONTRACT_AUX_TEST_NO_B_PRE -# define BASES private boost::contract::constructor_precondition, public c -#else -# define BASES public c -#endif + #ifndef BOOST_CONTRACT_TEST_NO_B_PRE + #define BASES \ + private boost::contract::constructor_precondition, public c + #else + #define BASES public c + #endif : BASES { typedef BOOST_CONTRACT_BASE_TYPES(BASES) base_types; #undef BASES -#ifndef BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV - static void static_invariant() { - out << "b::static_inv" << std::endl; - if(b_entering_static_inv) BOOST_CONTRACT_ASSERT(b_entry_static_inv); - else BOOST_CONTRACT_ASSERT(b_exit_static_inv); - b_entering_static_inv = false; - } -#endif -#ifndef BOOST_CONTRACT_AUX_TEST_NO_B_INV - void invariant() const { - out << "b::inv" << std::endl; - BOOST_CONTRACT_ASSERT(b_exit_inv); - } -#endif + #ifndef BOOST_CONTRACT_TEST_NO_B_STATIC_INV + static void static_invariant() { + out << "b::static_inv" << std::endl; + if(b_entering_static_inv) BOOST_CONTRACT_ASSERT(b_entry_static_inv); + else BOOST_CONTRACT_ASSERT(b_exit_static_inv); + b_entering_static_inv = false; + } + #endif + #ifndef BOOST_CONTRACT_TEST_NO_B_INV + void invariant() const { + out << "b::inv" << std::endl; + BOOST_CONTRACT_ASSERT(b_exit_inv); + } + #endif b() -#ifndef BOOST_CONTRACT_AUX_TEST_NO_B_PRE - : boost::contract::constructor_precondition([] { - out << "b::ctor::pre" << std::endl; - BOOST_CONTRACT_ASSERT(b_pre); - }) -#endif + #ifndef BOOST_CONTRACT_TEST_NO_B_PRE + : boost::contract::constructor_precondition([] { + out << "b::ctor::pre" << std::endl; + BOOST_CONTRACT_ASSERT(b_pre); + }) + #endif { boost::contract::guard c = boost::contract::constructor(this) .old([] { out << "b::ctor::old" << std::endl; }) -#ifndef BOOST_CONTRACT_AUX_TEST_NO_B_POST - .postcondition([] { - out << "b::ctor::post" << std::endl; - BOOST_CONTRACT_ASSERT(b_post); - }) -#endif + #ifndef BOOST_CONTRACT_TEST_NO_B_POST + .postcondition([] { + out << "b::ctor::post" << std::endl; + BOOST_CONTRACT_ASSERT(b_post); + }) + #endif ; out << "b::ctor::body" << std::endl; } @@ -113,47 +114,48 @@ bool a_entering_static_inv = true, a_entry_static_inv = true, a_exit_static_inv = true; bool a_exit_inv = true; // Only exit non-static inv for ctors. struct a -#ifndef BOOST_CONTRACT_AUX_TEST_NO_A_PRE -# define BASES private boost::contract::constructor_precondition, public b -#else -# define BASES public b -#endif + #ifndef BOOST_CONTRACT_TEST_NO_A_PRE + #define BASES \ + private boost::contract::constructor_precondition, public b + #else + #define BASES public b + #endif : BASES { typedef BOOST_CONTRACT_BASE_TYPES(BASES) base_types; #undef BASES -#ifndef BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV - static void static_invariant() { - out << "a::static_inv" << std::endl; - if(a_entering_static_inv) BOOST_CONTRACT_ASSERT(a_entry_static_inv); - else BOOST_CONTRACT_ASSERT(a_exit_static_inv); - a_entering_static_inv = false; - } -#endif -#ifndef BOOST_CONTRACT_AUX_TEST_NO_A_INV - void invariant() const { - out << "a::inv" << std::endl; - BOOST_CONTRACT_ASSERT(a_exit_inv); - } -#endif + #ifndef BOOST_CONTRACT_TEST_NO_A_STATIC_INV + static void static_invariant() { + out << "a::static_inv" << std::endl; + if(a_entering_static_inv) BOOST_CONTRACT_ASSERT(a_entry_static_inv); + else BOOST_CONTRACT_ASSERT(a_exit_static_inv); + a_entering_static_inv = false; + } + #endif + #ifndef BOOST_CONTRACT_TEST_NO_A_INV + void invariant() const { + out << "a::inv" << std::endl; + BOOST_CONTRACT_ASSERT(a_exit_inv); + } + #endif a() -#ifndef BOOST_CONTRACT_AUX_TEST_NO_A_PRE - : boost::contract::constructor_precondition([] { - out << "a::ctor::pre" << std::endl; - BOOST_CONTRACT_ASSERT(a_pre); - }) -#endif + #ifndef BOOST_CONTRACT_TEST_NO_A_PRE + : boost::contract::constructor_precondition([] { + out << "a::ctor::pre" << std::endl; + BOOST_CONTRACT_ASSERT(a_pre); + }) + #endif { boost::contract::guard c = boost::contract::constructor(this) .old([] { out << "a::ctor::old" << std::endl; }) -#ifndef BOOST_CONTRACT_AUX_TEST_NO_A_POST - .postcondition([] { - out << "a::ctor::post" << std::endl; - BOOST_CONTRACT_ASSERT(a_post); - }) -#endif + #ifndef BOOST_CONTRACT_TEST_NO_A_POST + .postcondition([] { + out << "a::ctor::post" << std::endl; + BOOST_CONTRACT_ASSERT(a_post); + }) + #endif ; out << "a::ctor::body" << std::endl; } diff --git a/test/constructor/decl_entry_static_inv_all.cpp b/test/constructor/decl_entry_static_inv_all.cpp index 95d7842..9bfeedd 100644 --- a/test/constructor/decl_entry_static_inv_all.cpp +++ b/test/constructor/decl_entry_static_inv_all.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes with entry static invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/constructor/decl_entry_static_inv_ends.cpp b/test/constructor/decl_entry_static_inv_ends.cpp index aaaacc5..1454e5f 100644 --- a/test/constructor/decl_entry_static_inv_ends.cpp +++ b/test/constructor/decl_entry_static_inv_ends.cpp @@ -1,9 +1,9 @@ // Test only derived and grandparent classes (ends) with entry static inv. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/constructor/decl_entry_static_inv_mid.cpp b/test/constructor/decl_entry_static_inv_mid.cpp index 83bdd7b..06d6a48 100644 --- a/test/constructor/decl_entry_static_inv_mid.cpp +++ b/test/constructor/decl_entry_static_inv_mid.cpp @@ -1,9 +1,9 @@ // Test only middle base class with entry static invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/constructor/decl_entry_static_inv_none.cpp b/test/constructor/decl_entry_static_inv_none.cpp index 3f9686c..d515491 100644 --- a/test/constructor/decl_entry_static_inv_none.cpp +++ b/test/constructor/decl_entry_static_inv_none.cpp @@ -1,9 +1,9 @@ // Test only middle base class with entry static invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/constructor/decl_exit_inv_all.cpp b/test/constructor/decl_exit_inv_all.cpp index 1eeb38a..74093cc 100644 --- a/test/constructor/decl_exit_inv_all.cpp +++ b/test/constructor/decl_exit_inv_all.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes with exit invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_INV +#undef BOOST_CONTRACT_TEST_NO_A_INV +#undef BOOST_CONTRACT_TEST_NO_B_INV +#undef BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/constructor/decl_exit_inv_ends.cpp b/test/constructor/decl_exit_inv_ends.cpp index e526fe1..d4d8a4c 100644 --- a/test/constructor/decl_exit_inv_ends.cpp +++ b/test/constructor/decl_exit_inv_ends.cpp @@ -1,9 +1,9 @@ // Test only derived and grandparent classes (ends) with exit invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_INV +#undef BOOST_CONTRACT_TEST_NO_A_INV +#define BOOST_CONTRACT_TEST_NO_B_INV +#undef BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/constructor/decl_exit_inv_mid.cpp b/test/constructor/decl_exit_inv_mid.cpp index 81c365b..7938738 100644 --- a/test/constructor/decl_exit_inv_mid.cpp +++ b/test/constructor/decl_exit_inv_mid.cpp @@ -1,9 +1,9 @@ // Test only middle class with exit invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_INV +#define BOOST_CONTRACT_TEST_NO_A_INV +#undef BOOST_CONTRACT_TEST_NO_B_INV +#define BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/constructor/decl_exit_inv_none.cpp b/test/constructor/decl_exit_inv_none.cpp index 74c7efd..5cb364a 100644 --- a/test/constructor/decl_exit_inv_none.cpp +++ b/test/constructor/decl_exit_inv_none.cpp @@ -1,9 +1,9 @@ // Test all derived and grandparent classes (ends) with exit invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_INV +#define BOOST_CONTRACT_TEST_NO_A_INV +#define BOOST_CONTRACT_TEST_NO_B_INV +#define BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/constructor/decl_exit_static_inv_all.cpp b/test/constructor/decl_exit_static_inv_all.cpp index d8d5bf8..0cc42b2 100644 --- a/test/constructor/decl_exit_static_inv_all.cpp +++ b/test/constructor/decl_exit_static_inv_all.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes with exit static invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/constructor/decl_exit_static_inv_ends.cpp b/test/constructor/decl_exit_static_inv_ends.cpp index 4b080d9..053ec62 100644 --- a/test/constructor/decl_exit_static_inv_ends.cpp +++ b/test/constructor/decl_exit_static_inv_ends.cpp @@ -1,9 +1,9 @@ // Test all derived and grandparent classes (ends) with exit static invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/constructor/decl_exit_static_inv_mid.cpp b/test/constructor/decl_exit_static_inv_mid.cpp index a451f91..300a079 100644 --- a/test/constructor/decl_exit_static_inv_mid.cpp +++ b/test/constructor/decl_exit_static_inv_mid.cpp @@ -1,9 +1,9 @@ // Test only middle base class with exit static invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/constructor/decl_exit_static_inv_none.cpp b/test/constructor/decl_exit_static_inv_none.cpp index 1055dc5..86c4a79 100644 --- a/test/constructor/decl_exit_static_inv_none.cpp +++ b/test/constructor/decl_exit_static_inv_none.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes without exit static invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/constructor/decl_post_all.cpp b/test/constructor/decl_post_all.cpp index d66b629..b8d7332 100644 --- a/test/constructor/decl_post_all.cpp +++ b/test/constructor/decl_post_all.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes with postconditions. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_POST -#undef BOOST_CONTRACT_AUX_TEST_NO_B_POST -#undef BOOST_CONTRACT_AUX_TEST_NO_C_POST +#undef BOOST_CONTRACT_TEST_NO_A_POST +#undef BOOST_CONTRACT_TEST_NO_B_POST +#undef BOOST_CONTRACT_TEST_NO_C_POST #include "decl.hpp" #include diff --git a/test/constructor/decl_post_ends.cpp b/test/constructor/decl_post_ends.cpp index 30d4f49..add5703 100644 --- a/test/constructor/decl_post_ends.cpp +++ b/test/constructor/decl_post_ends.cpp @@ -1,9 +1,9 @@ // Test only derived and grandparent classes (ends) with postconditions. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_POST -#define BOOST_CONTRACT_AUX_TEST_NO_B_POST -#undef BOOST_CONTRACT_AUX_TEST_NO_C_POST +#undef BOOST_CONTRACT_TEST_NO_A_POST +#define BOOST_CONTRACT_TEST_NO_B_POST +#undef BOOST_CONTRACT_TEST_NO_C_POST #include "decl.hpp" #include diff --git a/test/constructor/decl_post_mid.cpp b/test/constructor/decl_post_mid.cpp index 65fb6df..ba96f80 100644 --- a/test/constructor/decl_post_mid.cpp +++ b/test/constructor/decl_post_mid.cpp @@ -1,9 +1,9 @@ // Test only middle base class with postconditions. -#define BOOST_CONTRACT_AUX_TEST_NO_A_POST -#undef BOOST_CONTRACT_AUX_TEST_NO_B_POST -#define BOOST_CONTRACT_AUX_TEST_NO_C_POST +#define BOOST_CONTRACT_TEST_NO_A_POST +#undef BOOST_CONTRACT_TEST_NO_B_POST +#define BOOST_CONTRACT_TEST_NO_C_POST #include "decl.hpp" #include diff --git a/test/constructor/decl_post_none.cpp b/test/constructor/decl_post_none.cpp index 8e908e3..acc4810 100644 --- a/test/constructor/decl_post_none.cpp +++ b/test/constructor/decl_post_none.cpp @@ -1,9 +1,9 @@ // Test only middle base class with postconditions. -#define BOOST_CONTRACT_AUX_TEST_NO_A_POST -#define BOOST_CONTRACT_AUX_TEST_NO_B_POST -#define BOOST_CONTRACT_AUX_TEST_NO_C_POST +#define BOOST_CONTRACT_TEST_NO_A_POST +#define BOOST_CONTRACT_TEST_NO_B_POST +#define BOOST_CONTRACT_TEST_NO_C_POST #include "decl.hpp" #include diff --git a/test/constructor/decl_pre_all.cpp b/test/constructor/decl_pre_all.cpp index de74743..048b4d4 100644 --- a/test/constructor/decl_pre_all.cpp +++ b/test/constructor/decl_pre_all.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes with preconditions. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_PRE -#undef BOOST_CONTRACT_AUX_TEST_NO_B_PRE -#undef BOOST_CONTRACT_AUX_TEST_NO_C_PRE +#undef BOOST_CONTRACT_TEST_NO_A_PRE +#undef BOOST_CONTRACT_TEST_NO_B_PRE +#undef BOOST_CONTRACT_TEST_NO_C_PRE #include "decl.hpp" #include diff --git a/test/constructor/decl_pre_ends.cpp b/test/constructor/decl_pre_ends.cpp index 91eca8d..77cb7f6 100644 --- a/test/constructor/decl_pre_ends.cpp +++ b/test/constructor/decl_pre_ends.cpp @@ -1,9 +1,9 @@ // Test only derived and grandparent classes (ends) with preconditions. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_PRE -#define BOOST_CONTRACT_AUX_TEST_NO_B_PRE -#undef BOOST_CONTRACT_AUX_TEST_NO_C_PRE +#undef BOOST_CONTRACT_TEST_NO_A_PRE +#define BOOST_CONTRACT_TEST_NO_B_PRE +#undef BOOST_CONTRACT_TEST_NO_C_PRE #include "decl.hpp" #include diff --git a/test/constructor/decl_pre_mid.cpp b/test/constructor/decl_pre_mid.cpp index 04a8d0d..8744071 100644 --- a/test/constructor/decl_pre_mid.cpp +++ b/test/constructor/decl_pre_mid.cpp @@ -1,9 +1,9 @@ // Test only middle base classes with preconditions. -#define BOOST_CONTRACT_AUX_TEST_NO_A_PRE -#undef BOOST_CONTRACT_AUX_TEST_NO_B_PRE -#define BOOST_CONTRACT_AUX_TEST_NO_C_PRE +#define BOOST_CONTRACT_TEST_NO_A_PRE +#undef BOOST_CONTRACT_TEST_NO_B_PRE +#define BOOST_CONTRACT_TEST_NO_C_PRE #include "decl.hpp" #include diff --git a/test/constructor/decl_pre_none.cpp b/test/constructor/decl_pre_none.cpp index d3c2fca..b69956c 100644 --- a/test/constructor/decl_pre_none.cpp +++ b/test/constructor/decl_pre_none.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes without preconditions. -#define BOOST_CONTRACT_AUX_TEST_NO_A_PRE -#define BOOST_CONTRACT_AUX_TEST_NO_B_PRE -#define BOOST_CONTRACT_AUX_TEST_NO_C_PRE +#define BOOST_CONTRACT_TEST_NO_A_PRE +#define BOOST_CONTRACT_TEST_NO_B_PRE +#define BOOST_CONTRACT_TEST_NO_C_PRE #include "decl.hpp" #include diff --git a/test/constructor/no_contracts.cpp b/test/constructor/no_contracts.cpp index 73653f9..4482841 100644 --- a/test/constructor/no_contracts.cpp +++ b/test/constructor/no_contracts.cpp @@ -11,7 +11,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct b #if BOOST_CONTRACT_PRECONDITIONS diff --git a/test/constructor/old_throw.cpp b/test/constructor/old_throw.cpp index e4a7f2f..65029c7 100644 --- a/test/constructor/old_throw.cpp +++ b/test/constructor/old_throw.cpp @@ -8,7 +8,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct c #define BASES private boost::contract::constructor_precondition diff --git a/test/destructor/access.cpp b/test/destructor/access.cpp index f796f53..0e65050 100644 --- a/test/destructor/access.cpp +++ b/test/destructor/access.cpp @@ -8,7 +8,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; class b { friend class boost::contract::access; diff --git a/test/destructor/bases.cpp b/test/destructor/bases.cpp index d714413..5245541 100644 --- a/test/destructor/bases.cpp +++ b/test/destructor/bases.cpp @@ -12,7 +12,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; template struct t { @@ -27,7 +27,7 @@ struct t { } struct l_tag; - typedef boost::contract::aux::test::counter l_type; + typedef boost::contract::test::aux::counter l_type; static l_type l; explicit t() : k_(-1) { ++l.value; } @@ -75,7 +75,7 @@ struct c } struct m_tag; - typedef boost::contract::aux::test::counter m_type; + typedef boost::contract::test::aux::counter m_type; static m_type m; explicit c() : j_(-1) { ++m.value; } @@ -130,7 +130,7 @@ struct a } struct n_tag; - typedef boost::contract::aux::test::counter n_type; + typedef boost::contract::test::aux::counter n_type; static n_type n; explicit a() : i_(-1) { ++n.value; } diff --git a/test/destructor/body_throw.cpp b/test/destructor/body_throw.cpp index 210a494..43a42b0 100644 --- a/test/destructor/body_throw.cpp +++ b/test/destructor/body_throw.cpp @@ -9,7 +9,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct c { static void static_invariant() { out << "c::static_inv" << std::endl; } diff --git a/test/destructor/decl.hpp b/test/destructor/decl.hpp index 7731851..d259e9c 100644 --- a/test/destructor/decl.hpp +++ b/test/destructor/decl.hpp @@ -11,40 +11,40 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; bool c_pre = true, c_post = true; bool c_entering_static_inv = true, c_entry_static_inv = true, c_exit_static_inv = true; bool c_entry_inv = true; // Only entry non-static inv for dtors. struct c { -#ifndef BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV - static void static_invariant() { - out << "c::static_inv" << std::endl; - if(c_entering_static_inv) BOOST_CONTRACT_ASSERT(c_entry_static_inv); - else BOOST_CONTRACT_ASSERT(c_exit_static_inv); - c_entering_static_inv = false; - } -#endif -#ifndef BOOST_CONTRACT_AUX_TEST_NO_C_INV - void invariant() const { - out << "c::inv" << std::endl; - BOOST_CONTRACT_ASSERT(c_entry_inv); - } -#endif + #ifndef BOOST_CONTRACT_TEST_NO_C_STATIC_INV + static void static_invariant() { + out << "c::static_inv" << std::endl; + if(c_entering_static_inv) BOOST_CONTRACT_ASSERT(c_entry_static_inv); + else BOOST_CONTRACT_ASSERT(c_exit_static_inv); + c_entering_static_inv = false; + } + #endif + #ifndef BOOST_CONTRACT_TEST_NO_C_INV + void invariant() const { + out << "c::inv" << std::endl; + BOOST_CONTRACT_ASSERT(c_entry_inv); + } + #endif virtual ~c() BOOST_NOEXCEPT_IF(false) { boost::contract::guard c = boost::contract::destructor(this) -#ifdef BOOST_CONTRACT_AUX_TEST_NO_C_PRE -# error "destructors cannot have preconditions" -#endif + #ifdef BOOST_CONTRACT_TEST_NO_C_PRE + #error "destructors cannot have preconditions" + #endif .old([] { out << "c::dtor::old" << std::endl; }) -#ifndef BOOST_CONTRACT_AUX_TEST_NO_C_POST - .postcondition([] { - out << "c::dtor::post" << std::endl; - BOOST_CONTRACT_ASSERT(c_post); - }) -#endif + #ifndef BOOST_CONTRACT_TEST_NO_C_POST + .postcondition([] { + out << "c::dtor::post" << std::endl; + BOOST_CONTRACT_ASSERT(c_post); + }) + #endif ; out << "c::dtor::body" << std::endl; } @@ -61,33 +61,33 @@ struct b typedef BOOST_CONTRACT_BASE_TYPES(BASES) base_types; #undef BASES -#ifndef BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV - static void static_invariant() { - out << "b::static_inv" << std::endl; - if(b_entering_static_inv) BOOST_CONTRACT_ASSERT(b_entry_static_inv); - else BOOST_CONTRACT_ASSERT(b_exit_static_inv); - b_entering_static_inv = false; - } -#endif -#ifndef BOOST_CONTRACT_AUX_TEST_NO_B_INV - void invariant() const { - out << "b::inv" << std::endl; - BOOST_CONTRACT_ASSERT(b_entry_inv); - } -#endif + #ifndef BOOST_CONTRACT_TEST_NO_B_STATIC_INV + static void static_invariant() { + out << "b::static_inv" << std::endl; + if(b_entering_static_inv) BOOST_CONTRACT_ASSERT(b_entry_static_inv); + else BOOST_CONTRACT_ASSERT(b_exit_static_inv); + b_entering_static_inv = false; + } + #endif + #ifndef BOOST_CONTRACT_TEST_NO_B_INV + void invariant() const { + out << "b::inv" << std::endl; + BOOST_CONTRACT_ASSERT(b_entry_inv); + } + #endif virtual ~b() BOOST_NOEXCEPT_IF(false) { boost::contract::guard c = boost::contract::destructor(this) -#ifdef BOOST_CONTRACT_AUX_TEST_NO_B_PRE -# error "destructors cannot have preconditions" -#endif + #ifdef BOOST_CONTRACT_TEST_NO_B_PRE + #error "destructors cannot have preconditions" + #endif .old([] { out << "b::dtor::old" << std::endl; }) -#ifndef BOOST_CONTRACT_AUX_TEST_NO_B_POST - .postcondition([] { - out << "b::dtor::post" << std::endl; - BOOST_CONTRACT_ASSERT(b_post); - }) -#endif + #ifndef BOOST_CONTRACT_TEST_NO_B_POST + .postcondition([] { + out << "b::dtor::post" << std::endl; + BOOST_CONTRACT_ASSERT(b_post); + }) + #endif ; out << "b::dtor::body" << std::endl; } @@ -104,33 +104,33 @@ struct a typedef BOOST_CONTRACT_BASE_TYPES(BASES) base_types; #undef BASES -#ifndef BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV - static void static_invariant() { - out << "a::static_inv" << std::endl; - if(a_entering_static_inv) BOOST_CONTRACT_ASSERT(a_entry_static_inv); - else BOOST_CONTRACT_ASSERT(a_exit_static_inv); - a_entering_static_inv = false; - } -#endif -#ifndef BOOST_CONTRACT_AUX_TEST_NO_A_INV - void invariant() const { - out << "a::inv" << std::endl; - BOOST_CONTRACT_ASSERT(a_entry_inv); - } -#endif + #ifndef BOOST_CONTRACT_TEST_NO_A_STATIC_INV + static void static_invariant() { + out << "a::static_inv" << std::endl; + if(a_entering_static_inv) BOOST_CONTRACT_ASSERT(a_entry_static_inv); + else BOOST_CONTRACT_ASSERT(a_exit_static_inv); + a_entering_static_inv = false; + } + #endif + #ifndef BOOST_CONTRACT_TEST_NO_A_INV + void invariant() const { + out << "a::inv" << std::endl; + BOOST_CONTRACT_ASSERT(a_entry_inv); + } + #endif virtual ~a() BOOST_NOEXCEPT_IF(false) { boost::contract::guard c = boost::contract::destructor(this) -#ifdef BOOST_CONTRACT_AUX_TEST_NO_A_PRE -# error "destructors cannot have preconditions" -#endif + #ifdef BOOST_CONTRACT_TEST_NO_A_PRE + #error "destructors cannot have preconditions" + #endif .old([] { out << "a::dtor::old" << std::endl; }) -#ifndef BOOST_CONTRACT_AUX_TEST_NO_A_POST - .postcondition([] { - out << "a::dtor::post" << std::endl; - BOOST_CONTRACT_ASSERT(a_post); - }) -#endif + #ifndef BOOST_CONTRACT_TEST_NO_A_POST + .postcondition([] { + out << "a::dtor::post" << std::endl; + BOOST_CONTRACT_ASSERT(a_post); + }) + #endif ; out << "a::dtor::body" << std::endl; } diff --git a/test/destructor/decl_entry_inv_all.cpp b/test/destructor/decl_entry_inv_all.cpp index 88404d4..9846f62 100644 --- a/test/destructor/decl_entry_inv_all.cpp +++ b/test/destructor/decl_entry_inv_all.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes with entry static invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_INV +#undef BOOST_CONTRACT_TEST_NO_A_INV +#undef BOOST_CONTRACT_TEST_NO_B_INV +#undef BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/destructor/decl_entry_inv_ends.cpp b/test/destructor/decl_entry_inv_ends.cpp index 2bcefea..b5919e2 100644 --- a/test/destructor/decl_entry_inv_ends.cpp +++ b/test/destructor/decl_entry_inv_ends.cpp @@ -1,9 +1,9 @@ // Test only derived and grandparent classes (ends) with entry invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_INV +#undef BOOST_CONTRACT_TEST_NO_A_INV +#define BOOST_CONTRACT_TEST_NO_B_INV +#undef BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/destructor/decl_entry_inv_mid.cpp b/test/destructor/decl_entry_inv_mid.cpp index 958a9c6..d32441e 100644 --- a/test/destructor/decl_entry_inv_mid.cpp +++ b/test/destructor/decl_entry_inv_mid.cpp @@ -1,9 +1,9 @@ // Test only middle base class with entry invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_INV +#define BOOST_CONTRACT_TEST_NO_A_INV +#undef BOOST_CONTRACT_TEST_NO_B_INV +#define BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/destructor/decl_entry_inv_none.cpp b/test/destructor/decl_entry_inv_none.cpp index ffcc492..3b60c4a 100644 --- a/test/destructor/decl_entry_inv_none.cpp +++ b/test/destructor/decl_entry_inv_none.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes without entry invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_INV +#define BOOST_CONTRACT_TEST_NO_A_INV +#define BOOST_CONTRACT_TEST_NO_B_INV +#define BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/destructor/decl_entry_static_inv_all.cpp b/test/destructor/decl_entry_static_inv_all.cpp index bbb7eeb..2b45a62 100644 --- a/test/destructor/decl_entry_static_inv_all.cpp +++ b/test/destructor/decl_entry_static_inv_all.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes with entry static invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/destructor/decl_entry_static_inv_ends.cpp b/test/destructor/decl_entry_static_inv_ends.cpp index c26b329..e8bc9dd 100644 --- a/test/destructor/decl_entry_static_inv_ends.cpp +++ b/test/destructor/decl_entry_static_inv_ends.cpp @@ -1,9 +1,9 @@ // Test only derived and grandparent classes (ends) with entry static inv. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/destructor/decl_entry_static_inv_mid.cpp b/test/destructor/decl_entry_static_inv_mid.cpp index 242b30f..29f151d 100644 --- a/test/destructor/decl_entry_static_inv_mid.cpp +++ b/test/destructor/decl_entry_static_inv_mid.cpp @@ -1,9 +1,9 @@ // Test only middle base class with entry static invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/destructor/decl_entry_static_inv_none.cpp b/test/destructor/decl_entry_static_inv_none.cpp index 0ca89ca..7dae42c 100644 --- a/test/destructor/decl_entry_static_inv_none.cpp +++ b/test/destructor/decl_entry_static_inv_none.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes without entry static invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/destructor/decl_exit_static_inv_all.cpp b/test/destructor/decl_exit_static_inv_all.cpp index 87cc21f..73471af 100644 --- a/test/destructor/decl_exit_static_inv_all.cpp +++ b/test/destructor/decl_exit_static_inv_all.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes with exit static invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/destructor/decl_exit_static_inv_ends.cpp b/test/destructor/decl_exit_static_inv_ends.cpp index b8412c3..d5a7dcb 100644 --- a/test/destructor/decl_exit_static_inv_ends.cpp +++ b/test/destructor/decl_exit_static_inv_ends.cpp @@ -1,9 +1,9 @@ // Test only derived and grandparent classes (ends) with exit static invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/destructor/decl_exit_static_inv_mid.cpp b/test/destructor/decl_exit_static_inv_mid.cpp index f7f181b..14dd31e 100644 --- a/test/destructor/decl_exit_static_inv_mid.cpp +++ b/test/destructor/decl_exit_static_inv_mid.cpp @@ -1,9 +1,9 @@ // Test only middle base class with exit static invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/destructor/decl_exit_static_inv_none.cpp b/test/destructor/decl_exit_static_inv_none.cpp index 12d2cc8..ab81735 100644 --- a/test/destructor/decl_exit_static_inv_none.cpp +++ b/test/destructor/decl_exit_static_inv_none.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes without exit static invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/destructor/decl_post_all.cpp b/test/destructor/decl_post_all.cpp index b2a68ce..c0f013e 100644 --- a/test/destructor/decl_post_all.cpp +++ b/test/destructor/decl_post_all.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes with postconditions. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_POST -#undef BOOST_CONTRACT_AUX_TEST_NO_B_POST -#undef BOOST_CONTRACT_AUX_TEST_NO_C_POST +#undef BOOST_CONTRACT_TEST_NO_A_POST +#undef BOOST_CONTRACT_TEST_NO_B_POST +#undef BOOST_CONTRACT_TEST_NO_C_POST #include "decl.hpp" #include diff --git a/test/destructor/decl_post_ends.cpp b/test/destructor/decl_post_ends.cpp index aeb3195..31e7660 100644 --- a/test/destructor/decl_post_ends.cpp +++ b/test/destructor/decl_post_ends.cpp @@ -1,9 +1,9 @@ // Test only derived and grandparent classes (ends) with postconditions. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_POST -#define BOOST_CONTRACT_AUX_TEST_NO_B_POST -#undef BOOST_CONTRACT_AUX_TEST_NO_C_POST +#undef BOOST_CONTRACT_TEST_NO_A_POST +#define BOOST_CONTRACT_TEST_NO_B_POST +#undef BOOST_CONTRACT_TEST_NO_C_POST #include "decl.hpp" #include diff --git a/test/destructor/decl_post_mid.cpp b/test/destructor/decl_post_mid.cpp index d3b24f5..4cc8b02 100644 --- a/test/destructor/decl_post_mid.cpp +++ b/test/destructor/decl_post_mid.cpp @@ -1,9 +1,9 @@ // Test only middle base class with postconditions. -#define BOOST_CONTRACT_AUX_TEST_NO_A_POST -#undef BOOST_CONTRACT_AUX_TEST_NO_B_POST -#define BOOST_CONTRACT_AUX_TEST_NO_C_POST +#define BOOST_CONTRACT_TEST_NO_A_POST +#undef BOOST_CONTRACT_TEST_NO_B_POST +#define BOOST_CONTRACT_TEST_NO_C_POST #include "decl.hpp" #include diff --git a/test/destructor/decl_post_none.cpp b/test/destructor/decl_post_none.cpp index 57d7cd6..bd293ad 100644 --- a/test/destructor/decl_post_none.cpp +++ b/test/destructor/decl_post_none.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes without postconditions. -#define BOOST_CONTRACT_AUX_TEST_NO_A_POST -#define BOOST_CONTRACT_AUX_TEST_NO_B_POST -#define BOOST_CONTRACT_AUX_TEST_NO_C_POST +#define BOOST_CONTRACT_TEST_NO_A_POST +#define BOOST_CONTRACT_TEST_NO_B_POST +#define BOOST_CONTRACT_TEST_NO_C_POST #include "decl.hpp" #include diff --git a/test/destructor/no_contracts.cpp b/test/destructor/no_contracts.cpp index 24149cc..63e0d4e 100644 --- a/test/destructor/no_contracts.cpp +++ b/test/destructor/no_contracts.cpp @@ -11,7 +11,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct b { #if BOOST_CONTRACT_INVARIANTS diff --git a/test/destructor/old_throw.cpp b/test/destructor/old_throw.cpp index 4418e1f..3d5a3cd 100644 --- a/test/destructor/old_throw.cpp +++ b/test/destructor/old_throw.cpp @@ -9,7 +9,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct c { static void static_invariant() { out << "c::static_inv" << std::endl; } diff --git a/test/disable/checking.hpp b/test/disable/checking.hpp index 8ffca7a..54d85bc 100644 --- a/test/disable/checking.hpp +++ b/test/disable/checking.hpp @@ -10,14 +10,14 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct a { static void static_invariant() { out << "a::static_inv" << std::endl; } void invariant() const { out << "a::inv" << std::endl; } struct x_tag; - typedef boost::contract::aux::test::counter x_type; + typedef boost::contract::test::aux::counter x_type; int f(x_type& x) { int result; @@ -128,6 +128,7 @@ int main() { ; BOOST_TEST_EQ(a::x_type::copies(), cnt); BOOST_TEST_EQ(a::x_type::evals(), cnt); + BOOST_TEST_EQ(a::x_type::ctors(), a::x_type::dtors()); out << std::endl; diff --git a/test/function/body_throw.cpp b/test/function/body_throw.cpp index 0ddd2a8..955fb40 100644 --- a/test/function/body_throw.cpp +++ b/test/function/body_throw.cpp @@ -7,7 +7,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct err {}; diff --git a/test/function/decl.hpp b/test/function/decl.hpp index 00bb7e0..4fad9b7 100644 --- a/test/function/decl.hpp +++ b/test/function/decl.hpp @@ -9,19 +9,19 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; bool f_pre = true, f_post = true; void f() { boost::contract::guard c = boost::contract::function() - #ifndef BOOST_CONTRACT_AUX_TEST_NO_F_PRE + #ifndef BOOST_CONTRACT_TEST_NO_F_PRE .precondition([&] { out << "f::pre" << std::endl; BOOST_CONTRACT_ASSERT(f_pre); }) #endif .old([] { out << "f::old" << std::endl; }) - #ifndef BOOST_CONTRACT_AUX_TEST_NO_F_POST + #ifndef BOOST_CONTRACT_TEST_NO_F_POST .postcondition([] { out << "f::post" << std::endl; BOOST_CONTRACT_ASSERT(f_post); diff --git a/test/function/decl_post_all.cpp b/test/function/decl_post_all.cpp index 69423e3..8d21ed4 100644 --- a/test/function/decl_post_all.cpp +++ b/test/function/decl_post_all.cpp @@ -1,7 +1,7 @@ // Test with postconditions. -#undef BOOST_CONTRACT_AUX_TEST_NO_F_POST +#undef BOOST_CONTRACT_TEST_NO_F_POST #include "decl.hpp" #include diff --git a/test/function/decl_post_none.cpp b/test/function/decl_post_none.cpp index 437a4e1..4dd0366 100644 --- a/test/function/decl_post_none.cpp +++ b/test/function/decl_post_none.cpp @@ -1,7 +1,7 @@ // Test without postconditions. -#define BOOST_CONTRACT_AUX_TEST_NO_F_POST +#define BOOST_CONTRACT_TEST_NO_F_POST #include "decl.hpp" #include diff --git a/test/function/decl_pre_all.cpp b/test/function/decl_pre_all.cpp index 4a1123c..d1edd7a 100644 --- a/test/function/decl_pre_all.cpp +++ b/test/function/decl_pre_all.cpp @@ -1,7 +1,7 @@ // Test with preconditions. -#undef BOOST_CONTRACT_AUX_TEST_NO_F_PRE +#undef BOOST_CONTRACT_TEST_NO_F_PRE #include "decl.hpp" #include diff --git a/test/function/decl_pre_none.cpp b/test/function/decl_pre_none.cpp index ae620e6..43567a0 100644 --- a/test/function/decl_pre_none.cpp +++ b/test/function/decl_pre_none.cpp @@ -1,7 +1,7 @@ // Test without preconditions. -#define BOOST_CONTRACT_AUX_TEST_NO_F_PRE +#define BOOST_CONTRACT_TEST_NO_F_PRE #include "decl.hpp" #include diff --git a/test/function/func.cpp b/test/function/func.cpp index 82124ac..7d9ea4a 100644 --- a/test/function/func.cpp +++ b/test/function/func.cpp @@ -11,10 +11,10 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; -struct x_tag; typedef boost::contract::aux::test::counter x_type; -struct y_tag; typedef boost::contract::aux::test::counter y_type; +struct x_tag; typedef boost::contract::test::aux::counter x_type; +struct y_tag; typedef boost::contract::test::aux::counter y_type; bool swap(x_type& x, y_type& y) { bool result; diff --git a/test/function/no_contracts.cpp b/test/function/no_contracts.cpp index 3e88683..ad889af 100644 --- a/test/function/no_contracts.cpp +++ b/test/function/no_contracts.cpp @@ -11,7 +11,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; void f(int x) { #if BOOST_CONTRACT_POSTCONDITIONS diff --git a/test/function/old_throw.cpp b/test/function/old_throw.cpp index 8a2a232..b715687 100644 --- a/test/function/old_throw.cpp +++ b/test/function/old_throw.cpp @@ -7,7 +7,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct err {}; diff --git a/test/invariant/decl.hpp b/test/invariant/decl.hpp index 95ca74a..e3f6c00 100644 --- a/test/invariant/decl.hpp +++ b/test/invariant/decl.hpp @@ -14,20 +14,20 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct b : private boost::contract::constructor_precondition { // Test also with no base_types. -#ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV - static void static_invariant() { out << "b::static_inv" << std::endl; } -#endif -#ifdef BOOST_CONTRACT_AUX_TEST_CV_INV - void invariant() const volatile { out << "b::cv_inv" << std::endl; } -#endif -#ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV - void invariant() const { out << "b::const_inv" << std::endl; } -#endif + #ifdef BOOST_CONTRACT_TEST_STATIC_INV + static void static_invariant() { out << "b::static_inv" << std::endl; } + #endif + #ifdef BOOST_CONTRACT_TEST_CV_INV + void invariant() const volatile { out << "b::cv_inv" << std::endl; } + #endif + #ifdef BOOST_CONTRACT_TEST_CONST_INV + void invariant() const { out << "b::const_inv" << std::endl; } + #endif b() : boost::contract::constructor_precondition([] { out << "b::ctor::pre" << std::endl; @@ -79,15 +79,15 @@ struct a typedef BOOST_CONTRACT_BASE_TYPES(BASES) base_types; #undef BASES -#ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV - static void static_invariant() { out << "a::static_inv" << std::endl; } -#endif -#ifdef BOOST_CONTRACT_AUX_TEST_CV_INV - void invariant() const volatile { out << "a::cv_inv" << std::endl; } -#endif -#ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV - void invariant() const { out << "a::const_inv" << std::endl; } -#endif + #ifdef BOOST_CONTRACT_TEST_STATIC_INV + static void static_invariant() { out << "a::static_inv" << std::endl; } + #endif + #ifdef BOOST_CONTRACT_TEST_CV_INV + void invariant() const volatile { out << "a::cv_inv" << std::endl; } + #endif + #ifdef BOOST_CONTRACT_TEST_CONST_INV + void invariant() const { out << "a::const_inv" << std::endl; } + #endif a() : boost::contract::constructor_precondition([] { out << "a::ctor::pre" << std::endl; @@ -212,7 +212,7 @@ int main() { #endif #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif #endif @@ -221,13 +221,13 @@ int main() { #endif << "b::ctor::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "b::const_inv" << std::endl #endif #endif @@ -236,7 +236,7 @@ int main() { #endif #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif #endif @@ -245,13 +245,13 @@ int main() { #endif << "a::ctor::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "a::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "a::const_inv" << std::endl #endif #endif @@ -265,16 +265,16 @@ int main() { av.f('a'); ok.str(""); ok // Volatile checks static and cv (but not const) inv. #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "a::cv_inv" << std::endl #endif #endif @@ -288,16 +288,16 @@ int main() { #endif << "a::f::volatile_body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "a::cv_inv" << std::endl #endif #endif @@ -313,7 +313,7 @@ int main() { av.s(); // Test static call. ok.str(""); ok #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif #endif @@ -325,7 +325,7 @@ int main() { #endif << "a::s::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif #endif @@ -371,13 +371,13 @@ int main() { } // Call a's destructor. ok.str(""); ok // Dtors always check const_inv (even if volatile). #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "a::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "a::const_inv" << std::endl #endif #endif @@ -386,7 +386,7 @@ int main() { #endif << "a::dtor::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif #endif @@ -395,13 +395,13 @@ int main() { #endif #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "b::const_inv" << std::endl #endif #endif @@ -410,7 +410,7 @@ int main() { #endif << "b::dtor::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif #endif @@ -430,7 +430,7 @@ int main() { #endif #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif #endif @@ -439,13 +439,13 @@ int main() { #endif << "b::ctor::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "b::const_inv" << std::endl #endif #endif @@ -454,7 +454,7 @@ int main() { #endif #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif #endif @@ -463,13 +463,13 @@ int main() { #endif << "a::ctor::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "a::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "a::const_inv" << std::endl #endif #endif @@ -483,22 +483,22 @@ int main() { aa.f('a'); ok.str(""); ok // Mutable checks static, cv, and const-only inv. #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "b::const_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "a::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "a::const_inv" << std::endl #endif #endif @@ -512,22 +512,22 @@ int main() { #endif << "a::f::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "b::const_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "a::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "a::const_inv" << std::endl #endif #endif @@ -543,7 +543,7 @@ int main() { aa.s(); // Test static call. ok.str(""); ok #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif #endif @@ -555,7 +555,7 @@ int main() { #endif << "a::s::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif #endif @@ -601,13 +601,13 @@ int main() { } // Call a's destructor. ok.str(""); ok #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "a::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "a::const_inv" << std::endl #endif #endif @@ -616,7 +616,7 @@ int main() { #endif << "a::dtor::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "a::static_inv" << std::endl #endif #endif @@ -625,13 +625,13 @@ int main() { #endif #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "b::const_inv" << std::endl #endif #endif @@ -640,7 +640,7 @@ int main() { #endif << "b::dtor::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif #endif @@ -660,7 +660,7 @@ int main() { #endif #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif #endif @@ -669,13 +669,13 @@ int main() { #endif << "b::ctor::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "b::const_inv" << std::endl #endif #endif @@ -689,10 +689,10 @@ int main() { bv.f('b'); ok.str(""); ok // Volatile checks static and cv (but not const) inv. #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif #endif @@ -704,10 +704,10 @@ int main() { #endif << "b::f::volatile_body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif #endif @@ -721,13 +721,13 @@ int main() { } // Call b's destructor. ok.str(""); ok // Dtors always check const_inv (even if volatile). #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "b::const_inv" << std::endl #endif #endif @@ -736,7 +736,7 @@ int main() { #endif << "b::dtor::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif #endif @@ -755,7 +755,7 @@ int main() { #endif #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif #endif @@ -764,13 +764,13 @@ int main() { #endif << "b::ctor::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "b::const_inv" << std::endl #endif #endif @@ -784,13 +784,13 @@ int main() { bb.f('b'); ok.str(""); ok // Mutable checks static, cv, and const-only inv. #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "b::const_inv" << std::endl #endif #endif @@ -802,13 +802,13 @@ int main() { #endif << "b::f::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "b::const_inv" << std::endl #endif #endif @@ -822,13 +822,13 @@ int main() { } // Call b's destructor. ok.str(""); ok #if BOOST_CONTRACT_ENTRY_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CV_INV + #ifdef BOOST_CONTRACT_TEST_CV_INV << "b::cv_inv" << std::endl #endif - #ifdef BOOST_CONTRACT_AUX_TEST_CONST_INV + #ifdef BOOST_CONTRACT_TEST_CONST_INV << "b::const_inv" << std::endl #endif #endif @@ -837,7 +837,7 @@ int main() { #endif << "b::dtor::body" << std::endl #if BOOST_CONTRACT_EXIT_INVARIANTS - #ifdef BOOST_CONTRACT_AUX_TEST_STATIC_INV + #ifdef BOOST_CONTRACT_TEST_STATIC_INV << "b::static_inv" << std::endl #endif #endif diff --git a/test/invariant/decl_const.cpp b/test/invariant/decl_const.cpp index b6d5066..7bee7af 100644 --- a/test/invariant/decl_const.cpp +++ b/test/invariant/decl_const.cpp @@ -1,8 +1,8 @@ // Test all invariants (static, cv, and const-only). -#undef BOOST_CONTRACT_AUX_TEST_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_CV_INV -#define BOOST_CONTRACT_AUX_TEST_CONST_INV +#undef BOOST_CONTRACT_TEST_STATIC_INV +#undef BOOST_CONTRACT_TEST_CV_INV +#define BOOST_CONTRACT_TEST_CONST_INV #include "decl.hpp" diff --git a/test/invariant/decl_cv.cpp b/test/invariant/decl_cv.cpp index e4362c3..129ddce 100644 --- a/test/invariant/decl_cv.cpp +++ b/test/invariant/decl_cv.cpp @@ -1,8 +1,8 @@ // Test all invariants (static, cv, and const-only). -#undef BOOST_CONTRACT_AUX_TEST_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_CV_INV -#undef BOOST_CONTRACT_AUX_TEST_CONST_INV +#undef BOOST_CONTRACT_TEST_STATIC_INV +#define BOOST_CONTRACT_TEST_CV_INV +#undef BOOST_CONTRACT_TEST_CONST_INV #include "decl.hpp" diff --git a/test/invariant/decl_cv_const.cpp b/test/invariant/decl_cv_const.cpp index 4bd61c8..debba67 100644 --- a/test/invariant/decl_cv_const.cpp +++ b/test/invariant/decl_cv_const.cpp @@ -1,8 +1,8 @@ // Test all invariants (static, cv, and const-only). -#undef BOOST_CONTRACT_AUX_TEST_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_CV_INV -#define BOOST_CONTRACT_AUX_TEST_CONST_INV +#undef BOOST_CONTRACT_TEST_STATIC_INV +#define BOOST_CONTRACT_TEST_CV_INV +#define BOOST_CONTRACT_TEST_CONST_INV #include "decl.hpp" diff --git a/test/invariant/decl_nothing.cpp b/test/invariant/decl_nothing.cpp index 0291227..36770db 100644 --- a/test/invariant/decl_nothing.cpp +++ b/test/invariant/decl_nothing.cpp @@ -1,8 +1,8 @@ // Test all invariants (static, cv, and const-only). -#undef BOOST_CONTRACT_AUX_TEST_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_CV_INV -#undef BOOST_CONTRACT_AUX_TEST_CONST_INV +#undef BOOST_CONTRACT_TEST_STATIC_INV +#undef BOOST_CONTRACT_TEST_CV_INV +#undef BOOST_CONTRACT_TEST_CONST_INV #include "decl.hpp" diff --git a/test/invariant/decl_static.cpp b/test/invariant/decl_static.cpp index efd7e00..030956a 100644 --- a/test/invariant/decl_static.cpp +++ b/test/invariant/decl_static.cpp @@ -1,8 +1,8 @@ // Test all invariants (static, cv, and const-only). -#define BOOST_CONTRACT_AUX_TEST_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_CV_INV -#undef BOOST_CONTRACT_AUX_TEST_CONST_INV +#define BOOST_CONTRACT_TEST_STATIC_INV +#undef BOOST_CONTRACT_TEST_CV_INV +#undef BOOST_CONTRACT_TEST_CONST_INV #include "decl.hpp" diff --git a/test/invariant/decl_static_const.cpp b/test/invariant/decl_static_const.cpp index 9404e41..425d07a 100644 --- a/test/invariant/decl_static_const.cpp +++ b/test/invariant/decl_static_const.cpp @@ -1,8 +1,8 @@ // Test all invariants (static, cv, and const-only). -#define BOOST_CONTRACT_AUX_TEST_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_CV_INV -#define BOOST_CONTRACT_AUX_TEST_CONST_INV +#define BOOST_CONTRACT_TEST_STATIC_INV +#undef BOOST_CONTRACT_TEST_CV_INV +#define BOOST_CONTRACT_TEST_CONST_INV #include "decl.hpp" diff --git a/test/invariant/decl_static_cv.cpp b/test/invariant/decl_static_cv.cpp index 579ca48..c0aac79 100644 --- a/test/invariant/decl_static_cv.cpp +++ b/test/invariant/decl_static_cv.cpp @@ -1,8 +1,8 @@ // Test all invariants (static, cv, and const-only). -#define BOOST_CONTRACT_AUX_TEST_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_CV_INV -#undef BOOST_CONTRACT_AUX_TEST_CONST_INV +#define BOOST_CONTRACT_TEST_STATIC_INV +#define BOOST_CONTRACT_TEST_CV_INV +#undef BOOST_CONTRACT_TEST_CONST_INV #include "decl.hpp" diff --git a/test/invariant/decl_static_cv_const.cpp b/test/invariant/decl_static_cv_const.cpp index 62d391e..006e2c4 100644 --- a/test/invariant/decl_static_cv_const.cpp +++ b/test/invariant/decl_static_cv_const.cpp @@ -1,8 +1,8 @@ // Test all invariants (static, cv, and const-only). -#define BOOST_CONTRACT_AUX_TEST_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_CV_INV -#define BOOST_CONTRACT_AUX_TEST_CONST_INV +#define BOOST_CONTRACT_TEST_STATIC_INV +#define BOOST_CONTRACT_TEST_CV_INV +#define BOOST_CONTRACT_TEST_CONST_INV #include "decl.hpp" diff --git a/test/invariant/inv_mutable_error.cpp b/test/invariant/inv_mutable_error.cpp index b9dfdd3..7c0ff02 100644 --- a/test/invariant/inv_mutable_error.cpp +++ b/test/invariant/inv_mutable_error.cpp @@ -1,3 +1,6 @@ +// Test compiler error when invariant() not declared const. + +#undef BOOST_CONTRACT_CONFIG_PERMISSIVE #include "inv_mutable.hpp" diff --git a/test/invariant/inv_mutable_permissive.cpp b/test/invariant/inv_mutable_permissive.cpp index 21e1f3e..92019d2 100644 --- a/test/invariant/inv_mutable_permissive.cpp +++ b/test/invariant/inv_mutable_permissive.cpp @@ -1,4 +1,6 @@ +// Test no error if permissive even if invariant() not declared const. + #define BOOST_CONTRACT_CONFIG_PERMISSIVE #include "inv_mutable.hpp" diff --git a/test/invariant/inv_static_error.cpp b/test/invariant/inv_static_error.cpp index 89ae865..c922b52 100644 --- a/test/invariant/inv_static_error.cpp +++ b/test/invariant/inv_static_error.cpp @@ -1,3 +1,6 @@ +// Test compiler error if invariant() declared static. + +#undef BOOST_CONTRACT_CONFIG_PERMISSIVE #include "inv_static.hpp" diff --git a/test/invariant/inv_static_permissive.cpp b/test/invariant/inv_static_permissive.cpp index 96bc326..35e108a 100644 --- a/test/invariant/inv_static_permissive.cpp +++ b/test/invariant/inv_static_permissive.cpp @@ -1,4 +1,6 @@ +// Test no compiler error if permissive even when invariant() declared static. + #define BOOST_CONTRACT_CONFIG_PERMISSIVE #include "inv_static.hpp" diff --git a/test/invariant/inv_volatile_error.cpp b/test/invariant/inv_volatile_error.cpp index b045262..7dab481 100644 --- a/test/invariant/inv_volatile_error.cpp +++ b/test/invariant/inv_volatile_error.cpp @@ -1,3 +1,6 @@ +// Test error if non-static inv declared volatile. + +#undef BOOST_CONTRACT_CONFIG_PERMISSIVE #include "inv_volatile.hpp" diff --git a/test/invariant/inv_volatile_permissive.cpp b/test/invariant/inv_volatile_permissive.cpp index c294054..b5c01ce 100644 --- a/test/invariant/inv_volatile_permissive.cpp +++ b/test/invariant/inv_volatile_permissive.cpp @@ -1,4 +1,6 @@ +// Test no error if permissive even when non-static inv declared volatile. + #define BOOST_CONTRACT_CONFIG_PERMISSIVE #include "inv_volatile.hpp" diff --git a/test/invariant/static_inv_const_error.cpp b/test/invariant/static_inv_const_error.cpp index 930d8c1..c83275d 100644 --- a/test/invariant/static_inv_const_error.cpp +++ b/test/invariant/static_inv_const_error.cpp @@ -1,3 +1,6 @@ +// Test error if static inv declared const. + +#undef BOOST_CONTRACT_CONFIG_PERMISSIVE #include "static_inv_const.hpp" diff --git a/test/invariant/static_inv_const_permissive.cpp b/test/invariant/static_inv_const_permissive.cpp index 78dc7b9..9a3cda9 100644 --- a/test/invariant/static_inv_const_permissive.cpp +++ b/test/invariant/static_inv_const_permissive.cpp @@ -1,4 +1,6 @@ +// Test no error if permissive even when static inv declared const. + #define BOOST_CONTRACT_CONFIG_PERMISSIVE #include "static_inv_const.hpp" diff --git a/test/invariant/static_inv_cv_error.cpp b/test/invariant/static_inv_cv_error.cpp index acdd7a0..491a9c6 100644 --- a/test/invariant/static_inv_cv_error.cpp +++ b/test/invariant/static_inv_cv_error.cpp @@ -1,3 +1,6 @@ +// Test error if static inv declared cv. + +#undef BOOST_CONTRACT_CONFIG_PERMISSIVE #include "static_inv_cv.hpp" diff --git a/test/invariant/static_inv_cv_permissive.cpp b/test/invariant/static_inv_cv_permissive.cpp index eefbf81..73cf3b4 100644 --- a/test/invariant/static_inv_cv_permissive.cpp +++ b/test/invariant/static_inv_cv_permissive.cpp @@ -1,4 +1,6 @@ +// Test no error if permissive even when static inv declared cv. + #define BOOST_CONTRACT_CONFIG_PERMISSIVE #include "static_inv_cv.hpp" diff --git a/test/invariant/static_inv_mutable_error.cpp b/test/invariant/static_inv_mutable_error.cpp index 496604b..c399a93 100644 --- a/test/invariant/static_inv_mutable_error.cpp +++ b/test/invariant/static_inv_mutable_error.cpp @@ -1,3 +1,6 @@ +// Test error if static inv declared mutable. + +#undef BOOST_CONTRACT_CONFIG_PERMISSIVE #include "static_inv_mutable.hpp" diff --git a/test/invariant/static_inv_mutable_permissive.cpp b/test/invariant/static_inv_mutable_permissive.cpp index afc4dc6..98c2010 100644 --- a/test/invariant/static_inv_mutable_permissive.cpp +++ b/test/invariant/static_inv_mutable_permissive.cpp @@ -1,4 +1,6 @@ +// Test error if permissive even when static inv declared mutable. + #define BOOST_CONTRACT_CONFIG_PERMISSIVE #include "static_inv_mutable.hpp" diff --git a/test/invariant/static_inv_volatile_error.cpp b/test/invariant/static_inv_volatile_error.cpp index bd8a350..6b18ca9 100644 --- a/test/invariant/static_inv_volatile_error.cpp +++ b/test/invariant/static_inv_volatile_error.cpp @@ -1,3 +1,6 @@ +// Test error if static inv declared volatile. + +#undef BOOST_CONTRACT_CONFIG_PERMISSIVE #include "static_inv_volatile.hpp" diff --git a/test/invariant/static_inv_volatile_permissive.cpp b/test/invariant/static_inv_volatile_permissive.cpp index 0af4bac..2346607 100644 --- a/test/invariant/static_inv_volatile_permissive.cpp +++ b/test/invariant/static_inv_volatile_permissive.cpp @@ -1,4 +1,6 @@ +// Test error if permissive even when static inv declared volatile. + #define BOOST_CONTRACT_CONFIG_PERMISSIVE #include "static_inv_volatile.hpp" diff --git a/test/old/auto.cpp b/test/old/auto.cpp index 5f7de53..43ef697 100644 --- a/test/old/auto.cpp +++ b/test/old/auto.cpp @@ -8,20 +8,21 @@ #include int main() { -#ifdef BOOST_NO_CXX11_AUTO_DECLARATIONS - std::cout << "No C++11 auto declarations (nothing to test)" << std::endl; -#else - int x = 0; - auto old_x = BOOST_CONTRACT_OLDOF(x); - BOOST_STATIC_ASSERT(boost::is_same >::value); + #ifdef BOOST_NO_CXX11_AUTO_DECLARATIONS + std::cout << "No C++11 auto declarations (nothing to test)" << + std::endl; + #else + int x = 0; + auto old_x = BOOST_CONTRACT_OLDOF(x); + BOOST_STATIC_ASSERT(boost::is_same >::value); - boost::contract::virtual_* v = 0; - char y = 'a'; - auto old_y = BOOST_CONTRACT_OLDOF(v, y); - BOOST_STATIC_ASSERT(boost::is_same >::value); -#endif + boost::contract::virtual_* v = 0; + char y = 'a'; + auto old_y = BOOST_CONTRACT_OLDOF(v, y); + BOOST_STATIC_ASSERT(boost::is_same >::value); + #endif return 0; } diff --git a/test/old/no_macros.cpp b/test/old/no_macros.cpp index 8b7d6cb..96cd71c 100644 --- a/test/old/no_macros.cpp +++ b/test/old/no_macros.cpp @@ -13,10 +13,10 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; -struct i_tag; typedef boost::contract::aux::test::counter i_type; -struct j_tag; typedef boost::contract::aux::test::counter j_type; +struct i_tag; typedef boost::contract::test::aux::counter i_type; +struct j_tag; typedef boost::contract::test::aux::counter j_type; struct b { virtual void swap(i_type& i, j_type& j, boost::contract::virtual_* v = 0); @@ -69,8 +69,8 @@ struct a BOOST_CONTRACT_OVERRIDE(swap) }; -struct x_tag; typedef boost::contract::aux::test::counter x_type; -struct y_tag; typedef boost::contract::aux::test::counter y_type; +struct x_tag; typedef boost::contract::test::aux::counter x_type; +struct y_tag; typedef boost::contract::test::aux::counter y_type; void swap(x_type& x, y_type& y) { boost::contract::old_ptr old_x = boost::contract::make_old( @@ -136,10 +136,12 @@ int main() { BOOST_TEST_EQ(x.value, 'b'); BOOST_TEST_EQ(x.copies(), cnt); BOOST_TEST_EQ(x.evals(), cnt); + BOOST_TEST_EQ(x.ctors(), x.dtors() + 1); // 1 for local var. BOOST_TEST_EQ(y.value, 'a'); BOOST_TEST_EQ(y.copies(), cnt); BOOST_TEST_EQ(y.evals(), cnt); + BOOST_TEST_EQ(y.ctors(), y.dtors() + 1); // 1 for local var. a aa; i_type i; i.value = 1; @@ -165,10 +167,12 @@ int main() { BOOST_TEST_EQ(i.value, 2); BOOST_TEST_EQ(i.copies(), cnt); BOOST_TEST_EQ(i.evals(), cnt); + BOOST_TEST_EQ(i.ctors(), i.dtors() + 1); // 1 for local var. BOOST_TEST_EQ(j.value, 1); BOOST_TEST_EQ(j.copies(), cnt); BOOST_TEST_EQ(j.evals(), cnt); + BOOST_TEST_EQ(j.ctors(), j.dtors() + 1); // 1 for local var. return boost::report_errors(); } diff --git a/test/public_function/access.cpp b/test/public_function/access.cpp index 39b56c9..985fe77 100644 --- a/test/public_function/access.cpp +++ b/test/public_function/access.cpp @@ -10,7 +10,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; class b { friend class boost::contract::access; diff --git a/test/public_function/bases.cpp b/test/public_function/bases.cpp index aebe31c..f7d23b4 100644 --- a/test/public_function/bases.cpp +++ b/test/public_function/bases.cpp @@ -67,30 +67,35 @@ int main() { BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 4, 0)); BOOST_TEST_EQ(s.evals(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 4, 0)); + BOOST_TEST_EQ(s.ctors(), s.dtors()); BOOST_TEST_EQ(aa.x.value, "aA"); BOOST_TEST_EQ(aa.x.copies(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); BOOST_TEST_EQ(aa.x.evals(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); + BOOST_TEST_EQ(aa.x.ctors(), aa.x.dtors()); BOOST_TEST_EQ(aa.y.value, "cA"); BOOST_TEST_EQ(aa.y.copies(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); BOOST_TEST_EQ(aa.y.evals(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); + BOOST_TEST_EQ(aa.y.ctors(), aa.y.dtors()); BOOST_TEST_EQ(aa.t<'d'>::z.value, "dA"); BOOST_TEST_EQ(aa.t<'d'>::z.copies(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); BOOST_TEST_EQ(aa.t<'d'>::z.evals(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); + BOOST_TEST_EQ(aa.t<'d'>::z.ctors(), aa.t<'d'>::z.dtors()); BOOST_TEST_EQ(aa.t<'e'>::z.value, "eA"); BOOST_TEST_EQ(aa.t<'e'>::z.copies(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); BOOST_TEST_EQ(aa.t<'e'>::z.evals(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); + BOOST_TEST_EQ(aa.t<'e'>::z.ctors(), aa.t<'e'>::z.dtors()); return boost::report_errors(); } diff --git a/test/public_function/bases.hpp b/test/public_function/bases.hpp index 8d6e04c..851ddb9 100644 --- a/test/public_function/bases.hpp +++ b/test/public_function/bases.hpp @@ -1,6 +1,6 @@ -#ifndef BASES_HPP_ -#define BASES_HPP_ +#ifndef BOOST_CONTRACT_TEST_PUBLIC_FUNCTION_BASES_HPP_ +#define BOOST_CONTRACT_TEST_PUBLIC_FUNCTION_BASES_HPP_ // Test public member function subcontracting (also with old and return values). @@ -14,10 +14,10 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct s_tag; -typedef boost::contract::aux::test::counter s_type; +typedef boost::contract::test::aux::counter s_type; struct result_type { std::string value; @@ -40,7 +40,7 @@ struct t { } struct z_tag; - typedef boost::contract::aux::test::counter z_type; + typedef boost::contract::test::aux::counter z_type; z_type z; t() { z.value.push_back(Id); } @@ -93,7 +93,7 @@ struct c } struct y_tag; - typedef boost::contract::aux::test::counter y_type; + typedef boost::contract::test::aux::counter y_type; y_type y; c() { y.value = "c"; } @@ -175,7 +175,7 @@ struct a } struct x_tag; - typedef boost::contract::aux::test::counter x_type; + typedef boost::contract::test::aux::counter x_type; x_type x; a() { x.value = "a"; } diff --git a/test/public_function/bases_branch.cpp b/test/public_function/bases_branch.cpp index 2976343..6723b34 100644 --- a/test/public_function/bases_branch.cpp +++ b/test/public_function/bases_branch.cpp @@ -58,24 +58,28 @@ int main() { BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 3, 0)); BOOST_TEST_EQ(s.evals(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 3, 0)); + BOOST_TEST_EQ(s.ctors(), s.dtors()); BOOST_TEST_EQ(cc.y.value, "cC"); BOOST_TEST_EQ(cc.y.copies(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); BOOST_TEST_EQ(cc.y.evals(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); + BOOST_TEST_EQ(cc.y.ctors(), cc.y.dtors()); BOOST_TEST_EQ(cc.t<'d'>::z.value, "dC"); BOOST_TEST_EQ(cc.t<'d'>::z.copies(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); BOOST_TEST_EQ(cc.t<'d'>::z.evals(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); + BOOST_TEST_EQ(cc.t<'d'>.ctors(), cc.t<'d'>.dtors()); BOOST_TEST_EQ(cc.t<'e'>::z.value, "eC"); BOOST_TEST_EQ(cc.t<'e'>::z.copies(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); BOOST_TEST_EQ(cc.t<'e'>::z.evals(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); + BOOST_TEST_EQ(cc.t<'e'>.ctors(), cc.t<'e'>.dtors()); return boost::report_errors(); } diff --git a/test/public_function/bases_protected.cpp b/test/public_function/bases_protected.cpp index 7fa3743..240ea43 100644 --- a/test/public_function/bases_protected.cpp +++ b/test/public_function/bases_protected.cpp @@ -9,7 +9,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; // NOTE: This is the correct way of programming contracts for base protected // and public overriding function. diff --git a/test/public_function/bases_sparse.cpp b/test/public_function/bases_sparse.cpp index 846877d..a8ee8ca 100644 --- a/test/public_function/bases_sparse.cpp +++ b/test/public_function/bases_sparse.cpp @@ -10,7 +10,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct j { static void static_invariant() { out << "j::static_inv" << std::endl; } diff --git a/test/public_function/bases_virtual.cpp b/test/public_function/bases_virtual.cpp index 58f482c..d60ebd4 100644 --- a/test/public_function/bases_virtual.cpp +++ b/test/public_function/bases_virtual.cpp @@ -68,6 +68,7 @@ int main() { BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 4, 0)); BOOST_TEST_EQ(s.evals(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 4, 0)); + BOOST_TEST_EQ(s.ctors(), s.dtors()); // Cannot access x via ca, but only via aa. BOOST_TEST_EQ(aa.x.value, "aA"); @@ -75,24 +76,28 @@ int main() { BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); BOOST_TEST_EQ(aa.x.evals(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); + BOOST_TEST_EQ(aa.x.ctors(), aa.x.dtors()); BOOST_TEST_EQ(ca.y.value, "cA"); BOOST_TEST_EQ(ca.y.copies(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); BOOST_TEST_EQ(ca.y.evals(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); + BOOST_TEST_EQ(ca.y.ctors(), ca.y.dtors()); BOOST_TEST_EQ(ca.t<'d'>::z.value, "dA"); BOOST_TEST_EQ(ca.t<'d'>::z.copies(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); BOOST_TEST_EQ(ca.t<'d'>::z.evals(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); + BOOST_TEST_EQ(ca.t<'d'>.ctors(), ca.t<'d'>.dtors()); BOOST_TEST_EQ(ca.t<'e'>::z.value, "eA"); BOOST_TEST_EQ(ca.t<'e'>::z.copies(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); BOOST_TEST_EQ(ca.t<'e'>::z.evals(), BOOST_PP_IIF(BOOST_CONTRACT_POSTCONDITIONS, 1, 0)); + BOOST_TEST_EQ(ca.t<'e'>.ctors(), ca.t<'e'>.dtors()); return boost::report_errors(); } diff --git a/test/public_function/body_throw.cpp b/test/public_function/body_throw.cpp index 5229fba..4856f97 100644 --- a/test/public_function/body_throw.cpp +++ b/test/public_function/body_throw.cpp @@ -10,7 +10,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct c { static void static_invariant() { out << "c::static_inv" << std::endl; } diff --git a/test/public_function/decl.hpp b/test/public_function/decl.hpp index 79c9c54..016d9bc 100644 --- a/test/public_function/decl.hpp +++ b/test/public_function/decl.hpp @@ -11,14 +11,14 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; bool c_pre = true, c_post = true; bool c_entering_static_inv = true, c_entry_static_inv = true, c_exit_static_inv = true; bool c_entering_inv = true, c_entry_inv = true, c_exit_inv = true; struct c { - #ifndef BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV + #ifndef BOOST_CONTRACT_TEST_NO_C_STATIC_INV static void static_invariant() { out << "c::static_inv" << std::endl; if(c_entering_static_inv) BOOST_CONTRACT_ASSERT(c_entry_static_inv); @@ -26,7 +26,7 @@ struct c { c_entering_static_inv = false; } #endif - #ifndef BOOST_CONTRACT_AUX_TEST_NO_C_INV + #ifndef BOOST_CONTRACT_TEST_NO_C_INV void invariant() const { out << "c::inv" << std::endl; if(c_entering_inv) BOOST_CONTRACT_ASSERT(c_entry_inv); @@ -37,14 +37,14 @@ struct c { virtual void f(boost::contract::virtual_* v = 0) { boost::contract::guard c = boost::contract::public_function(v, this) - #ifndef BOOST_CONTRACT_AUX_TEST_NO_C_PRE + #ifndef BOOST_CONTRACT_TEST_NO_C_PRE .precondition([&] { out << "c::f::pre" << std::endl; BOOST_CONTRACT_ASSERT(c_pre); }) #endif .old([] { out << "c::f::old" << std::endl; }) - #ifndef BOOST_CONTRACT_AUX_TEST_NO_C_POST + #ifndef BOOST_CONTRACT_TEST_NO_C_POST .postcondition([] { out << "c::f::post" << std::endl; BOOST_CONTRACT_ASSERT(c_post); @@ -66,7 +66,7 @@ struct b typedef BOOST_CONTRACT_BASE_TYPES(BASES) base_types; #undef BASES - #ifndef BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV + #ifndef BOOST_CONTRACT_TEST_NO_B_STATIC_INV static void static_invariant() { out << "b::static_inv" << std::endl; if(b_entering_static_inv) BOOST_CONTRACT_ASSERT(b_entry_static_inv); @@ -74,7 +74,7 @@ struct b b_entering_static_inv = false; } #endif - #ifndef BOOST_CONTRACT_AUX_TEST_NO_B_INV + #ifndef BOOST_CONTRACT_TEST_NO_B_INV void invariant() const { out << "b::inv" << std::endl; if(b_entering_inv) BOOST_CONTRACT_ASSERT(b_entry_inv); @@ -85,14 +85,14 @@ struct b virtual void f(boost::contract::virtual_* v = 0) { boost::contract::guard c = boost::contract::public_function(v, this) - #ifndef BOOST_CONTRACT_AUX_TEST_NO_B_PRE + #ifndef BOOST_CONTRACT_TEST_NO_B_PRE .precondition([&] { out << "b::f::pre" << std::endl; BOOST_CONTRACT_ASSERT(b_pre); }) #endif .old([] { out << "b::f::old" << std::endl; }) - #ifndef BOOST_CONTRACT_AUX_TEST_NO_B_POST + #ifndef BOOST_CONTRACT_TEST_NO_B_POST .postcondition([] { out << "b::f::post" << std::endl; BOOST_CONTRACT_ASSERT(b_post); @@ -114,7 +114,7 @@ struct a typedef BOOST_CONTRACT_BASE_TYPES(BASES) base_types; #undef BASES - #ifndef BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV + #ifndef BOOST_CONTRACT_TEST_NO_A_STATIC_INV static void static_invariant() { out << "a::static_inv" << std::endl; if(a_entering_static_inv) BOOST_CONTRACT_ASSERT(a_entry_static_inv); @@ -122,7 +122,7 @@ struct a a_entering_static_inv = false; } #endif - #ifndef BOOST_CONTRACT_AUX_TEST_NO_A_INV + #ifndef BOOST_CONTRACT_TEST_NO_A_INV void invariant() const { out << "a::inv" << std::endl; if(a_entering_inv) BOOST_CONTRACT_ASSERT(a_entry_inv); @@ -134,14 +134,14 @@ struct a virtual void f(boost::contract::virtual_* v = 0) /* override */ { boost::contract::guard c = boost::contract::public_function( v, &a::f, this) - #ifndef BOOST_CONTRACT_AUX_TEST_NO_A_PRE + #ifndef BOOST_CONTRACT_TEST_NO_A_PRE .precondition([&] { out << "a::f::pre" << std::endl; BOOST_CONTRACT_ASSERT(a_pre); }) #endif .old([] { out << "a::f::old" << std::endl; }) - #ifndef BOOST_CONTRACT_AUX_TEST_NO_A_POST + #ifndef BOOST_CONTRACT_TEST_NO_A_POST .postcondition([] { out << "a::f::post" << std::endl; BOOST_CONTRACT_ASSERT(a_post); diff --git a/test/public_function/decl_entry_inv_all.cpp b/test/public_function/decl_entry_inv_all.cpp index fca4114..23481d0 100644 --- a/test/public_function/decl_entry_inv_all.cpp +++ b/test/public_function/decl_entry_inv_all.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes with entry invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_INV +#undef BOOST_CONTRACT_TEST_NO_A_INV +#undef BOOST_CONTRACT_TEST_NO_B_INV +#undef BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_entry_inv_ends.cpp b/test/public_function/decl_entry_inv_ends.cpp index 2a1f606..6603f1c 100644 --- a/test/public_function/decl_entry_inv_ends.cpp +++ b/test/public_function/decl_entry_inv_ends.cpp @@ -1,9 +1,9 @@ // Test only derived and grandparent classes (ends) with entry invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_INV +#undef BOOST_CONTRACT_TEST_NO_A_INV +#define BOOST_CONTRACT_TEST_NO_B_INV +#undef BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_entry_inv_mid.cpp b/test/public_function/decl_entry_inv_mid.cpp index 10095ac..cd9fd1a 100644 --- a/test/public_function/decl_entry_inv_mid.cpp +++ b/test/public_function/decl_entry_inv_mid.cpp @@ -1,9 +1,9 @@ // Test only middle base class with entry invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_INV +#define BOOST_CONTRACT_TEST_NO_A_INV +#undef BOOST_CONTRACT_TEST_NO_B_INV +#define BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_entry_inv_none.cpp b/test/public_function/decl_entry_inv_none.cpp index 29beae8..daf1c97 100644 --- a/test/public_function/decl_entry_inv_none.cpp +++ b/test/public_function/decl_entry_inv_none.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes without entry invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_INV +#define BOOST_CONTRACT_TEST_NO_A_INV +#define BOOST_CONTRACT_TEST_NO_B_INV +#define BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_entry_static_inv_all.cpp b/test/public_function/decl_entry_static_inv_all.cpp index 38cfea3..cceb60b 100644 --- a/test/public_function/decl_entry_static_inv_all.cpp +++ b/test/public_function/decl_entry_static_inv_all.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes with entry static invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_entry_static_inv_ends.cpp b/test/public_function/decl_entry_static_inv_ends.cpp index 4da7c6a..7db4292 100644 --- a/test/public_function/decl_entry_static_inv_ends.cpp +++ b/test/public_function/decl_entry_static_inv_ends.cpp @@ -1,9 +1,9 @@ // Test only derived and grandparent classes (ends) with entry static inv. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_entry_static_inv_mid.cpp b/test/public_function/decl_entry_static_inv_mid.cpp index 562bd2b..dcaaf07 100644 --- a/test/public_function/decl_entry_static_inv_mid.cpp +++ b/test/public_function/decl_entry_static_inv_mid.cpp @@ -1,9 +1,9 @@ // Test only middle base class with entry static invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_entry_static_inv_none.cpp b/test/public_function/decl_entry_static_inv_none.cpp index 25127cd..2e2ec0b 100644 --- a/test/public_function/decl_entry_static_inv_none.cpp +++ b/test/public_function/decl_entry_static_inv_none.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes without entry static invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_exit_inv_all.cpp b/test/public_function/decl_exit_inv_all.cpp index b42badb..4bcf2e0 100644 --- a/test/public_function/decl_exit_inv_all.cpp +++ b/test/public_function/decl_exit_inv_all.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes with exit invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_INV +#undef BOOST_CONTRACT_TEST_NO_A_INV +#undef BOOST_CONTRACT_TEST_NO_B_INV +#undef BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_exit_inv_ends.cpp b/test/public_function/decl_exit_inv_ends.cpp index 8f7d543..d3c0190 100644 --- a/test/public_function/decl_exit_inv_ends.cpp +++ b/test/public_function/decl_exit_inv_ends.cpp @@ -1,9 +1,9 @@ // Test only derived and grandparent classes (ends) with exit invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_INV +#undef BOOST_CONTRACT_TEST_NO_A_INV +#define BOOST_CONTRACT_TEST_NO_B_INV +#undef BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_exit_inv_mid.cpp b/test/public_function/decl_exit_inv_mid.cpp index c41dd5c..91d8ef3 100644 --- a/test/public_function/decl_exit_inv_mid.cpp +++ b/test/public_function/decl_exit_inv_mid.cpp @@ -1,9 +1,9 @@ // Test only middle base class with exit invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_INV +#define BOOST_CONTRACT_TEST_NO_A_INV +#undef BOOST_CONTRACT_TEST_NO_B_INV +#define BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_exit_inv_none.cpp b/test/public_function/decl_exit_inv_none.cpp index b3969f1..4e93d95 100644 --- a/test/public_function/decl_exit_inv_none.cpp +++ b/test/public_function/decl_exit_inv_none.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes without exit invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_INV +#define BOOST_CONTRACT_TEST_NO_A_INV +#define BOOST_CONTRACT_TEST_NO_B_INV +#define BOOST_CONTRACT_TEST_NO_C_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_exit_static_inv_all.cpp b/test/public_function/decl_exit_static_inv_all.cpp index 7cd9334..8870bdb 100644 --- a/test/public_function/decl_exit_static_inv_all.cpp +++ b/test/public_function/decl_exit_static_inv_all.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes with exit static invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_exit_static_inv_ends.cpp b/test/public_function/decl_exit_static_inv_ends.cpp index a936020..00be616 100644 --- a/test/public_function/decl_exit_static_inv_ends.cpp +++ b/test/public_function/decl_exit_static_inv_ends.cpp @@ -1,9 +1,9 @@ // Test only derived and grandparent classes (ends) with exit static invariants. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_exit_static_inv_mid.cpp b/test/public_function/decl_exit_static_inv_mid.cpp index cec8d21..551fc8a 100644 --- a/test/public_function/decl_exit_static_inv_mid.cpp +++ b/test/public_function/decl_exit_static_inv_mid.cpp @@ -1,9 +1,9 @@ // Test only middle base class with exit static invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#undef BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#undef BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_exit_static_inv_none.cpp b/test/public_function/decl_exit_static_inv_none.cpp index f0a23b5..c4fc42c 100644 --- a/test/public_function/decl_exit_static_inv_none.cpp +++ b/test/public_function/decl_exit_static_inv_none.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes without exit static invariants. -#define BOOST_CONTRACT_AUX_TEST_NO_A_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_B_STATIC_INV -#define BOOST_CONTRACT_AUX_TEST_NO_C_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_A_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_B_STATIC_INV +#define BOOST_CONTRACT_TEST_NO_C_STATIC_INV #include "decl.hpp" #include diff --git a/test/public_function/decl_post_all.cpp b/test/public_function/decl_post_all.cpp index 34b8274..2a5897a 100644 --- a/test/public_function/decl_post_all.cpp +++ b/test/public_function/decl_post_all.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes with postconditions. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_POST -#undef BOOST_CONTRACT_AUX_TEST_NO_B_POST -#undef BOOST_CONTRACT_AUX_TEST_NO_C_POST +#undef BOOST_CONTRACT_TEST_NO_A_POST +#undef BOOST_CONTRACT_TEST_NO_B_POST +#undef BOOST_CONTRACT_TEST_NO_C_POST #include "decl.hpp" #include diff --git a/test/public_function/decl_post_ends.cpp b/test/public_function/decl_post_ends.cpp index fa33336..1c652b5 100644 --- a/test/public_function/decl_post_ends.cpp +++ b/test/public_function/decl_post_ends.cpp @@ -1,9 +1,9 @@ // Test only derived and grandparent classes (ends) with postconditions. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_POST -#define BOOST_CONTRACT_AUX_TEST_NO_B_POST -#undef BOOST_CONTRACT_AUX_TEST_NO_C_POST +#undef BOOST_CONTRACT_TEST_NO_A_POST +#define BOOST_CONTRACT_TEST_NO_B_POST +#undef BOOST_CONTRACT_TEST_NO_C_POST #include "decl.hpp" #include diff --git a/test/public_function/decl_post_mid.cpp b/test/public_function/decl_post_mid.cpp index f2bd273..886be9b 100644 --- a/test/public_function/decl_post_mid.cpp +++ b/test/public_function/decl_post_mid.cpp @@ -1,9 +1,9 @@ // Test only middle base class with postconditions. -#define BOOST_CONTRACT_AUX_TEST_NO_A_POST -#undef BOOST_CONTRACT_AUX_TEST_NO_B_POST -#define BOOST_CONTRACT_AUX_TEST_NO_C_POST +#define BOOST_CONTRACT_TEST_NO_A_POST +#undef BOOST_CONTRACT_TEST_NO_B_POST +#define BOOST_CONTRACT_TEST_NO_C_POST #include "decl.hpp" #include diff --git a/test/public_function/decl_post_none.cpp b/test/public_function/decl_post_none.cpp index b91e894..f59d503 100644 --- a/test/public_function/decl_post_none.cpp +++ b/test/public_function/decl_post_none.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes without postconditions. -#define BOOST_CONTRACT_AUX_TEST_NO_A_POST -#define BOOST_CONTRACT_AUX_TEST_NO_B_POST -#define BOOST_CONTRACT_AUX_TEST_NO_C_POST +#define BOOST_CONTRACT_TEST_NO_A_POST +#define BOOST_CONTRACT_TEST_NO_B_POST +#define BOOST_CONTRACT_TEST_NO_C_POST #include "decl.hpp" #include diff --git a/test/public_function/decl_pre_all.cpp b/test/public_function/decl_pre_all.cpp index 056fce8..911e5ca 100644 --- a/test/public_function/decl_pre_all.cpp +++ b/test/public_function/decl_pre_all.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes with preconditions. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_PRE -#undef BOOST_CONTRACT_AUX_TEST_NO_B_PRE -#undef BOOST_CONTRACT_AUX_TEST_NO_C_PRE +#undef BOOST_CONTRACT_TEST_NO_A_PRE +#undef BOOST_CONTRACT_TEST_NO_B_PRE +#undef BOOST_CONTRACT_TEST_NO_C_PRE #include "decl.hpp" #include diff --git a/test/public_function/decl_pre_ends.cpp b/test/public_function/decl_pre_ends.cpp index 3ad8c4a..9cb8c23 100644 --- a/test/public_function/decl_pre_ends.cpp +++ b/test/public_function/decl_pre_ends.cpp @@ -1,9 +1,9 @@ // Test only derived and grandparent classes (ends) with preconditions. -#undef BOOST_CONTRACT_AUX_TEST_NO_A_PRE -#define BOOST_CONTRACT_AUX_TEST_NO_B_PRE -#undef BOOST_CONTRACT_AUX_TEST_NO_C_PRE +#undef BOOST_CONTRACT_TEST_NO_A_PRE +#define BOOST_CONTRACT_TEST_NO_B_PRE +#undef BOOST_CONTRACT_TEST_NO_C_PRE #include "decl.hpp" #include diff --git a/test/public_function/decl_pre_mid.cpp b/test/public_function/decl_pre_mid.cpp index 0826f5b..8406a81 100644 --- a/test/public_function/decl_pre_mid.cpp +++ b/test/public_function/decl_pre_mid.cpp @@ -1,9 +1,9 @@ // Test only middle base class with preconditions. -#define BOOST_CONTRACT_AUX_TEST_NO_A_PRE -#undef BOOST_CONTRACT_AUX_TEST_NO_B_PRE -#define BOOST_CONTRACT_AUX_TEST_NO_C_PRE +#define BOOST_CONTRACT_TEST_NO_A_PRE +#undef BOOST_CONTRACT_TEST_NO_B_PRE +#define BOOST_CONTRACT_TEST_NO_C_PRE #include "decl.hpp" #include diff --git a/test/public_function/decl_pre_none.cpp b/test/public_function/decl_pre_none.cpp index 60e6deb..dd09b44 100644 --- a/test/public_function/decl_pre_none.cpp +++ b/test/public_function/decl_pre_none.cpp @@ -1,9 +1,9 @@ // Test all derived and base classes without preconditions. -#define BOOST_CONTRACT_AUX_TEST_NO_A_PRE -#define BOOST_CONTRACT_AUX_TEST_NO_B_PRE -#define BOOST_CONTRACT_AUX_TEST_NO_C_PRE +#define BOOST_CONTRACT_TEST_NO_A_PRE +#define BOOST_CONTRACT_TEST_NO_B_PRE +#define BOOST_CONTRACT_TEST_NO_C_PRE #include "decl.hpp" #include diff --git a/test/public_function/max_args.cpp b/test/public_function/max_args.cpp index 5da369c..ae049cf 100644 --- a/test/public_function/max_args.cpp +++ b/test/public_function/max_args.cpp @@ -1,6 +1,5 @@ -// Test with default max argument number (MAX_ARGS #undef). +// Test with default max argument number (leave MAX_ARGS #undef). -#undef BOOST_CONTRACT_CONFIG_MAX_ARGS #include "max_args.hpp" diff --git a/test/public_function/max_args.hpp b/test/public_function/max_args.hpp index b83a3c2..15f3aef 100644 --- a/test/public_function/max_args.hpp +++ b/test/public_function/max_args.hpp @@ -14,8 +14,7 @@ #include #include -// TODO: I should rename this test::aux (and not aux::text) and same for macros and counter class... -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; #define BOOST_CONTRACT_TEST_MAX_ARGS_PARAM_COMMA_(z, n, unused) \ int BOOST_PP_CAT(a, n) , diff --git a/test/public_function/max_args_no_tva.cpp b/test/public_function/max_args_no_tva.cpp index 8340b2f..2f0b219 100644 --- a/test/public_function/max_args_no_tva.cpp +++ b/test/public_function/max_args_no_tva.cpp @@ -1,7 +1,6 @@ -// Test with default max argument number (MAX_ARGS #undef) and no variadic tpl. +// Test with default max arg number (leave MAX_ARGS #undef) and no variadic tpl. #define BOOST_NO_CXX11_VARIADIC_TEMPLATES -#undef BOOST_CONTRACT_CONFIG_MAX_ARGS #include "max_args.hpp" diff --git a/test/public_function/max_bases.cpp b/test/public_function/max_bases.cpp new file mode 100644 index 0000000..7941847 --- /dev/null +++ b/test/public_function/max_bases.cpp @@ -0,0 +1,54 @@ + +// Test with max possible number of bases. + +#include +#include +#include +#include +#include +#include +#include + +// Limited by max size of current impl of Boost.MPL vector. +#ifndef BOOST_CONTRACT_TEST_CONFIG_MAX_BASES + #define BOOST_CONTRACT_TEST_CONFIG_MAX_BASES 20 +#endif + +#define BOOST_CONTRACT_TEST_base_decl(z, n, unused) \ + struct BOOST_PP_CAT(b, n) { \ + virtual void f(boost::contract::virtual_* v = 0) { \ + boost::contract::guard c = boost::contract::public_function( \ + v, this); \ + } \ + }; + +BOOST_PP_REPEAT(BOOST_CONTRACT_TEST_CONFIG_MAX_BASES, + BOOST_CONTRACT_TEST_base_decl, ~) + +#define BOOST_CONTRACT_TEST_public_base(z, n, unused) public BOOST_PP_CAT(b, n) + +struct a + #define BASES \ + BOOST_PP_ENUM(BOOST_CONTRACT_TEST_CONFIG_MAX_BASES, \ + BOOST_CONTRACT_TEST_public_base, ~) + : BASES +{ + typedef BOOST_CONTRACT_BASE_TYPES(BASES) base_types; + #undef BASES + + void f(boost::contract::virtual_* v = 0) /* override */ { + boost::contract::guard c = boost::contract::public_function( + v, &a::f, this); + } + BOOST_CONTRACT_OVERRIDE(f) +}; + +int main() { + a aa; + aa.f(); + return 0; +} + +#undef BOOST_CONTRACT_TEST_base_decl +#undef BOOST_CONTRACT_TEST_public_base + diff --git a/test/public_function/no_contracts.cpp b/test/public_function/no_contracts.cpp index 836a8e1..5d21dc6 100644 --- a/test/public_function/no_contracts.cpp +++ b/test/public_function/no_contracts.cpp @@ -13,7 +13,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct b { #if BOOST_CONTRACT_INVARIANTS diff --git a/test/public_function/old_throw.cpp b/test/public_function/old_throw.cpp index fbe8aae..832227e 100644 --- a/test/public_function/old_throw.cpp +++ b/test/public_function/old_throw.cpp @@ -10,7 +10,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct c { static void static_invariant() { out << "c::static_inv" << std::endl; } diff --git a/test/public_function/overload.hpp b/test/public_function/overload.hpp index febc0ad..74d18b0 100644 --- a/test/public_function/overload.hpp +++ b/test/public_function/overload.hpp @@ -10,7 +10,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct b { static void static_invariant() { out << "b::static_inv" << std::endl; } diff --git a/test/public_function/override_error.cpp b/test/public_function/override_error.cpp index b76bbe3..5777767 100644 --- a/test/public_function/override_error.cpp +++ b/test/public_function/override_error.cpp @@ -1,3 +1,5 @@ +// Test error if override func does not actually override. + #include "override.hpp" diff --git a/test/public_function/override_permissive.cpp b/test/public_function/override_permissive.cpp index c3005da..81b33e5 100644 --- a/test/public_function/override_permissive.cpp +++ b/test/public_function/override_permissive.cpp @@ -1,4 +1,6 @@ +// Test no error if permissive even when override f does not actually override. + #define BOOST_CONTRACT_CONFIG_PERMISSIVE #include "override.hpp" diff --git a/test/public_function/static.cpp b/test/public_function/static.cpp index e5b547c..4569c90 100644 --- a/test/public_function/static.cpp +++ b/test/public_function/static.cpp @@ -8,7 +8,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct b { static void static_invariant() { out << "b::static_inv" << std::endl; } diff --git a/test/public_function/static_body_throw.cpp b/test/public_function/static_body_throw.cpp index 6729855..b6bcc85 100644 --- a/test/public_function/static_body_throw.cpp +++ b/test/public_function/static_body_throw.cpp @@ -7,7 +7,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct a { static void static_invariant() { out << "a::static_inv" << std::endl; } diff --git a/test/public_function/static_no_contracts.cpp b/test/public_function/static_no_contracts.cpp index 9bc1529..7e831c6 100644 --- a/test/public_function/static_no_contracts.cpp +++ b/test/public_function/static_no_contracts.cpp @@ -11,7 +11,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct a { #if BOOST_CONTRACT_INVARIANTS diff --git a/test/public_function/static_old_throw.cpp b/test/public_function/static_old_throw.cpp index 97a16f8..b9ea618 100644 --- a/test/public_function/static_old_throw.cpp +++ b/test/public_function/static_old_throw.cpp @@ -7,7 +7,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct a { static void static_invariant() { out << "a::static_inv" << std::endl; } diff --git a/test/result/mixed_optional.cpp b/test/result/mixed_optional.cpp index cff4d5b..f332215 100644 --- a/test/result/mixed_optional.cpp +++ b/test/result/mixed_optional.cpp @@ -1,3 +1,5 @@ +// Test base and derived classes mixing boost::optional and non- result types. + #include "mixed_optional.hpp" diff --git a/test/result/mixed_optional.hpp b/test/result/mixed_optional.hpp index b6544fc..236a1f9 100644 --- a/test/result/mixed_optional.hpp +++ b/test/result/mixed_optional.hpp @@ -16,18 +16,20 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; struct ch_tag; -typedef boost::contract::aux::test::counter ch_type; +typedef boost::contract::test::aux::counter ch_type; -#ifdef BOOST_CONTRACT_AUX_TEST_ref // Test with result types by reference. - #define BOOST_CONTRACT_AUX_TEST_ch_type ch_type& - #define BOOST_CONTRACT_AUX_TEST_ch_init = ch_init +#ifdef BOOST_CONTRACT_TEST_REF // Test with result types by reference. + #define BOOST_CONTRACT_TEST_CH_TYPE ch_type& + #define BOOST_CONTRACT_TEST_CH_INIT = ch_init ch_type ch_init; + unsigned const ch_extras = 2; // 1 local and 1 global var. #else // Test with result types by value. - #define BOOST_CONTRACT_AUX_TEST_ch_type ch_type - #define BOOST_CONTRACT_AUX_TEST_ch_init /* nothing */ + #define BOOST_CONTRACT_TEST_CH_TYPE ch_type + #define BOOST_CONTRACT_TEST_CH_INIT /* nothing */ + unsigned const ch_extras = 1; // Only 1 local (no global) var. #endif bool tested_d_copies = false; @@ -35,10 +37,10 @@ struct d { static void static_invariant() { out << "d::static_inv" << std::endl; } void invariant() const { out << "d::inv" << std::endl; } - virtual BOOST_CONTRACT_AUX_TEST_ch_type f( + virtual BOOST_CONTRACT_TEST_CH_TYPE f( ch_type& ch, boost::contract::virtual_* v = 0) { unsigned const old_ch_copies = ch_type::copies(); - boost::optional result; + boost::optional result; boost::contract::guard c = boost::contract::public_function( v, result, this) .precondition([&] { @@ -70,10 +72,10 @@ struct c static void static_invariant() { out << "c::static_inv" << std::endl; } void invariant() const { out << "c::inv" << std::endl; } - virtual BOOST_CONTRACT_AUX_TEST_ch_type f( + virtual BOOST_CONTRACT_TEST_CH_TYPE f( ch_type& ch, boost::contract::virtual_* v = 0) /* override */ { unsigned const old_ch_copies = ch_type::copies(); - boost::optional result; + boost::optional result; boost::contract::guard c = boost::contract::public_function( v, result, &c::f, this, ch) .precondition([&] { @@ -106,10 +108,10 @@ struct b static void static_invariant() { out << "b::static_inv" << std::endl; } void invariant() const { out << "b::inv" << std::endl; } - virtual BOOST_CONTRACT_AUX_TEST_ch_type f( + virtual BOOST_CONTRACT_TEST_CH_TYPE f( ch_type& ch, boost::contract::virtual_* v = 0) /* override */ { unsigned const old_ch_copies = ch_type::copies(); - BOOST_CONTRACT_AUX_TEST_ch_type result BOOST_CONTRACT_AUX_TEST_ch_init; + BOOST_CONTRACT_TEST_CH_TYPE result BOOST_CONTRACT_TEST_CH_INIT; boost::contract::guard c = boost::contract::public_function( v, result, &b::f, this, ch) .precondition([&] { @@ -142,10 +144,10 @@ struct a static void static_invariant() { out << "a::static_inv" << std::endl; } void invariant() const { out << "a::inv" << std::endl; } - virtual BOOST_CONTRACT_AUX_TEST_ch_type f( + virtual BOOST_CONTRACT_TEST_CH_TYPE f( ch_type& ch, boost::contract::virtual_* v = 0) /* override */ { unsigned const old_ch_copies = ch_type::copies(); - boost::optional result; + boost::optional result; boost::contract::guard c = boost::contract::public_function( v, result, &a::f, this, ch) .precondition([&] { @@ -178,10 +180,10 @@ struct e static void static_invariant() { out << "e::static_inv" << std::endl; } void invariant() const { out << "e::inv" << std::endl; } - virtual BOOST_CONTRACT_AUX_TEST_ch_type f( + virtual BOOST_CONTRACT_TEST_CH_TYPE f( ch_type& ch, boost::contract::virtual_* v = 0) /* override */ { unsigned const old_ch_copies = ch_type::copies(); - BOOST_CONTRACT_AUX_TEST_ch_type result BOOST_CONTRACT_AUX_TEST_ch_init; + BOOST_CONTRACT_TEST_CH_TYPE result BOOST_CONTRACT_TEST_CH_INIT; boost::contract::guard c = boost::contract::public_function( v, result, &e::f, this, ch) .precondition([&] { @@ -206,7 +208,7 @@ struct e int main() { std::ostringstream ok; ch_type ch; - #ifdef BOOST_CONTRACT_AUX_TEST_ref + #ifdef BOOST_CONTRACT_TEST_REF ch_init.value = '\0'; #endif @@ -261,6 +263,7 @@ int main() { ; BOOST_TEST(out.eq(ok.str())); BOOST_TEST(tested_a_copies); + BOOST_TEST_EQ(ch_type::ctors(), ch_type::dtors() + ch_extras); // Test non-optional in overriding b::f and optional in overridden c::f. b bb; @@ -305,6 +308,7 @@ int main() { ; BOOST_TEST(out.eq(ok.str())); BOOST_TEST(tested_b_copies); + BOOST_TEST_EQ(ch_type::ctors(), ch_type::dtors() + ch_extras); // Test optional in both overriding c::f and overridden d::f. c cc; @@ -341,6 +345,7 @@ int main() { ; BOOST_TEST(out.eq(ok.str())); BOOST_TEST(tested_c_copies); + BOOST_TEST_EQ(ch_type::ctors(), ch_type::dtors() + ch_extras); // Test non-optional in both overriding c::f and overridden d::f. e ee; @@ -393,11 +398,8 @@ int main() { ; BOOST_TEST(out.eq(ok.str())); BOOST_TEST(tested_e_copies); + BOOST_TEST_EQ(ch_type::ctors(), ch_type::dtors() + ch_extras); return boost::report_errors(); } -#undef BOOST_CONTRACT_AUX_TEST_ref -#undef BOOST_CONTRACT_AUX_TEST_ch_type -#undef BOOST_CONTRACT_AUX_TEST_ch_init - diff --git a/test/result/mixed_optional_ref.cpp b/test/result/mixed_optional_ref.cpp index c60c45f..06316f7 100644 --- a/test/result/mixed_optional_ref.cpp +++ b/test/result/mixed_optional_ref.cpp @@ -1,4 +1,6 @@ -#define BOOST_CONTRACT_AUX_TEST_ref +// Test base and derived classes mixing boost::optional and non- result by ref. + +#define BOOST_CONTRACT_TEST_REF #include "mixed_optional.hpp" diff --git a/test/set/nothing.cpp b/test/set/nothing.cpp index a8c12f2..4f36ba5 100644 --- a/test/set/nothing.cpp +++ b/test/set/nothing.cpp @@ -7,7 +7,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; void f() { boost::contract::guard c = boost::contract::function(); diff --git a/test/set/old.cpp b/test/set/old.cpp index 87aced2..cb0deb4 100644 --- a/test/set/old.cpp +++ b/test/set/old.cpp @@ -7,7 +7,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; void f() { boost::contract::guard c = boost::contract::function() diff --git a/test/set/old_post.cpp b/test/set/old_post.cpp index 2936131..1529575 100644 --- a/test/set/old_post.cpp +++ b/test/set/old_post.cpp @@ -7,7 +7,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; void f() { boost::contract::guard c = boost::contract::function() diff --git a/test/set/post.cpp b/test/set/post.cpp index 0c978b3..daccd41 100644 --- a/test/set/post.cpp +++ b/test/set/post.cpp @@ -7,7 +7,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; void f() { boost::contract::guard c = boost::contract::function() diff --git a/test/set/pre.cpp b/test/set/pre.cpp index 82d22b5..1b08703 100644 --- a/test/set/pre.cpp +++ b/test/set/pre.cpp @@ -7,7 +7,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; void f() { boost::contract::guard c = boost::contract::function() diff --git a/test/set/pre_old.cpp b/test/set/pre_old.cpp index 1a0eaa3..f7cf64d 100644 --- a/test/set/pre_old.cpp +++ b/test/set/pre_old.cpp @@ -7,7 +7,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; void f() { boost::contract::guard c = boost::contract::function() diff --git a/test/set/pre_old_post.cpp b/test/set/pre_old_post.cpp index 9537ea4..4b02d8e 100644 --- a/test/set/pre_old_post.cpp +++ b/test/set/pre_old_post.cpp @@ -7,7 +7,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; void f() { boost::contract::guard c = boost::contract::function() diff --git a/test/set/pre_post.cpp b/test/set/pre_post.cpp index 877b54d..ec70407 100644 --- a/test/set/pre_post.cpp +++ b/test/set/pre_post.cpp @@ -7,7 +7,7 @@ #include #include -boost::contract::aux::test::oteststream out; +boost::contract::test::aux::oteststream out; void f() { boost::contract::guard c = boost::contract::function()