diff --git a/include/boost/contract.hpp b/include/boost/contract.hpp index 3ac691f..91d4b07 100644 --- a/include/boost/contract.hpp +++ b/include/boost/contract.hpp @@ -25,6 +25,10 @@ never be used directly by programmers. @see @RefSect{getting_started, Getting Started} */ +// TODO: Make all tests pass also with link=static and link=header (some tests fails now...). + +// TODO: Test interaction between throwing contract handlers and .except(). For example, a throwing handler is set for all contracts, a precondition throws for a function that has .except()... will .except() be called... (it should, correct?), what is .except() contract fails and it also throws an exception? + // TODO: Document that boost::contract::function() can be used to program contracts for lambda functions. And also "abused" a bit to program pre/postconditions for any arbitrary scope of code in function body. // TODO: Document that friends do not in general check invariants so their contracts are usually programmed using function(). But if a function friend of an object takes an instance of that object as a parameter and therefore is essentially part of the object's public API, then programmers can make that explicit by using public_function(obj) after function() to program the friend function contract (but note that in general friends functions can take instances of multiple different objects because the same function can be friend of different classes). Also add a test (under test/public_function/...) and an example for friend. diff --git a/include/boost/contract/core/access.hpp b/include/boost/contract/core/access.hpp index 5fdb8ce..408eda6 100644 --- a/include/boost/contract/core/access.hpp +++ b/include/boost/contract/core/access.hpp @@ -31,11 +31,11 @@ namespace boost { class virtual_; namespace detail { - BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_WITH_SUBCONTRACTING_Z(1, + BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_SUBCONTRACTING_Z(1, /* is_friend = */ 0, OO, RR, FF, CC, AArgs); template - class cond_with_inv; + class cond_inv; } } } @@ -138,11 +138,11 @@ class access : private boost::noncopyable { // increase compilation times (I experimented replacing all friends with // public and got the same compilation times). - BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_WITH_SUBCONTRACTING_Z(1, + BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_SUBCONTRACTING_Z(1, /* is_friend = */ 1, OO, RR, FF, CC, AArgs); template - friend class boost::contract::detail::cond_with_inv; + friend class boost::contract::detail::cond_inv; BOOST_CONTRACT_DETAIL_DECL_FRIEND_OVERRIDING_PUBLIC_FUNCTIONS_Z(1, OO, RR, FF, CC, AArgs, vv, rr, ff, oobj, aargs) diff --git a/include/boost/contract/core/specify.hpp b/include/boost/contract/core/specify.hpp index 51892ee..75fae55 100644 --- a/include/boost/contract/core/specify.hpp +++ b/include/boost/contract/core/specify.hpp @@ -18,7 +18,7 @@ Facilities to specify preconditions, old value assignments, and postconditions. !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_EXCEPTS) #include - #include + #include #include #include #endif @@ -62,7 +62,8 @@ Facilities to specify preconditions, old value assignments, and postconditions. BOOST_CONTRACT_SPECIFY_COND_RELEASE_); #endif -#ifndef BOOST_CONTRACT_NO_POSTCONDITIONS +#if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) #define BOOST_CONTRACT_SPECIFY_OLD_IMPL_ \ BOOST_CONTRACT_DETAIL_DEBUG(cond_); \ cond_->set_old(f); \ @@ -237,7 +238,7 @@ public: private: BOOST_CONTRACT_SPECIFY_COND_CTOR_( specify_postcondition_except, - boost::contract::detail::cond_with_post::type> ) @@ -330,7 +331,7 @@ public: private: BOOST_CONTRACT_SPECIFY_COND_CTOR_( specify_old_postcondition_except, - boost::contract::detail::cond_with_post::type> ) @@ -453,7 +454,7 @@ public: private: BOOST_CONTRACT_SPECIFY_COND_CTOR_( specify_precondition_old_postcondition_except, - boost::contract::detail::cond_with_post::type> ) diff --git a/include/boost/contract/core/virtual.hpp b/include/boost/contract/core/virtual.hpp index 22e89e5..538e377 100644 --- a/include/boost/contract/core/virtual.hpp +++ b/include/boost/contract/core/virtual.hpp @@ -26,7 +26,7 @@ Facility to declare virtual public functions with contracts. namespace boost { namespace contract { namespace detail { - BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_WITH_SUBCONTRACTING_Z(1, + BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_SUBCONTRACTING_Z(1, /* is_friend = */ 0, OO, RR, FF, CC, AArgs); } } @@ -155,7 +155,7 @@ class virtual_ : private boost::noncopyable { // Avoid copy queue, stack, etc. friend bool copy_old(virtual_*); friend class old_pointer; - BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_WITH_SUBCONTRACTING_Z(1, + BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_SUBCONTRACTING_Z(1, /* is_friend = */ 1, OO, RR, FF, CC, AArgs); /** @endcond */ }; diff --git a/include/boost/contract/detail/condition/cond_base.hpp b/include/boost/contract/detail/condition/cond_base.hpp index f2a7883..ce11a0a 100644 --- a/include/boost/contract/detail/condition/cond_base.hpp +++ b/include/boost/contract/detail/condition/cond_base.hpp @@ -63,7 +63,8 @@ public: void set_pre(F const& f) { pre_ = f; } #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) template void set_old(F const& f) { old_ = f; } #endif diff --git a/include/boost/contract/detail/condition/cond_with_inv.hpp b/include/boost/contract/detail/condition/cond_inv.hpp similarity index 96% rename from include/boost/contract/detail/condition/cond_with_inv.hpp rename to include/boost/contract/detail/condition/cond_inv.hpp index 148851e..36720c1 100644 --- a/include/boost/contract/detail/condition/cond_with_inv.hpp +++ b/include/boost/contract/detail/condition/cond_inv.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_DETAIL_COND_WITH_INV_HPP_ -#define BOOST_CONTRACT_DETAIL_COND_WITH_INV_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_COND_INV_HPP_ +#define BOOST_CONTRACT_DETAIL_COND_INV_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -9,7 +9,7 @@ #include #include -#include +#include #ifndef BOOST_CONTRACT_NO_INVARIANTS #include #include @@ -32,7 +32,7 @@ namespace boost { namespace contract { namespace detail { template -class cond_with_inv : public cond_with_post { // Non-copyable base. +class cond_inv : public cond_post { // Non-copyable base. #if !defined(BOOST_CONTRACT_NO_INVARIANTS) && \ !defined(BOOST_CONTRACT_PERMISSIVE) BOOST_STATIC_ASSERT_MSG( @@ -94,8 +94,8 @@ class cond_with_inv : public cond_with_post { // Non-copyable base. public: // obj can be 0 for static member functions. - explicit cond_with_inv(boost::contract::from from, C* obj) : - cond_with_post(from) + explicit cond_inv(boost::contract::from from, C* obj) : + cond_post(from) #if !defined(BOOST_CONTRACT_NO_INVARIANTS) || \ !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ diff --git a/include/boost/contract/detail/condition/cond_with_post.hpp b/include/boost/contract/detail/condition/cond_post.hpp similarity index 81% rename from include/boost/contract/detail/condition/cond_with_post.hpp rename to include/boost/contract/detail/condition/cond_post.hpp index ab16778..446d804 100644 --- a/include/boost/contract/detail/condition/cond_with_post.hpp +++ b/include/boost/contract/detail/condition/cond_post.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_DETAIL_COND_WITH_POST_HPP_ -#define BOOST_CONTRACT_DETAIL_COND_WITH_POST_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_COND_POST_HPP_ +#define BOOST_CONTRACT_DETAIL_COND_POST_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -21,7 +21,7 @@ /* PRIVATE */ -#define BOOST_CONTRACT_DETAIL_COND_WITH_POST_DEF_( \ +#define BOOST_CONTRACT_DETAIL_COND_POST_DEF_( \ result_type, result_param, ftor_type, ftor_var, ftor_call) \ public: \ template \ @@ -42,9 +42,9 @@ namespace boost { namespace contract { namespace detail { template -class cond_with_post : public cond_base { // Non-copyable base. +class cond_post : public cond_base { // Non-copyable base. public: - explicit cond_with_post(boost::contract::from from) : cond_base(from) {} + explicit cond_post(boost::contract::from from) : cond_base(from) {} #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS private: typedef typename boost::mpl::if_, @@ -54,7 +54,7 @@ public: VR const& >::type r_type; - BOOST_CONTRACT_DETAIL_COND_WITH_POST_DEF_( + BOOST_CONTRACT_DETAIL_COND_POST_DEF_( r_type, r, void (r_type), @@ -66,12 +66,12 @@ public: }; template<> -class cond_with_post : public cond_base { // Non-copyable base. +class cond_post : public cond_base { // Non-copyable base. public: - explicit cond_with_post(boost::contract::from from) : cond_base(from) {} + explicit cond_post(boost::contract::from from) : cond_base(from) {} #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - BOOST_CONTRACT_DETAIL_COND_WITH_POST_DEF_( + BOOST_CONTRACT_DETAIL_COND_POST_DEF_( none, unused, void (), diff --git a/include/boost/contract/detail/condition/cond_with_subcontracting.hpp b/include/boost/contract/detail/condition/cond_subcontracting.hpp similarity index 91% rename from include/boost/contract/detail/condition/cond_with_subcontracting.hpp rename to include/boost/contract/detail/condition/cond_subcontracting.hpp index 5d30075..5b736c9 100644 --- a/include/boost/contract/detail/condition/cond_with_subcontracting.hpp +++ b/include/boost/contract/detail/condition/cond_subcontracting.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_CONTRACT_DETAIL_COND_WITH_SUBCONTRACTING_HPP_ -#define BOOST_CONTRACT_DETAIL_COND_WITH_SUBCONTRACTING_HPP_ +#ifndef BOOST_CONTRACT_DETAIL_COND_SUBCONTRACTING_HPP_ +#define BOOST_CONTRACT_DETAIL_COND_SUBCONTRACTING_HPP_ // Copyright (C) 2008-2016 Lorenzo Caminiti // Distributed under the Boost Software License, Version 1.0 (see accompanying @@ -13,7 +13,7 @@ !defined(BOOST_CONTRACT_NO_EXCEPTS) #include #endif -#include +#include #include #include #if !defined(BOOST_CONTRACT_NO_INVARIANTS) || \ @@ -65,15 +65,15 @@ namespace boost { namespace contract { namespace detail { -namespace cond_with_subcontracting_ { +namespace cond_subcontracting_ { // Exception signals (must not inherit). class signal_no_error {}; class signal_not_checked {}; } // O, VR, F, and Args-i can be none types (but C cannot). -BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_WITH_SUBCONTRACTING_Z(1, - /* is_friend = */ 0, O, VR, F, C, Args) : public cond_with_inv +BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_SUBCONTRACTING_Z(1, + /* is_friend = */ 0, O, VR, F, C, Args) : public cond_inv { // Non-copyable base. #if !defined(BOOST_CONTRACT_NO_INVARIANTS) || \ !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ @@ -145,7 +145,7 @@ BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_WITH_SUBCONTRACTING_Z(1, #endif public: - explicit cond_with_subcontracting( + explicit cond_subcontracting( boost::contract::from from, boost::contract::virtual_* v, C* obj, @@ -154,7 +154,7 @@ public: BOOST_CONTRACT_DETAIL_TVARIADIC_FPARAMS_Z(1, BOOST_CONTRACT_MAX_ARGS, Args, &, args) ) : - cond_with_inv(from, obj) + cond_inv(from, obj) #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS , r_(r) #endif @@ -194,13 +194,14 @@ public: !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ !defined(BOOST_CONTRACT_NO_EXCEPTS) - virtual ~cond_with_subcontracting() BOOST_NOEXCEPT_IF(false) { + virtual ~cond_subcontracting() BOOST_NOEXCEPT_IF(false) { if(!base_call_) delete v_; } #endif protected: - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) void init_subcontracted_old() { // Old values of overloaded func on stack (so no `f` param here). exec_and(boost::contract::virtual_::push_old_init_copy); @@ -210,7 +211,7 @@ protected: #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS void check_subcontracted_entry_inv() { exec_and(boost::contract::virtual_::check_entry_inv, - &cond_with_subcontracting::check_entry_inv); + &cond_subcontracting::check_entry_inv); } #endif @@ -218,7 +219,7 @@ protected: void check_subcontracted_pre() { exec_or( boost::contract::virtual_::check_pre, - &cond_with_subcontracting::check_pre, + &cond_subcontracting::check_pre, &boost::contract::precondition_failure ); } @@ -228,28 +229,28 @@ protected: !defined(BOOST_CONTRACT_NO_EXCEPTS) void copy_subcontracted_old() { exec_and(boost::contract::virtual_::call_old_ftor, - &cond_with_subcontracting::copy_virtual_old); + &cond_subcontracting::copy_virtual_old); } #endif #ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS void check_subcontracted_exit_inv() { exec_and(boost::contract::virtual_::check_exit_inv, - &cond_with_subcontracting::check_exit_inv); + &cond_subcontracting::check_exit_inv); } #endif #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS void check_subcontracted_post() { exec_and(boost::contract::virtual_::check_post, - &cond_with_subcontracting::check_virtual_post); + &cond_subcontracting::check_virtual_post); } #endif #ifndef BOOST_CONTRACT_NO_EXCEPTS void check_subcontracted_except() { exec_and(boost::contract::virtual_::check_except, - &cond_with_subcontracting::check_virtual_except); + &cond_subcontracting::check_virtual_except); } #endif @@ -299,7 +300,7 @@ private: typedef typename boost::remove_reference::type>::type r_type; boost::optional r; // No result copy in this code. - if(!base_call_) r = optional_ref(r_); + if(!base_call_) r = optional_get(r_); else if(v_->result_optional_) { try { r = **boost::any_cast*>( @@ -358,7 +359,7 @@ private: !defined(BOOST_CONTRACT_NO_EXCEPTS) void exec_and( // Execute action in short-circuit logic-and with bases. boost::contract::virtual_::action_enum a, - void (cond_with_subcontracting::* f)() = 0 + void (cond_subcontracting::* f)() = 0 ) { if(failed()) return; if(!base_call_ || v_->action_ == a) { @@ -368,7 +369,7 @@ private: } if(f) (this->*f)(); if(base_call_) { - throw cond_with_subcontracting_::signal_no_error(); + throw cond_subcontracting_::signal_no_error(); } } } @@ -377,7 +378,7 @@ private: #ifndef BOOST_CONTRACT_NO_PRECONDITIONS void exec_or( // Execute action in short-circuit logic-or with bases. boost::contract::virtual_::action_enum a, - bool (cond_with_subcontracting::* f)(bool) = 0, + bool (cond_subcontracting::* f)(bool) = 0, void (*h)(boost::contract::from) = 0 ) { if(failed()) return; @@ -401,9 +402,9 @@ private: (this->*f)(/* throw_on_failure = */ base_call_) : false; if(base_call_) { if(!checked) { - throw cond_with_subcontracting_::signal_not_checked(); + throw cond_subcontracting_::signal_not_checked(); } - throw cond_with_subcontracting_::signal_no_error(); + throw cond_subcontracting_::signal_no_error(); } } } @@ -418,7 +419,7 @@ private: if(boost::mpl::empty::value) return false; try { call_base(*this)(typename boost::mpl::front::type()); - } catch(cond_with_subcontracting_::signal_not_checked const&) { + } catch(cond_subcontracting_::signal_not_checked const&) { return exec_or_bases< typename boost::mpl::pop_front::type>(); } catch(...) { @@ -439,7 +440,7 @@ private: !defined(BOOST_CONTRACT_NO_EXCEPTS) class call_base { // Copyable (as &). public: - explicit call_base(cond_with_subcontracting& me) : me_(me) {} + explicit call_base(cond_subcontracting& me) : me_(me) {} template void operator()(B*) { @@ -450,7 +451,7 @@ private: try { call(BOOST_CONTRACT_DETAIL_TVARIADIC_TUPLE_INDEXES_OF( Args)); - } catch(cond_with_subcontracting_::signal_no_error const&) { + } catch(cond_subcontracting_::signal_no_error const&) { // No error (do not throw). } } @@ -474,7 +475,7 @@ private: ); } - cond_with_subcontracting& me_; + cond_subcontracting& me_; }; #endif diff --git a/include/boost/contract/detail/decl.hpp b/include/boost/contract/detail/decl.hpp index 884d244..a46a11e 100644 --- a/include/boost/contract/detail/decl.hpp +++ b/include/boost/contract/detail/decl.hpp @@ -99,7 +99,7 @@ ) #endif -#define BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_WITH_SUBCONTRACTING_Z( \ +#define BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_SUBCONTRACTING_Z( \ z, is_friend, O, VR, F, C, Args) \ template< \ class O, typename VR, typename F, class C \ @@ -112,7 +112,7 @@ , \ class \ ) \ - cond_with_subcontracting + cond_subcontracting /* CODE */ diff --git a/include/boost/contract/detail/operation/constructor.hpp b/include/boost/contract/detail/operation/constructor.hpp index 68313ce..d2e3ff2 100644 --- a/include/boost/contract/detail/operation/constructor.hpp +++ b/include/boost/contract/detail/operation/constructor.hpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #if !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && ( \ !defined(BOOST_CONTRACT_NO_INVARIANTS) || \ @@ -28,9 +28,9 @@ namespace boost { namespace contract { namespace detail { // Ctor subcontracting impl via C++ obj construction mechanism. template // Non-copyable base. -class constructor : public cond_with_inv { +class constructor : public cond_inv { public: - explicit constructor(C* obj) : cond_with_inv( + explicit constructor(C* obj) : cond_inv( boost::contract::from_constructor, obj) {} private: diff --git a/include/boost/contract/detail/operation/destructor.hpp b/include/boost/contract/detail/operation/destructor.hpp index 0db1a55..4cc8341 100644 --- a/include/boost/contract/detail/operation/destructor.hpp +++ b/include/boost/contract/detail/operation/destructor.hpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #if !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && ( \ !defined(BOOST_CONTRACT_NO_INVARIANTS) || \ @@ -28,9 +28,9 @@ namespace boost { namespace contract { namespace detail { // Dtor subcontracting impl via C++ obj destruction mechanism. template // Non-copyable base. -class destructor : public cond_with_inv { +class destructor : public cond_inv { public: - explicit destructor(C* obj) : cond_with_inv( + explicit destructor(C* obj) : cond_inv( boost::contract::from_destructor, obj) {} private: diff --git a/include/boost/contract/detail/operation/function.hpp b/include/boost/contract/detail/operation/function.hpp index b9bb8a5..45d62cc 100644 --- a/include/boost/contract/detail/operation/function.hpp +++ b/include/boost/contract/detail/operation/function.hpp @@ -9,7 +9,7 @@ #include #include -#include +#include #if !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && ( \ !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \ !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ @@ -25,9 +25,9 @@ namespace boost { namespace contract { namespace detail { // Used for free function, private and protected member functions. -class function : public cond_with_post { // Non-copyable base. +class function : public cond_post { // Non-copyable base. public: - explicit function() : cond_with_post( + explicit function() : cond_post( boost::contract::from_function) {} private: diff --git a/include/boost/contract/detail/operation/public_function.hpp b/include/boost/contract/detail/operation/public_function.hpp index 1fcd22b..09cbb27 100644 --- a/include/boost/contract/detail/operation/public_function.hpp +++ b/include/boost/contract/detail/operation/public_function.hpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #if !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && ( \ @@ -38,7 +38,7 @@ template< BOOST_CONTRACT_DETAIL_TVARIADIC_TPARAMS_Z(1, BOOST_CONTRACT_MAX_ARGS, Args) > class public_function : // Non-copyable base. - public cond_with_subcontracting< + public cond_subcontracting< O, VR, F, C BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) BOOST_CONTRACT_DETAIL_TVARIADIC_ARGS_Z(1, BOOST_CONTRACT_MAX_ARGS, Args) @@ -51,7 +51,7 @@ public: BOOST_CONTRACT_DETAIL_TVARIADIC_FPARAMS_Z(1, BOOST_CONTRACT_MAX_ARGS, Args, &, args) ) : - cond_with_subcontracting< + cond_subcontracting< O, VR, F, C BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS) BOOST_CONTRACT_DETAIL_TVARIADIC_ARGS_Z(1, diff --git a/include/boost/contract/detail/operation/public_static_function.hpp b/include/boost/contract/detail/operation/public_static_function.hpp index 478e88f..d14bf01 100644 --- a/include/boost/contract/detail/operation/public_static_function.hpp +++ b/include/boost/contract/detail/operation/public_static_function.hpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #if !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && ( \ !defined(BOOST_CONTRACT_NO_INVARIANTS) || \ @@ -29,9 +29,9 @@ namespace boost { namespace contract { namespace detail { // No subcontracting because static so no obj and no substitution principle. template // Non-copyable base. -class public_static_function : public cond_with_inv { +class public_static_function : public cond_inv { public: - explicit public_static_function() : cond_with_inv( + explicit public_static_function() : cond_inv( boost::contract::from_function, /* obj = */ 0) {} private: diff --git a/include/boost/contract/detail/type_traits/optional.hpp b/include/boost/contract/detail/type_traits/optional.hpp index 8aad15a..cbeefb7 100644 --- a/include/boost/contract/detail/type_traits/optional.hpp +++ b/include/boost/contract/detail/type_traits/optional.hpp @@ -30,9 +30,11 @@ struct remove_value_reference_if_optional > { typedef typename boost::remove_reference::type type; }; template -T& optional_ref(T& x) { return x; } +T& optional_get(T& x) { return x; } template -T& optional_ref(boost::optional& x) { return *x; } +T& optional_get(boost::optional& x) { return x.get(); } +template +T& optional_get(boost::optional& x) { return x.get(); } } } } // namespace diff --git a/test/constructor/access.cpp b/test/constructor/access.cpp index b3fca68..976cd61 100644 --- a/test/constructor/access.cpp +++ b/test/constructor/access.cpp @@ -79,7 +79,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -94,7 +95,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl @@ -117,7 +119,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl diff --git a/test/constructor/body_throw.cpp b/test/constructor/body_throw.cpp index df45bb5..4825d82 100644 --- a/test/constructor/body_throw.cpp +++ b/test/constructor/body_throw.cpp @@ -110,7 +110,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -125,7 +126,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl // Test this threw... diff --git a/test/constructor/contracts.cpp b/test/constructor/contracts.cpp index 7463ce7..e76058a 100644 --- a/test/constructor/contracts.cpp +++ b/test/constructor/contracts.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -246,7 +245,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "d::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "d::ctor::old" << std::endl #endif << "d::ctor::body" << std::endl @@ -265,7 +265,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "p::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "p::ctor::old" << std::endl #endif << "p::ctor::body" << std::endl @@ -284,7 +285,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "q::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "q::ctor::old" << std::endl #endif << "q::ctor::body" << std::endl @@ -302,7 +304,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "e::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "e::ctor::old" << std::endl #endif << "e::ctor::body" << std::endl @@ -317,7 +320,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -332,7 +336,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl @@ -347,87 +352,66 @@ int main() { BOOST_TEST(out.eq(ok.str())); } - #ifdef BOOST_CONTRACT_NO_POSTCONDITIONS - #define BOOST_CONTRACT_TEST_post 0 + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) + #define BOOST_CONTRACT_TEST_old 1u #else - #define BOOST_CONTRACT_TEST_post 1 + #define BOOST_CONTRACT_TEST_old 0u #endif - BOOST_TEST_EQ(a::x_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(a::x_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + std::clog << a::x_type::copies() << std::endl; + std::clog << BOOST_CONTRACT_TEST_old << std::endl; + BOOST_TEST_EQ(a::x_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(a::x_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(a::x_type::ctors(), a::x_type::dtors()); // No leak. - BOOST_TEST_EQ(c::y_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(c::y_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(c::y_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(c::y_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(c::y_type::ctors(), c::y_type::dtors()); // No leak. - BOOST_TEST_EQ(t<'d'>::z_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(t<'d'>::z_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(t<'d'>::z_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(t<'d'>::z_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(t<'d'>::z_type::ctors(), t<'d'>::z_type::dtors()); // No leak. - BOOST_TEST_EQ(t<'p'>::z_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(t<'p'>::z_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(t<'p'>::z_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(t<'p'>::z_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(t<'p'>::z_type::ctors(), t<'p'>::z_type::dtors()); // No leak. - BOOST_TEST_EQ(t<'q'>::z_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(t<'q'>::z_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(t<'q'>::z_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(t<'q'>::z_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(t<'q'>::z_type::ctors(), t<'q'>::z_type::dtors()); // No leak. - BOOST_TEST_EQ(t<'e'>::z_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(t<'e'>::z_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(t<'e'>::z_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(t<'e'>::z_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(t<'e'>::z_type::ctors(), t<'e'>::z_type::dtors()); // No leak. // Following destroy only copies (actual objects are static data members). - BOOST_TEST_EQ(a::n_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(a::n_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(a::n_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(a::n_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(a::n_type::copies(), a::n_type::dtors()); // No leak. - BOOST_TEST_EQ(c::m_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(c::m_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(c::m_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(c::m_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(c::m_type::copies(), c::m_type::dtors()); // No leak. - BOOST_TEST_EQ(t<'d'>::l_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(t<'d'>::l_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(t<'d'>::l_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(t<'d'>::l_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(t<'e'>::l_type::copies(), t<'e'>::l_type::dtors()); // No leak - BOOST_TEST_EQ(t<'p'>::l_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(t<'p'>::l_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(t<'p'>::l_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(t<'p'>::l_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(t<'e'>::l_type::copies(), t<'e'>::l_type::dtors()); // No leak - BOOST_TEST_EQ(t<'q'>::l_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(t<'q'>::l_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(t<'q'>::l_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(t<'q'>::l_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(t<'e'>::l_type::copies(), t<'e'>::l_type::dtors()); // No leak - BOOST_TEST_EQ(t<'e'>::l_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(t<'e'>::l_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(t<'e'>::l_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(t<'e'>::l_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(t<'e'>::l_type::copies(), t<'e'>::l_type::dtors()); // No leak - #undef BOOST_CONTRACT_TEST_post + #undef BOOST_CONTRACT_TEST_old return boost::report_errors(); } diff --git a/test/constructor/decl_entry_static_inv_all.cpp b/test/constructor/decl_entry_static_inv_all.cpp index 30a744c..d64f7ce 100644 --- a/test/constructor/decl_entry_static_inv_all.cpp +++ b/test/constructor/decl_entry_static_inv_all.cpp @@ -33,7 +33,8 @@ std::string ok_c() { std::string ok_b() { std::ostringstream ok; ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -54,7 +55,8 @@ std::string ok_b() { std::string ok_a() { std::ostringstream ok; ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -75,7 +77,8 @@ std::string ok_a() { std::string ok_end() { std::ostringstream ok; ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_entry_static_inv_ends.cpp b/test/constructor/decl_entry_static_inv_ends.cpp index c072147..a4ac18b 100644 --- a/test/constructor/decl_entry_static_inv_ends.cpp +++ b/test/constructor/decl_entry_static_inv_ends.cpp @@ -33,7 +33,8 @@ std::string ok_c() { std::string ok_b() { std::ostringstream ok; ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -51,7 +52,8 @@ std::string ok_b() { std::string ok_a() { std::ostringstream ok; ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -71,7 +73,8 @@ std::string ok_a() { std::string ok_end() { std::ostringstream ok; ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_entry_static_inv_mid.cpp b/test/constructor/decl_entry_static_inv_mid.cpp index b1a6821..fa63929 100644 --- a/test/constructor/decl_entry_static_inv_mid.cpp +++ b/test/constructor/decl_entry_static_inv_mid.cpp @@ -30,7 +30,8 @@ std::string ok_c() { std::string ok_b() { std::ostringstream ok; ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -50,7 +51,8 @@ std::string ok_b() { std::string ok_a() { std::ostringstream ok; ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -69,7 +71,8 @@ std::string ok_a() { std::string ok_end() { std::ostringstream ok; ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_entry_static_inv_none.cpp b/test/constructor/decl_entry_static_inv_none.cpp index 730a6e6..3711776 100644 --- a/test/constructor/decl_entry_static_inv_none.cpp +++ b/test/constructor/decl_entry_static_inv_none.cpp @@ -22,8 +22,9 @@ int main() { << "b::ctor::pre" << std::endl << "c::ctor::pre" << std::endl #endif - - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -34,7 +35,8 @@ int main() { << "c::ctor::post" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -45,7 +47,8 @@ int main() { << "b::ctor::post" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_exit_inv_all.cpp b/test/constructor/decl_exit_inv_all.cpp index eb39abe..9142888 100644 --- a/test/constructor/decl_exit_inv_all.cpp +++ b/test/constructor/decl_exit_inv_all.cpp @@ -26,7 +26,8 @@ std::string ok_c() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -47,7 +48,8 @@ std::string ok_b() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -68,7 +70,8 @@ std::string ok_a() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_exit_inv_ends.cpp b/test/constructor/decl_exit_inv_ends.cpp index 2c59bc1..d7a22e2 100644 --- a/test/constructor/decl_exit_inv_ends.cpp +++ b/test/constructor/decl_exit_inv_ends.cpp @@ -26,7 +26,8 @@ std::string ok_c() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -47,7 +48,8 @@ std::string ok_b() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -68,7 +70,8 @@ std::string ok_a() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_exit_inv_mid.cpp b/test/constructor/decl_exit_inv_mid.cpp index ba4c0ba..aee20e6 100644 --- a/test/constructor/decl_exit_inv_mid.cpp +++ b/test/constructor/decl_exit_inv_mid.cpp @@ -26,7 +26,8 @@ std::string ok_c() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -47,7 +48,8 @@ std::string ok_b() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -68,7 +70,8 @@ std::string ok_a() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_exit_inv_none.cpp b/test/constructor/decl_exit_inv_none.cpp index 4d27b30..d099e19 100644 --- a/test/constructor/decl_exit_inv_none.cpp +++ b/test/constructor/decl_exit_inv_none.cpp @@ -25,7 +25,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -39,7 +40,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -53,7 +55,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_exit_static_inv_all.cpp b/test/constructor/decl_exit_static_inv_all.cpp index 24c4b52..6e91e69 100644 --- a/test/constructor/decl_exit_static_inv_all.cpp +++ b/test/constructor/decl_exit_static_inv_all.cpp @@ -27,7 +27,8 @@ std::string ok_c() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -50,7 +51,8 @@ std::string ok_b() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -73,7 +75,8 @@ std::string ok_a() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_exit_static_inv_ends.cpp b/test/constructor/decl_exit_static_inv_ends.cpp index 33e5227..df67a0e 100644 --- a/test/constructor/decl_exit_static_inv_ends.cpp +++ b/test/constructor/decl_exit_static_inv_ends.cpp @@ -27,7 +27,8 @@ std::string ok_c() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -47,7 +48,8 @@ std::string ok_b() { << "c::ctor::post" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -67,7 +69,8 @@ std::string ok_a() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_exit_static_inv_mid.cpp b/test/constructor/decl_exit_static_inv_mid.cpp index 691ceed..154d8ee 100644 --- a/test/constructor/decl_exit_static_inv_mid.cpp +++ b/test/constructor/decl_exit_static_inv_mid.cpp @@ -24,7 +24,8 @@ std::string ok_c() { << "c::ctor::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -45,7 +46,8 @@ std::string ok_b() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -65,7 +67,8 @@ std::string ok_a() { << "b::ctor::post" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_exit_static_inv_none.cpp b/test/constructor/decl_exit_static_inv_none.cpp index fb241d8..2338ae9 100644 --- a/test/constructor/decl_exit_static_inv_none.cpp +++ b/test/constructor/decl_exit_static_inv_none.cpp @@ -23,7 +23,8 @@ int main() { << "c::ctor::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -34,7 +35,8 @@ int main() { << "c::ctor::post" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -45,7 +47,8 @@ int main() { << "b::ctor::post" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_post_all.cpp b/test/constructor/decl_post_all.cpp index bc8741e..294cb46 100644 --- a/test/constructor/decl_post_all.cpp +++ b/test/constructor/decl_post_all.cpp @@ -26,7 +26,8 @@ std::string ok_c() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -46,7 +47,8 @@ std::string ok_b() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -66,7 +68,8 @@ std::string ok_a() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_post_ends.cpp b/test/constructor/decl_post_ends.cpp index fa19b25..2f91456 100644 --- a/test/constructor/decl_post_ends.cpp +++ b/test/constructor/decl_post_ends.cpp @@ -26,7 +26,8 @@ std::string ok_c() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -46,7 +47,8 @@ std::string ok_ba() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -59,7 +61,8 @@ std::string ok_ba() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_post_mid.cpp b/test/constructor/decl_post_mid.cpp index 8c072bb..41b6011 100644 --- a/test/constructor/decl_post_mid.cpp +++ b/test/constructor/decl_post_mid.cpp @@ -26,7 +26,8 @@ std::string ok_cb() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -38,7 +39,8 @@ std::string ok_cb() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -58,7 +60,8 @@ std::string ok_a() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_post_none.cpp b/test/constructor/decl_post_none.cpp index ec7b75b..dbb8989 100644 --- a/test/constructor/decl_post_none.cpp +++ b/test/constructor/decl_post_none.cpp @@ -25,7 +25,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -37,7 +38,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -49,7 +51,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_pre_all.cpp b/test/constructor/decl_pre_all.cpp index 1efc705..32f3ed6 100644 --- a/test/constructor/decl_pre_all.cpp +++ b/test/constructor/decl_pre_all.cpp @@ -20,7 +20,8 @@ std::string ok_after() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -35,7 +36,8 @@ std::string ok_after() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -50,7 +52,8 @@ std::string ok_after() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_pre_ends.cpp b/test/constructor/decl_pre_ends.cpp index 28ff00d..64addbd 100644 --- a/test/constructor/decl_pre_ends.cpp +++ b/test/constructor/decl_pre_ends.cpp @@ -20,7 +20,8 @@ std::string ok_after() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -35,7 +36,8 @@ std::string ok_after() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -50,7 +52,8 @@ std::string ok_after() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_pre_mid.cpp b/test/constructor/decl_pre_mid.cpp index 31f013f..7457cee 100644 --- a/test/constructor/decl_pre_mid.cpp +++ b/test/constructor/decl_pre_mid.cpp @@ -20,7 +20,8 @@ std::string ok_after() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -35,7 +36,8 @@ std::string ok_after() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -50,7 +52,8 @@ std::string ok_after() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/decl_pre_none.cpp b/test/constructor/decl_pre_none.cpp index 91fe0ab..ee13f25 100644 --- a/test/constructor/decl_pre_none.cpp +++ b/test/constructor/decl_pre_none.cpp @@ -21,7 +21,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -36,7 +37,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -51,7 +53,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl diff --git a/test/constructor/old_throw.cpp b/test/constructor/old_throw.cpp index 2fc4ff0..e0c6839 100644 --- a/test/constructor/old_throw.cpp +++ b/test/constructor/old_throw.cpp @@ -99,7 +99,8 @@ int main() { try { out.str(""); a aa; - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) BOOST_TEST(false); } catch(b::err const&) { #endif @@ -113,7 +114,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::ctor::old" << std::endl #endif << "c::ctor::body" << std::endl @@ -128,7 +130,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl // Test this threw. #else << "b::ctor::body" << std::endl diff --git a/test/destructor/access.cpp b/test/destructor/access.cpp index 55dade0..94ec228 100644 --- a/test/destructor/access.cpp +++ b/test/destructor/access.cpp @@ -67,7 +67,8 @@ int main() { << "a::static_inv" << std::endl << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -82,7 +83,8 @@ int main() { << "b::static_inv" << std::endl << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -104,7 +106,8 @@ int main() { << "b::static_inv" << std::endl << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl diff --git a/test/destructor/body_throw.cpp b/test/destructor/body_throw.cpp index 809b5a8..4c84a2e 100644 --- a/test/destructor/body_throw.cpp +++ b/test/destructor/body_throw.cpp @@ -90,7 +90,8 @@ int main() { << "a::static_inv" << std::endl << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -106,7 +107,8 @@ int main() { << "b::static_inv" << std::endl << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl // Test this threw. @@ -123,7 +125,8 @@ int main() { << "c::static_inv" << std::endl << "c::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/contracts.cpp b/test/destructor/contracts.cpp index 839adf7..87ba6a0 100644 --- a/test/destructor/contracts.cpp +++ b/test/destructor/contracts.cpp @@ -173,7 +173,8 @@ int main() { << "a::static_inv" << std::endl << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -189,7 +190,8 @@ int main() { << "c::static_inv" << std::endl << "c::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl @@ -204,7 +206,8 @@ int main() { << "e::static_inv" << std::endl << "e::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "e::dtor::old" << std::endl #endif << "e::dtor::body" << std::endl @@ -220,7 +223,8 @@ int main() { << "q::static_inv" << std::endl << "q::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "q::dtor::old" << std::endl #endif << "q::dtor::body" << std::endl @@ -236,7 +240,8 @@ int main() { << "p::static_inv" << std::endl << "p::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "p::dtor::old" << std::endl #endif << "p::dtor::body" << std::endl @@ -251,7 +256,8 @@ int main() { << "d::static_inv" << std::endl << "d::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "d::dtor::old" << std::endl #endif << "d::dtor::body" << std::endl @@ -264,51 +270,40 @@ int main() { ; BOOST_TEST(out.eq(ok.str())); - #ifdef BOOST_CONTRACT_NO_POSTCONDITIONS - #define BOOST_CONTRACT_TEST_post 0 + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) + #define BOOST_CONTRACT_TEST_old 1u #else - #define BOOST_CONTRACT_TEST_post 1 + #define BOOST_CONTRACT_TEST_old 0u #endif // Followings destroy only copies (actual objects are static data members). - BOOST_TEST_EQ(a::n_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(a::n_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(a::n_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(a::n_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(a::n_type::copies(), a::n_type::dtors()); // No leak. - BOOST_TEST_EQ(c::m_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(c::m_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(c::m_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(c::m_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(c::m_type::copies(), c::m_type::dtors()); // No leak. - BOOST_TEST_EQ(t<'d'>::l_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(t<'d'>::l_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(t<'d'>::l_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(t<'d'>::l_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(t<'d'>::l_type::copies(), t<'d'>::l_type::dtors()); // No leak - BOOST_TEST_EQ(t<'p'>::l_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(t<'p'>::l_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(t<'p'>::l_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(t<'p'>::l_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(t<'p'>::l_type::copies(), t<'p'>::l_type::dtors()); // No leak - BOOST_TEST_EQ(t<'q'>::l_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(t<'q'>::l_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(t<'q'>::l_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(t<'q'>::l_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(t<'q'>::l_type::copies(), t<'q'>::l_type::dtors()); // No leak - BOOST_TEST_EQ(t<'e'>::l_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(t<'e'>::l_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(t<'e'>::l_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(t<'e'>::l_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(t<'e'>::l_type::copies(), t<'e'>::l_type::dtors()); // No leak - #undef BOOST_CONTRACT_TEST_post + #undef BOOST_CONTRACT_TEST_old return boost::report_errors(); } diff --git a/test/destructor/decl_entry_inv_all.cpp b/test/destructor/decl_entry_inv_all.cpp index c4f2420..c764a44 100644 --- a/test/destructor/decl_entry_inv_all.cpp +++ b/test/destructor/decl_entry_inv_all.cpp @@ -23,7 +23,8 @@ std::string ok_a(bool failed = false) { #endif ; if(!failed) ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -47,7 +48,8 @@ std::string ok_b(checked check = passed) { #endif ; if(check != failed) ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -70,7 +72,8 @@ std::string ok_c(checked check = passed) { #endif ; if(check != failed) ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/decl_entry_inv_ends.cpp b/test/destructor/decl_entry_inv_ends.cpp index c823c72..abe66fc 100644 --- a/test/destructor/decl_entry_inv_ends.cpp +++ b/test/destructor/decl_entry_inv_ends.cpp @@ -23,7 +23,8 @@ std::string ok_a(bool failed = false) { #endif ; if(!failed) ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -42,7 +43,8 @@ std::string ok_b(bool threw = false) { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -67,7 +69,8 @@ std::string ok_c(checked check = passed) { #endif ; if(check != failed) ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/decl_entry_inv_mid.cpp b/test/destructor/decl_entry_inv_mid.cpp index c57225f..c749049 100644 --- a/test/destructor/decl_entry_inv_mid.cpp +++ b/test/destructor/decl_entry_inv_mid.cpp @@ -20,7 +20,8 @@ std::string ok_a() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -42,7 +43,8 @@ std::string ok_b(bool failed = false) { #endif ; if(!failed) ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -61,7 +63,8 @@ std::string ok_c(bool threw = false) { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/decl_entry_inv_none.cpp b/test/destructor/decl_entry_inv_none.cpp index f3b58de..3eaa550 100644 --- a/test/destructor/decl_entry_inv_none.cpp +++ b/test/destructor/decl_entry_inv_none.cpp @@ -19,7 +19,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -33,7 +34,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -47,7 +49,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::static_inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/decl_entry_static_inv_all.cpp b/test/destructor/decl_entry_static_inv_all.cpp index c2b6b27..b668c41 100644 --- a/test/destructor/decl_entry_static_inv_all.cpp +++ b/test/destructor/decl_entry_static_inv_all.cpp @@ -22,7 +22,8 @@ std::string ok_a() { << "a::static_inv" << std::endl << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -42,7 +43,8 @@ std::string ok_b(bool threw = false) { << "b::static_inv" << std::endl << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -63,7 +65,8 @@ std::string ok_c(bool threw = false) { << "c::static_inv" << std::endl << "c::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/decl_entry_static_inv_ends.cpp b/test/destructor/decl_entry_static_inv_ends.cpp index fe55037..660e340 100644 --- a/test/destructor/decl_entry_static_inv_ends.cpp +++ b/test/destructor/decl_entry_static_inv_ends.cpp @@ -22,7 +22,8 @@ std::string ok_a() { << "a::static_inv" << std::endl << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -41,7 +42,8 @@ std::string ok_b(bool threw = false) { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -61,7 +63,8 @@ std::string ok_c(bool threw = false) { << "c::static_inv" << std::endl << "c::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/decl_entry_static_inv_mid.cpp b/test/destructor/decl_entry_static_inv_mid.cpp index d559396..ae98c40 100644 --- a/test/destructor/decl_entry_static_inv_mid.cpp +++ b/test/destructor/decl_entry_static_inv_mid.cpp @@ -21,7 +21,8 @@ std::string ok_a() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -38,7 +39,8 @@ std::string ok_b() { << "b::static_inv" << std::endl << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -57,7 +59,8 @@ std::string ok_c(bool threw = false) { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/decl_entry_static_inv_none.cpp b/test/destructor/decl_entry_static_inv_none.cpp index cefcc4c..7d054ef 100644 --- a/test/destructor/decl_entry_static_inv_none.cpp +++ b/test/destructor/decl_entry_static_inv_none.cpp @@ -20,7 +20,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -31,7 +32,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -42,7 +44,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/decl_exit_static_inv_all.cpp b/test/destructor/decl_exit_static_inv_all.cpp index 6c6777d..dc5f09a 100644 --- a/test/destructor/decl_exit_static_inv_all.cpp +++ b/test/destructor/decl_exit_static_inv_all.cpp @@ -22,7 +22,8 @@ std::string ok_a(bool failed = false) { << "a::static_inv" << std::endl << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -44,7 +45,8 @@ std::string ok_b(checked check = passed) { << "b::static_inv" << std::endl << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -65,7 +67,8 @@ std::string ok_c(checked check = passed) { << "c::static_inv" << std::endl << "c::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/decl_exit_static_inv_ends.cpp b/test/destructor/decl_exit_static_inv_ends.cpp index ae86b75..7277225 100644 --- a/test/destructor/decl_exit_static_inv_ends.cpp +++ b/test/destructor/decl_exit_static_inv_ends.cpp @@ -22,7 +22,8 @@ std::string ok_a(bool failed = false) { << "a::static_inv" << std::endl << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -41,7 +42,8 @@ std::string ok_b(bool threw = false) { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -63,7 +65,8 @@ std::string ok_c(checked check = passed) { << "c::static_inv" << std::endl << "c::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/decl_exit_static_inv_mid.cpp b/test/destructor/decl_exit_static_inv_mid.cpp index a50a2a6..33afcc2 100644 --- a/test/destructor/decl_exit_static_inv_mid.cpp +++ b/test/destructor/decl_exit_static_inv_mid.cpp @@ -21,7 +21,8 @@ std::string ok_a() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -38,7 +39,8 @@ std::string ok_b(bool failed = false) { << "b::static_inv" << std::endl << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -57,7 +59,8 @@ std::string ok_c(bool threw = false) { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/decl_exit_static_inv_none.cpp b/test/destructor/decl_exit_static_inv_none.cpp index 7acff3a..0f96480 100644 --- a/test/destructor/decl_exit_static_inv_none.cpp +++ b/test/destructor/decl_exit_static_inv_none.cpp @@ -20,7 +20,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -31,7 +32,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -42,7 +44,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS << "c::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/decl_post_all.cpp b/test/destructor/decl_post_all.cpp index 2b639b6..059dadb 100644 --- a/test/destructor/decl_post_all.cpp +++ b/test/destructor/decl_post_all.cpp @@ -21,7 +21,8 @@ std::string ok_a() { << "a::static_inv" << std::endl << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -41,7 +42,8 @@ std::string ok_b(bool threw = false) { << "b::static_inv" << std::endl << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -62,7 +64,8 @@ std::string ok_c(bool threw = false) { << "c::static_inv" << std::endl << "c::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/decl_post_ends.cpp b/test/destructor/decl_post_ends.cpp index 9bb50ee..38a3534 100644 --- a/test/destructor/decl_post_ends.cpp +++ b/test/destructor/decl_post_ends.cpp @@ -21,7 +21,8 @@ std::string ok_a() { << "a::static_inv" << std::endl << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -41,7 +42,8 @@ std::string ok_b(bool threw = false) { << "b::static_inv" << std::endl << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -59,7 +61,8 @@ std::string ok_c(bool threw = false) { << "c::static_inv" << std::endl << "c::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/decl_post_mid.cpp b/test/destructor/decl_post_mid.cpp index 9fcd2fd..adf2e31 100644 --- a/test/destructor/decl_post_mid.cpp +++ b/test/destructor/decl_post_mid.cpp @@ -21,7 +21,8 @@ std::string ok_a() { << "a::static_inv" << std::endl << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -38,7 +39,8 @@ std::string ok_b() { << "b::static_inv" << std::endl << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -58,7 +60,8 @@ std::string ok_c(bool threw = false) { << "c::static_inv" << std::endl << "c::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/decl_post_none.cpp b/test/destructor/decl_post_none.cpp index c214a52..faec780 100644 --- a/test/destructor/decl_post_none.cpp +++ b/test/destructor/decl_post_none.cpp @@ -20,7 +20,8 @@ int main() { << "a::static_inv" << std::endl << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -32,7 +33,8 @@ int main() { << "b::static_inv" << std::endl << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -44,7 +46,8 @@ int main() { << "c::static_inv" << std::endl << "c::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl diff --git a/test/destructor/old_throw.cpp b/test/destructor/old_throw.cpp index 5baffd6..37c5da0 100644 --- a/test/destructor/old_throw.cpp +++ b/test/destructor/old_throw.cpp @@ -84,7 +84,8 @@ int main() { a aa; out.str(""); } - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) BOOST_TEST(false); } catch(b::err const&) { #endif @@ -93,7 +94,8 @@ int main() { << "a::static_inv" << std::endl << "a::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -109,7 +111,8 @@ int main() { << "b::static_inv" << std::endl << "b::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl // Test this threw. #else << "b::dtor::body" << std::endl @@ -122,13 +125,15 @@ int main() { << "c::static_inv" << std::endl << "c::inv" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::dtor::old" << std::endl #endif << "c::dtor::body" << std::endl #ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS << "c::static_inv" << std::endl - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) // Test c not destructed (so both static_inv and inv). << "c::inv" << std::endl #endif diff --git a/test/disable/lib_ab.hpp b/test/disable/lib_ab.hpp index d4ceee9..6555066 100644 --- a/test/disable/lib_ab.hpp +++ b/test/disable/lib_ab.hpp @@ -23,7 +23,8 @@ std::string ok_f() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "a::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::f::old" << std::endl #endif << "a::f::body" << std::endl @@ -63,7 +64,8 @@ int main() { << "a::f::body" << std::endl #endif #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::g::old" << std::endl #endif << "b::g::body" << std::endl @@ -86,17 +88,19 @@ int main() { BOOST_TEST(boost::contract::test::detail::oteststream::eq(out(), ok.str())); // Test old values not copied for disabled contracts. - unsigned const cnt = - #if defined(BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION) && \ - !defined(BOOST_CONTRACT_NO_PRECONDITIONS) && \ - !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) - 1 - #else - 0 - #endif + #if defined(BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION) && \ + !defined(BOOST_CONTRACT_NO_PRECONDITIONS) && \ + ( \ + !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) \ + ) + #define BOOST_CONTRACT_TEST_old 1u + #else + #define BOOST_CONTRACT_TEST_old 0u + #endif ; - BOOST_TEST_EQ(a::x_type::copies(), cnt); - BOOST_TEST_EQ(a::x_type::evals(), cnt); + BOOST_TEST_EQ(a::x_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(a::x_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(a::x_type::ctors(), a::x_type::dtors()); // Double check a call to f outside another contract checks f's contracts. @@ -167,6 +171,7 @@ int main() { BOOST_TEST(b::test_disable_inv_failure()); BOOST_TEST(b::test_disable_failure()); + #undef BOOST_CONTRACT_TEST_old return boost::report_errors(); } diff --git a/test/disable/lib_xy.cpp b/test/disable/lib_xy.cpp index 6fde6d1..6463d9b 100644 --- a/test/disable/lib_xy.cpp +++ b/test/disable/lib_xy.cpp @@ -31,7 +31,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "f::old" << std::endl #endif << "f::body" << std::endl @@ -57,7 +58,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "y::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "y::old" << std::endl #endif << "y::body" << std::endl diff --git a/test/function/body_throw.cpp b/test/function/body_throw.cpp index df67134..0cc6b89 100644 --- a/test/function/body_throw.cpp +++ b/test/function/body_throw.cpp @@ -39,7 +39,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "f::old" << std::endl #endif << "f::body" << std::endl // Test this threw. diff --git a/test/function/contracts.cpp b/test/function/contracts.cpp index 62134b9..fe6ad71 100644 --- a/test/function/contracts.cpp +++ b/test/function/contracts.cpp @@ -64,7 +64,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "swap::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "swap::old" << std::endl #endif << "swap::body" << std::endl @@ -79,25 +80,22 @@ int main() { BOOST_TEST_EQ(y.value, 123); } - #ifdef BOOST_CONTRACT_NO_POSTCONDITIONS - #define BOOST_CONTRACT_TEST_post 0 + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) + #define BOOST_CONTRACT_TEST_old 1u #else - #define BOOST_CONTRACT_TEST_post 1 + #define BOOST_CONTRACT_TEST_old 0u #endif - BOOST_TEST_EQ(x_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(x_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(x_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(x_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(x_type::ctors(), x_type::dtors()); // No leak. - BOOST_TEST_EQ(y_type::copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(y_type::evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(y_type::copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(y_type::evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(y_type::ctors(), y_type::dtors()); // No leak. - #undef BOOST_CONTRACT_TEST_post + #undef BOOST_CONTRACT_TEST_old return boost::report_errors(); } diff --git a/test/function/decl_post_all.cpp b/test/function/decl_post_all.cpp index ba75b3d..df46957 100644 --- a/test/function/decl_post_all.cpp +++ b/test/function/decl_post_all.cpp @@ -18,7 +18,8 @@ std::string ok_f() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "f::old" << std::endl #endif << "f::body" << std::endl diff --git a/test/function/decl_post_none.cpp b/test/function/decl_post_none.cpp index f9c9145..f49228b 100644 --- a/test/function/decl_post_none.cpp +++ b/test/function/decl_post_none.cpp @@ -17,7 +17,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "f::old" << std::endl #endif << "f::body" << std::endl diff --git a/test/function/decl_pre_all.cpp b/test/function/decl_pre_all.cpp index 4d07a4e..0cffdfc 100644 --- a/test/function/decl_pre_all.cpp +++ b/test/function/decl_pre_all.cpp @@ -20,7 +20,8 @@ std::string ok_f(bool failed = false) { #endif ; if(!failed) ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "f::old" << std::endl #endif << "f::body" << std::endl diff --git a/test/function/decl_pre_none.cpp b/test/function/decl_pre_none.cpp index 29b3cab..06f09b1 100644 --- a/test/function/decl_pre_none.cpp +++ b/test/function/decl_pre_none.cpp @@ -14,7 +14,8 @@ int main() { std::ostringstream ok; ok // Test nothing fails. - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "f::old" << std::endl #endif << "f::body" << std::endl diff --git a/test/function/old_throw.cpp b/test/function/old_throw.cpp index 6b673b9..3ec3e5f 100644 --- a/test/function/old_throw.cpp +++ b/test/function/old_throw.cpp @@ -44,7 +44,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "f::old" << std::endl // Test this threw. #endif ; diff --git a/test/invariant/decl.hpp b/test/invariant/decl.hpp index 8fcc410..e11a4dc 100644 --- a/test/invariant/decl.hpp +++ b/test/invariant/decl.hpp @@ -221,7 +221,8 @@ int main() { << "b::static_inv" << std::endl #endif #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -245,7 +246,8 @@ int main() { << "a::static_inv" << std::endl #endif #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl @@ -287,7 +289,8 @@ int main() { << "b::f::volatile_pre" << std::endl << "a::f::volatile_pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::f::volatile_old" << std::endl << "a::f::volatile_old" << std::endl #endif @@ -325,7 +328,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "a::s::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::s::old" << std::endl #endif << "a::s::body" << std::endl @@ -346,7 +350,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "a::p::volatile_pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::p::volatile_old" << std::endl #endif << "a::p::volatile_body" << std::endl @@ -362,7 +367,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "a::q::volatile_pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::q::volatile_old" << std::endl #endif << "a::q::volatile_body" << std::endl @@ -386,7 +392,8 @@ int main() { << "a::const_inv" << std::endl #endif #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -410,7 +417,8 @@ int main() { << "b::const_inv" << std::endl #endif #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -439,7 +447,8 @@ int main() { << "b::static_inv" << std::endl #endif #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -463,7 +472,8 @@ int main() { << "a::static_inv" << std::endl #endif #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::ctor::old" << std::endl #endif << "a::ctor::body" << std::endl @@ -505,7 +515,8 @@ int main() { << "b::f::pre" << std::endl << "a::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::f::old" << std::endl << "a::f::old" << std::endl #endif @@ -543,7 +554,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "a::s::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::s::old" << std::endl #endif << "a::s::body" << std::endl @@ -564,7 +576,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "a::p::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::p::old" << std::endl #endif << "a::p::body" << std::endl @@ -580,7 +593,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "a::q::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::q::old" << std::endl #endif << "a::q::body" << std::endl @@ -604,7 +618,8 @@ int main() { << "a::const_inv" << std::endl #endif #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::dtor::old" << std::endl #endif << "a::dtor::body" << std::endl @@ -628,7 +643,8 @@ int main() { << "b::const_inv" << std::endl #endif #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -657,7 +673,8 @@ int main() { << "b::static_inv" << std::endl #endif #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -692,7 +709,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "b::f::volatile_pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::f::volatile_old" << std::endl #endif << "b::f::volatile_body" << std::endl @@ -724,7 +742,8 @@ int main() { << "b::const_inv" << std::endl #endif #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl @@ -752,7 +771,8 @@ int main() { << "b::static_inv" << std::endl #endif #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::ctor::old" << std::endl #endif << "b::ctor::body" << std::endl @@ -787,7 +807,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "b::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::f::old" << std::endl #endif << "b::f::body" << std::endl @@ -819,7 +840,8 @@ int main() { << "b::const_inv" << std::endl #endif #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::dtor::old" << std::endl #endif << "b::dtor::body" << std::endl diff --git a/test/old/auto.cpp b/test/old/auto.cpp index 066a1a7..e08cd9c 100644 --- a/test/old/auto.cpp +++ b/test/old/auto.cpp @@ -21,7 +21,10 @@ int main() { x = 123; BOOST_STATIC_ASSERT(boost::is_same >::value); - BOOST_TEST_EQ(*old_x, -123); + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) + BOOST_TEST_EQ(*old_x, -123); + #endif BOOST_TEST_EQ(x, 123); boost::contract::virtual_* v = 0; @@ -30,7 +33,10 @@ int main() { y = 'k'; BOOST_STATIC_ASSERT(boost::is_same >::value); - BOOST_TEST_EQ(*old_y, 'j'); + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) + BOOST_TEST_EQ(*old_y, 'j'); + #endif BOOST_TEST_EQ(y, 'k'); #endif // Else, nothing to test. return boost::report_errors(); diff --git a/test/old/no_macros.hpp b/test/old/no_macros.hpp index 63a8807..9daff67 100644 --- a/test/old/no_macros.hpp +++ b/test/old/no_macros.hpp @@ -127,7 +127,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "swap::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "swap::old" << std::endl #endif << "swap::body" << std::endl @@ -137,22 +138,21 @@ int main() { ; BOOST_TEST(out.eq(ok.str())); - unsigned const cnt = - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - 1 - #else - 0 - #endif - ; + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) + #define BOOST_CONTRACT_TEST_old 1u + #else + #define BOOST_CONTRACT_TEST_old 0u + #endif BOOST_TEST_EQ(x.value, 'b'); - BOOST_TEST_EQ(x.copies(), cnt); - BOOST_TEST_EQ(x.evals(), cnt); + BOOST_TEST_EQ(x.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(x.evals(), BOOST_CONTRACT_TEST_old); 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.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(y.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(y.ctors(), y.dtors() + 1); // 1 for local var. a aa; @@ -165,7 +165,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "b::swap::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::swap::old" << std::endl #endif << "a::swap::body" << std::endl @@ -177,15 +178,16 @@ int main() { BOOST_TEST(out.eq(ok.str())); BOOST_TEST_EQ(i.value, 2); - BOOST_TEST_EQ(i.copies(), cnt); - BOOST_TEST_EQ(i.evals(), cnt); + BOOST_TEST_EQ(i.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(i.evals(), BOOST_CONTRACT_TEST_old); 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.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(j.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(j.ctors(), j.dtors() + 1); // 1 for local var. + #undef BOOST_CONTRACT_TEST_old return boost::report_errors(); } diff --git a/test/public_function/access.cpp b/test/public_function/access.cpp index b6bfa6e..0bd8026 100644 --- a/test/public_function/access.cpp +++ b/test/public_function/access.cpp @@ -86,7 +86,8 @@ int main() { << "b::f::pre" << std::endl << "a::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::f::old" << std::endl << "a::f::old" << std::endl #endif @@ -117,7 +118,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "b::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::f::old" << std::endl #endif << "b::f::body" << std::endl diff --git a/test/public_function/body_throw.cpp b/test/public_function/body_throw.cpp index 0946efb..77d5532 100644 --- a/test/public_function/body_throw.cpp +++ b/test/public_function/body_throw.cpp @@ -37,7 +37,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "d::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "d::f::old" << std::endl << "e::f::old" << std::endl << "c::f::old" << std::endl @@ -67,49 +68,40 @@ int main() { ; BOOST_TEST(out.eq(ok.str())); - #ifdef BOOST_CONTRACT_NO_EXEPTS - #define BOOST_CONTRACT_TEST_except 0 + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) + #define BOOST_CONTRACT_TEST_old 1u #else - #define BOOST_CONTRACT_TEST_except 1 + #define BOOST_CONTRACT_TEST_old 0u #endif BOOST_TEST(!r); // Boost.Optional result not init (as body threw). BOOST_TEST_EQ(s.value, "X"); - BOOST_TEST_EQ(s.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 4u, 0u)); - BOOST_TEST_EQ(s.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 4u, 0u)); + BOOST_TEST_EQ(s.copies(), BOOST_CONTRACT_TEST_old * 4); + BOOST_TEST_EQ(s.evals(), BOOST_CONTRACT_TEST_old * 4); BOOST_TEST_EQ(s.ctors(), s.dtors() + 1); // 1 for local var. BOOST_TEST_EQ(aa.x.value, "a"); - BOOST_TEST_EQ(aa.x.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); - BOOST_TEST_EQ(aa.x.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); + BOOST_TEST_EQ(aa.x.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(aa.x.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(aa.x.ctors(), aa.x.dtors() + 1); // 1 for member var. BOOST_TEST_EQ(aa.y.value, "c"); - BOOST_TEST_EQ(aa.y.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); - BOOST_TEST_EQ(aa.y.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); + BOOST_TEST_EQ(aa.y.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(aa.y.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(aa.y.ctors(), aa.y.dtors() + 1); // 1 for member var. BOOST_TEST_EQ(aa.t<'d'>::z.value, "d"); - BOOST_TEST_EQ(aa.t<'d'>::z.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); - BOOST_TEST_EQ(aa.t<'d'>::z.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); + BOOST_TEST_EQ(aa.t<'d'>::z.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(aa.t<'d'>::z.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(aa.t<'d'>::z.ctors(), aa.t<'d'>::z.dtors() + 1); // 1 mem. BOOST_TEST_EQ(aa.t<'e'>::z.value, "e"); - BOOST_TEST_EQ(aa.t<'e'>::z.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); - BOOST_TEST_EQ(aa.t<'e'>::z.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); + BOOST_TEST_EQ(aa.t<'e'>::z.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(aa.t<'e'>::z.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(aa.t<'e'>::z.ctors(), aa.t<'e'>::z.dtors() + 1); // 1 mem. - #undef BOOST_CONTRACT_TEST_except + #undef BOOST_CONTRACT_TEST_old } return boost::report_errors(); } diff --git a/test/public_function/body_throw_virtual.cpp b/test/public_function/body_throw_virtual.cpp index e4d446a..d2b4e41 100644 --- a/test/public_function/body_throw_virtual.cpp +++ b/test/public_function/body_throw_virtual.cpp @@ -38,7 +38,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "d::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "d::f::old" << std::endl << "e::f::old" << std::endl << "c::f::old" << std::endl @@ -68,50 +69,41 @@ int main() { ; BOOST_TEST(out.eq(ok.str())); - #ifdef BOOST_CONTRACT_NO_EXEPTS - #define BOOST_CONTRACT_TEST_except 0 + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) + #define BOOST_CONTRACT_TEST_old 1u #else - #define BOOST_CONTRACT_TEST_except 1 + #define BOOST_CONTRACT_TEST_old 0u #endif BOOST_TEST(!r); // Boost.Optional result not init (as body threw). BOOST_TEST_EQ(s.value, "X"); - BOOST_TEST_EQ(s.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 4u, 0u)); - BOOST_TEST_EQ(s.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 4u, 0u)); + BOOST_TEST_EQ(s.copies(), BOOST_CONTRACT_TEST_old * 4); + BOOST_TEST_EQ(s.evals(), BOOST_CONTRACT_TEST_old * 4); BOOST_TEST_EQ(s.ctors(), s.dtors() + 1); // 1 for local var. // Cannot access x via ca, but only via aa. BOOST_TEST_EQ(aa.x.value, "a"); - BOOST_TEST_EQ(aa.x.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); - BOOST_TEST_EQ(aa.x.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); + BOOST_TEST_EQ(aa.x.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(aa.x.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(aa.x.ctors(), aa.x.dtors() + 1); // 1 for member var. BOOST_TEST_EQ(ca.y.value, "c"); - BOOST_TEST_EQ(ca.y.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); - BOOST_TEST_EQ(ca.y.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); + BOOST_TEST_EQ(ca.y.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(ca.y.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(ca.y.ctors(), aa.y.dtors() + 1); // 1 for member var. BOOST_TEST_EQ(ca.t<'d'>::z.value, "d"); - BOOST_TEST_EQ(ca.t<'d'>::z.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); - BOOST_TEST_EQ(ca.t<'d'>::z.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); + BOOST_TEST_EQ(ca.t<'d'>::z.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(ca.t<'d'>::z.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(ca.t<'d'>::z.ctors(), aa.t<'d'>::z.dtors() + 1); // 1 mem. BOOST_TEST_EQ(ca.t<'e'>::z.value, "e"); - BOOST_TEST_EQ(ca.t<'e'>::z.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); - BOOST_TEST_EQ(ca.t<'e'>::z.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); + BOOST_TEST_EQ(ca.t<'e'>::z.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(ca.t<'e'>::z.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(ca.t<'e'>::z.ctors(), aa.t<'e'>::z.dtors() + 1); // 1 mem. - #undef BOOST_CONTRACT_TEST_except + #undef BOOST_CONTRACT_TEST_old } return boost::report_errors(); } diff --git a/test/public_function/body_throw_virtual_branch.cpp b/test/public_function/body_throw_virtual_branch.cpp index d6d6638..852e656 100644 --- a/test/public_function/body_throw_virtual_branch.cpp +++ b/test/public_function/body_throw_virtual_branch.cpp @@ -35,7 +35,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "d::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "d::f::old" << std::endl << "e::f::old" << std::endl << "c::f::old" << std::endl @@ -60,42 +61,35 @@ int main() { ; BOOST_TEST(out.eq(ok.str())); - #ifdef BOOST_CONTRACT_NO_EXEPTS - #define BOOST_CONTRACT_TEST_except 0 + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) + #define BOOST_CONTRACT_TEST_old 1u #else - #define BOOST_CONTRACT_TEST_except 1 + #define BOOST_CONTRACT_TEST_old 0u #endif BOOST_TEST(!r); // Boost.Optional result not init (as body threw). BOOST_TEST_EQ(s.value, "X"); - BOOST_TEST_EQ(s.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 3u, 0u)); - BOOST_TEST_EQ(s.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 3u, 0u)); + BOOST_TEST_EQ(s.copies(), BOOST_CONTRACT_TEST_old * 3); + BOOST_TEST_EQ(s.evals(), BOOST_CONTRACT_TEST_old * 3); BOOST_TEST_EQ(s.ctors(), s.dtors() + 1); // 1 for local var. BOOST_TEST_EQ(cc.y.value, "c"); - BOOST_TEST_EQ(cc.y.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); - BOOST_TEST_EQ(cc.y.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); + BOOST_TEST_EQ(cc.y.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(cc.y.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(cc.y.ctors(), cc.y.dtors() + 1); // 1 for member var. BOOST_TEST_EQ(cc.t<'d'>::z.value, "d"); - BOOST_TEST_EQ(cc.t<'d'>::z.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); - BOOST_TEST_EQ(cc.t<'d'>::z.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); + BOOST_TEST_EQ(cc.t<'d'>::z.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(cc.t<'d'>::z.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(cc.t<'d'>::z.ctors(), cc.t<'d'>::z.dtors() + 1); // 1 mem. BOOST_TEST_EQ(cc.t<'e'>::z.value, "e"); - BOOST_TEST_EQ(cc.t<'e'>::z.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); - BOOST_TEST_EQ(cc.t<'e'>::z.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_except, 1u, 0u)); + BOOST_TEST_EQ(cc.t<'e'>::z.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(cc.t<'e'>::z.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(cc.t<'e'>::z.ctors(), cc.t<'e'>::z.dtors() + 1); // 1 mem. - #undef BOOST_CONTRACT_TEST_except + #undef BOOST_CONTRACT_TEST_old } return boost::report_errors(); } diff --git a/test/public_function/contracts.cpp b/test/public_function/contracts.cpp index aa95ed7..fd57c38 100644 --- a/test/public_function/contracts.cpp +++ b/test/public_function/contracts.cpp @@ -36,7 +36,8 @@ int main() { << "c::f::pre" << std::endl << "a::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "d::f::old" << std::endl << "e::f::old" << std::endl << "c::f::old" << std::endl @@ -66,49 +67,40 @@ int main() { ; BOOST_TEST(out.eq(ok.str())); - #ifdef BOOST_CONTRACT_NO_POSTCONDITIONS - #define BOOST_CONTRACT_TEST_post 0 + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) + #define BOOST_CONTRACT_TEST_old 1u #else - #define BOOST_CONTRACT_TEST_post 1 + #define BOOST_CONTRACT_TEST_old 0u #endif BOOST_TEST_EQ(r.value, "A"); BOOST_TEST_EQ(s.value, "acde"); - BOOST_TEST_EQ(s.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 4u, 0u)); - BOOST_TEST_EQ(s.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 4u, 0u)); + BOOST_TEST_EQ(s.copies(), BOOST_CONTRACT_TEST_old * 4); + BOOST_TEST_EQ(s.evals(), BOOST_CONTRACT_TEST_old * 4); BOOST_TEST_EQ(s.ctors(), s.dtors() + 1); // 1 for local var. BOOST_TEST_EQ(aa.x.value, "aA"); - BOOST_TEST_EQ(aa.x.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(aa.x.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(aa.x.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(aa.x.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(aa.x.ctors(), aa.x.dtors() + 1); // 1 for member var. BOOST_TEST_EQ(aa.y.value, "cA"); - BOOST_TEST_EQ(aa.y.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(aa.y.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(aa.y.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(aa.y.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(aa.y.ctors(), aa.y.dtors() + 1); // 1 for member var. BOOST_TEST_EQ(aa.t<'d'>::z.value, "dA"); - BOOST_TEST_EQ(aa.t<'d'>::z.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(aa.t<'d'>::z.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(aa.t<'d'>::z.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(aa.t<'d'>::z.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(aa.t<'d'>::z.ctors(), aa.t<'d'>::z.dtors() + 1); // 1 member. BOOST_TEST_EQ(aa.t<'e'>::z.value, "eA"); - BOOST_TEST_EQ(aa.t<'e'>::z.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(aa.t<'e'>::z.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(aa.t<'e'>::z.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(aa.t<'e'>::z.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(aa.t<'e'>::z.ctors(), aa.t<'e'>::z.dtors() + 1); // 1 member. - #undef BOOST_CONTRACT_TEST_post + #undef BOOST_CONTRACT_TEST_old return boost::report_errors(); } diff --git a/test/public_function/decl_entry_inv_all.cpp b/test/public_function/decl_entry_inv_all.cpp index bdb68f4..61eb943 100644 --- a/test/public_function/decl_entry_inv_all.cpp +++ b/test/public_function/decl_entry_inv_all.cpp @@ -21,7 +21,8 @@ std::string ok_end() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_entry_inv_ends.cpp b/test/public_function/decl_entry_inv_ends.cpp index 1c5a0ab..263edb9 100644 --- a/test/public_function/decl_entry_inv_ends.cpp +++ b/test/public_function/decl_entry_inv_ends.cpp @@ -21,7 +21,8 @@ std::string ok_end() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_entry_inv_mid.cpp b/test/public_function/decl_entry_inv_mid.cpp index e9250f8..6183c23 100644 --- a/test/public_function/decl_entry_inv_mid.cpp +++ b/test/public_function/decl_entry_inv_mid.cpp @@ -21,7 +21,8 @@ std::string ok_end() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_entry_inv_none.cpp b/test/public_function/decl_entry_inv_none.cpp index 38e4584..e67a864 100644 --- a/test/public_function/decl_entry_inv_none.cpp +++ b/test/public_function/decl_entry_inv_none.cpp @@ -26,7 +26,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_entry_static_inv_all.cpp b/test/public_function/decl_entry_static_inv_all.cpp index f57aa91..741e5ab 100644 --- a/test/public_function/decl_entry_static_inv_all.cpp +++ b/test/public_function/decl_entry_static_inv_all.cpp @@ -21,7 +21,8 @@ std::string ok_end() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_entry_static_inv_ends.cpp b/test/public_function/decl_entry_static_inv_ends.cpp index 476f3c3..2d34781 100644 --- a/test/public_function/decl_entry_static_inv_ends.cpp +++ b/test/public_function/decl_entry_static_inv_ends.cpp @@ -21,7 +21,8 @@ std::string ok_end() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl @@ -122,7 +123,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_entry_static_inv_mid.cpp b/test/public_function/decl_entry_static_inv_mid.cpp index a242b17..0870b82 100644 --- a/test/public_function/decl_entry_static_inv_mid.cpp +++ b/test/public_function/decl_entry_static_inv_mid.cpp @@ -21,7 +21,8 @@ std::string ok_end() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_entry_static_inv_none.cpp b/test/public_function/decl_entry_static_inv_none.cpp index e94d2c5..5e314af 100644 --- a/test/public_function/decl_entry_static_inv_none.cpp +++ b/test/public_function/decl_entry_static_inv_none.cpp @@ -25,7 +25,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_exit_inv_all.cpp b/test/public_function/decl_exit_inv_all.cpp index 395e4ae..5c5111c 100644 --- a/test/public_function/decl_exit_inv_all.cpp +++ b/test/public_function/decl_exit_inv_all.cpp @@ -29,7 +29,8 @@ std::string ok_begin() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_exit_inv_ends.cpp b/test/public_function/decl_exit_inv_ends.cpp index 068a091..028d365 100644 --- a/test/public_function/decl_exit_inv_ends.cpp +++ b/test/public_function/decl_exit_inv_ends.cpp @@ -28,7 +28,8 @@ std::string ok_begin() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_exit_inv_mid.cpp b/test/public_function/decl_exit_inv_mid.cpp index 771f976..26a08db 100644 --- a/test/public_function/decl_exit_inv_mid.cpp +++ b/test/public_function/decl_exit_inv_mid.cpp @@ -27,7 +27,8 @@ std::string ok_begin() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_exit_inv_none.cpp b/test/public_function/decl_exit_inv_none.cpp index 720b488..949cfbb 100644 --- a/test/public_function/decl_exit_inv_none.cpp +++ b/test/public_function/decl_exit_inv_none.cpp @@ -27,7 +27,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_exit_static_inv_all.cpp b/test/public_function/decl_exit_static_inv_all.cpp index 93cfbcd..dd92489 100644 --- a/test/public_function/decl_exit_static_inv_all.cpp +++ b/test/public_function/decl_exit_static_inv_all.cpp @@ -29,7 +29,8 @@ std::string ok_begin() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_exit_static_inv_ends.cpp b/test/public_function/decl_exit_static_inv_ends.cpp index 1147e10..e3bf080 100644 --- a/test/public_function/decl_exit_static_inv_ends.cpp +++ b/test/public_function/decl_exit_static_inv_ends.cpp @@ -28,7 +28,8 @@ std::string ok_begin() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_exit_static_inv_mid.cpp b/test/public_function/decl_exit_static_inv_mid.cpp index 3d376cb..b5a5940 100644 --- a/test/public_function/decl_exit_static_inv_mid.cpp +++ b/test/public_function/decl_exit_static_inv_mid.cpp @@ -27,7 +27,8 @@ std::string ok_begin() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_exit_static_inv_none.cpp b/test/public_function/decl_exit_static_inv_none.cpp index 9a70346..3d3d3b2 100644 --- a/test/public_function/decl_exit_static_inv_none.cpp +++ b/test/public_function/decl_exit_static_inv_none.cpp @@ -26,7 +26,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_post_all.cpp b/test/public_function/decl_post_all.cpp index 3d49aa0..1cf8dbc 100644 --- a/test/public_function/decl_post_all.cpp +++ b/test/public_function/decl_post_all.cpp @@ -28,7 +28,8 @@ std::string ok_begin() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_post_ends.cpp b/test/public_function/decl_post_ends.cpp index 59a1ee5..61abbae 100644 --- a/test/public_function/decl_post_ends.cpp +++ b/test/public_function/decl_post_ends.cpp @@ -28,7 +28,8 @@ std::string ok_begin() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_post_mid.cpp b/test/public_function/decl_post_mid.cpp index 97534e7..e4d18ad 100644 --- a/test/public_function/decl_post_mid.cpp +++ b/test/public_function/decl_post_mid.cpp @@ -28,7 +28,8 @@ std::string ok_begin() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_post_none.cpp b/test/public_function/decl_post_none.cpp index e1131e0..0bc66ad 100644 --- a/test/public_function/decl_post_none.cpp +++ b/test/public_function/decl_post_none.cpp @@ -27,7 +27,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl diff --git a/test/public_function/decl_pre_all.cpp b/test/public_function/decl_pre_all.cpp index 2b49b9e..f8b9c17 100644 --- a/test/public_function/decl_pre_all.cpp +++ b/test/public_function/decl_pre_all.cpp @@ -31,7 +31,8 @@ std::string ok_begin() { std::string ok_end() { std::ostringstream ok; ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl @@ -46,7 +47,7 @@ std::string ok_end() { << "a::inv" << std::endl #endif #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - << "c::f::old" << std::endl + << "c::f::old" << std::endl // Old only if post (or except) run. << "c::f::post" << std::endl << "b::f::old" << std::endl << "b::f::post" << std::endl diff --git a/test/public_function/decl_pre_ends.cpp b/test/public_function/decl_pre_ends.cpp index d4b0259..06f206a 100644 --- a/test/public_function/decl_pre_ends.cpp +++ b/test/public_function/decl_pre_ends.cpp @@ -31,7 +31,8 @@ std::string ok_begin() { std::string ok_end() { std::ostringstream ok; ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl @@ -46,7 +47,7 @@ std::string ok_end() { << "a::inv" << std::endl #endif #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - << "c::f::old" << std::endl + << "c::f::old" << std::endl // Old only if post (or except) run. << "c::f::post" << std::endl << "b::f::old" << std::endl << "b::f::post" << std::endl diff --git a/test/public_function/decl_pre_mid.cpp b/test/public_function/decl_pre_mid.cpp index 26205bf..55e177c 100644 --- a/test/public_function/decl_pre_mid.cpp +++ b/test/public_function/decl_pre_mid.cpp @@ -31,7 +31,8 @@ std::string ok_begin() { std::string ok_end() { std::ostringstream ok; ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl @@ -46,7 +47,7 @@ std::string ok_end() { << "a::inv" << std::endl #endif #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - << "c::f::old" << std::endl + << "c::f::old" << std::endl // Old only if post (or except) run. << "c::f::post" << std::endl << "b::f::old" << std::endl << "b::f::post" << std::endl diff --git a/test/public_function/decl_pre_none.cpp b/test/public_function/decl_pre_none.cpp index a8f5d6b..9d91384 100644 --- a/test/public_function/decl_pre_none.cpp +++ b/test/public_function/decl_pre_none.cpp @@ -25,7 +25,8 @@ int main() { << "a::inv" << std::endl #endif // No preconditions here. - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl @@ -40,7 +41,7 @@ int main() { << "a::inv" << std::endl #endif #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS - << "c::f::old" << std::endl + << "c::f::old" << std::endl // Old only if post (or except) run. << "c::f::post" << std::endl << "b::f::old" << std::endl << "b::f::post" << std::endl diff --git a/test/public_function/ifdef_contracts.cpp b/test/public_function/ifdef_contracts.cpp index 7dbc4c1..04ab352 100644 --- a/test/public_function/ifdef_contracts.cpp +++ b/test/public_function/ifdef_contracts.cpp @@ -72,7 +72,7 @@ struct a #ifndef BOOST_CONTRACT_NO_PRECONDITIONS .precondition([] { out << "a::f::pre" << std::endl; }) #endif - #ifndef OOST_CONTRACT_NO_POSTCONDITIONS + #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS .old([] { out << "a::f::old" << std::endl; }) .postcondition([] { out << "a::f::post" << std::endl; }) #endif diff --git a/test/public_function/max_args.hpp b/test/public_function/max_args.hpp index a9853a7..6d39a87 100644 --- a/test/public_function/max_args.hpp +++ b/test/public_function/max_args.hpp @@ -116,25 +116,31 @@ int main() { std::ostringstream ok; a aa; - #ifdef BOOST_CONTRACT_NO_ENTRY_INVARIANTS - #define BOOST_CONTRACT_TEST_entry_inv 0 - #else + #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS #define BOOST_CONTRACT_TEST_entry_inv 1 - #endif - #ifdef BOOST_CONTRACT_NO_PRECONDITIONS - #define BOOST_CONTRACT_TEST_pre 0 #else + #define BOOST_CONTRACT_TEST_entry_inv 0 + #endif + #ifndef BOOST_CONTRACT_NO_PRECONDITIONS #define BOOST_CONTRACT_TEST_pre 1 - #endif - #ifdef BOOST_CONTRACT_NO_EXIT_INVARIANTS - #define BOOST_CONTRACT_TEST_exit_inv 0 #else + #define BOOST_CONTRACT_TEST_pre 0 + #endif + #ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS #define BOOST_CONTRACT_TEST_exit_inv 1 - #endif - #ifdef BOOST_CONTRACT_NO_POSTCONDITIONS - #define BOOST_CONTRACT_TEST_post 0 #else + #define BOOST_CONTRACT_TEST_exit_inv 0 + #endif + #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS #define BOOST_CONTRACT_TEST_post 1 + #else + #define BOOST_CONTRACT_TEST_post 0 + #endif + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) + #define BOOST_CONTRACT_TEST_old 1 + #else + #define BOOST_CONTRACT_TEST_old 0 #endif #define BOOST_CONTRACT_TEST_MAX_ARGS_TEST_(z, n, unused) \ @@ -152,7 +158,7 @@ int main() { << "b::" << BOOST_PP_STRINGIZE(BOOST_PP_CAT(f, n)) << \ "::pre\n" \ ) \ - BOOST_PP_EXPR_IIF(BOOST_CONTRACT_TEST_post, \ + BOOST_PP_EXPR_IIF(BOOST_CONTRACT_TEST_old, \ << "b::" << BOOST_PP_STRINGIZE(BOOST_PP_CAT(f, n)) << \ "::old\n" \ << "a::" << BOOST_PP_STRINGIZE(BOOST_PP_CAT(f, n)) << \ @@ -183,6 +189,7 @@ int main() { #undef BOOST_CONTRACT_TEST_pre #undef BOOST_CONTRACT_TEST_exit_inv #undef BOOST_CONTRACT_TEST_post + #undef BOOST_CONTRACT_TEST_old return boost::report_errors(); } diff --git a/test/public_function/old_throw.cpp b/test/public_function/old_throw.cpp index 16c5147..824f9e7 100644 --- a/test/public_function/old_throw.cpp +++ b/test/public_function/old_throw.cpp @@ -106,7 +106,8 @@ int main() { try { out.str(""); ba.f(); - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) BOOST_TEST(false); } catch(c::err const&) { #endif @@ -124,7 +125,8 @@ int main() { << "b::f::pre" << std::endl << "a::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl // Test this threw. #else << "a::f::body" << std::endl diff --git a/test/public_function/old_virtual.cpp b/test/public_function/old_virtual.cpp index ba3e7a6..1a3c8d6 100644 --- a/test/public_function/old_virtual.cpp +++ b/test/public_function/old_virtual.cpp @@ -155,7 +155,8 @@ int main() { out.str(""); aa.f(i, n); ok.str(""); ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl << "a::f::old" << std::endl @@ -178,7 +179,8 @@ int main() { out.str(""); bb.f(i, n); ok.str(""); ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "b::f::old" << std::endl #endif @@ -198,7 +200,8 @@ int main() { out.str(""); cc.f(i, n); ok.str(""); ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl #endif << "c::f::body" << std::endl diff --git a/test/public_function/overload.hpp b/test/public_function/overload.hpp index f70c3b7..f3c7686 100644 --- a/test/public_function/overload.hpp +++ b/test/public_function/overload.hpp @@ -234,7 +234,8 @@ std::string ok_args(std::string const& args) { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "b::f(" << args << ")::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::f(" << args << ")::old" << std::endl << "a::f(" << args << ")::old" << std::endl #endif @@ -284,7 +285,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "a::f(T)::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::f(T)::old" << std::endl #endif << "a::f(T)::body" << std::endl @@ -313,7 +315,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "a::f(bool)::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::f(bool)::old" << std::endl #endif << "a::f(bool)::body" << std::endl diff --git a/test/public_function/protected.cpp b/test/public_function/protected.cpp index 6781048..95bbd7b 100644 --- a/test/public_function/protected.cpp +++ b/test/public_function/protected.cpp @@ -69,7 +69,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "a::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::f::old" << std::endl #endif << "a::f::body" << std::endl diff --git a/test/public_function/static.cpp b/test/public_function/static.cpp index 6697ec0..1082885 100644 --- a/test/public_function/static.cpp +++ b/test/public_function/static.cpp @@ -63,7 +63,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "a::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::f::old" << std::endl #endif << "a::f::body" << std::endl diff --git a/test/public_function/static_body_throw.cpp b/test/public_function/static_body_throw.cpp index e69a1f8..a66b6b9 100644 --- a/test/public_function/static_body_throw.cpp +++ b/test/public_function/static_body_throw.cpp @@ -46,7 +46,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "a::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::f::old" << std::endl #endif << "a::f::body" << std::endl diff --git a/test/public_function/static_old_throw.cpp b/test/public_function/static_old_throw.cpp index 41edbc8..68de195 100644 --- a/test/public_function/static_old_throw.cpp +++ b/test/public_function/static_old_throw.cpp @@ -41,7 +41,8 @@ int main() { try { out.str(""); a::f(); - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) BOOST_TEST(false); } catch(a::err const&) { #endif @@ -52,7 +53,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "a::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::f::old" << std::endl // Test this threw. #else << "a::f::body" << std::endl diff --git a/test/public_function/virtual.cpp b/test/public_function/virtual.cpp index 082ca9c..bcb4827 100644 --- a/test/public_function/virtual.cpp +++ b/test/public_function/virtual.cpp @@ -37,7 +37,8 @@ int main() { << "c::f::pre" << std::endl << "a::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "d::f::old" << std::endl << "e::f::old" << std::endl << "c::f::old" << std::endl @@ -67,50 +68,41 @@ int main() { ; BOOST_TEST(out.eq(ok.str())); - #ifdef BOOST_CONTRACT_NO_POSTCONDITIONS - #define BOOST_CONTRACT_TEST_post 0 + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) + #define BOOST_CONTRACT_TEST_old 1u #else - #define BOOST_CONTRACT_TEST_post 1 + #define BOOST_CONTRACT_TEST_old 0u #endif BOOST_TEST_EQ(r.value, "A"); BOOST_TEST_EQ(s.value, "acde"); - BOOST_TEST_EQ(s.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 4u, 0u)); - BOOST_TEST_EQ(s.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 4u, 0u)); + BOOST_TEST_EQ(s.copies(), BOOST_CONTRACT_TEST_old * 4); + BOOST_TEST_EQ(s.evals(), BOOST_CONTRACT_TEST_old * 4); BOOST_TEST_EQ(s.ctors(), s.dtors() + 1); // 1 local var. // Cannot access x via ca, but only via aa. BOOST_TEST_EQ(aa.x.value, "aA"); - BOOST_TEST_EQ(aa.x.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(aa.x.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(aa.x.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(aa.x.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(aa.x.ctors(), aa.x.dtors() + 1); // 1 data member. BOOST_TEST_EQ(ca.y.value, "cA"); - BOOST_TEST_EQ(ca.y.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(ca.y.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(ca.y.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(ca.y.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(ca.y.ctors(), ca.y.dtors() + 1); // 1 data member. BOOST_TEST_EQ(ca.t<'d'>::z.value, "dA"); - BOOST_TEST_EQ(ca.t<'d'>::z.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(ca.t<'d'>::z.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(ca.t<'d'>::z.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(ca.t<'d'>::z.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(ca.t<'d'>::z.ctors(), ca.t<'d'>::z.dtors() + 1); // 1 member. BOOST_TEST_EQ(ca.t<'e'>::z.value, "eA"); - BOOST_TEST_EQ(ca.t<'e'>::z.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(ca.t<'e'>::z.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(ca.t<'e'>::z.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(ca.t<'e'>::z.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(ca.t<'e'>::z.ctors(), ca.t<'e'>::z.dtors() + 1); // 1 member. - #undef BOOST_CONTRACT_TEST_post + #undef BOOST_CONTRACT_TEST_old return boost::report_errors(); } diff --git a/test/public_function/virtual_access.cpp b/test/public_function/virtual_access.cpp index cea1b2b..b7fe19e 100644 --- a/test/public_function/virtual_access.cpp +++ b/test/public_function/virtual_access.cpp @@ -118,7 +118,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "b::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::f::old" << std::endl #endif << "b::f::body" << std::endl @@ -132,7 +133,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "b::g::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::g::old" << std::endl #endif << "b::g::body" << std::endl @@ -143,7 +145,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "b::h::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::h::old" << std::endl #endif << "b::h::body" << std::endl @@ -164,7 +167,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "b::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "b::f::old" << std::endl << "a::f::old" << std::endl #endif @@ -185,7 +189,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "a::g::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::g::old" << std::endl #endif << "a::g::body" << std::endl @@ -202,7 +207,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "a::h::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "a::h::old" << std::endl #endif << "a::h::body" << std::endl diff --git a/test/public_function/virtual_branch.cpp b/test/public_function/virtual_branch.cpp index 9df7c63..5bfcb2f 100644 --- a/test/public_function/virtual_branch.cpp +++ b/test/public_function/virtual_branch.cpp @@ -32,7 +32,8 @@ int main() { << "e::f::pre" << std::endl << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "d::f::old" << std::endl << "e::f::old" << std::endl << "c::f::old" << std::endl @@ -57,41 +58,35 @@ int main() { ; BOOST_TEST(out.eq(ok.str())); - #ifdef BOOST_CONTRACT_NO_POSTCONDITIONS - #define BOOST_CONTRACT_TEST_post 0 + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) + #define BOOST_CONTRACT_TEST_old 1u #else - #define BOOST_CONTRACT_TEST_post 1 + #define BOOST_CONTRACT_TEST_old 0u #endif BOOST_TEST_EQ(r.value, "C"); BOOST_TEST_EQ(s.value, "cde"); - BOOST_TEST_EQ(s.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 3u, 0u)); - BOOST_TEST_EQ(s.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 3u, 0u)); + BOOST_TEST_EQ(s.copies(), BOOST_CONTRACT_TEST_old * 3); + BOOST_TEST_EQ(s.evals(), BOOST_CONTRACT_TEST_old * 3); BOOST_TEST_EQ(s.ctors(), s.dtors() + 1); // 1 local var. BOOST_TEST_EQ(cc.y.value, "cC"); - BOOST_TEST_EQ(cc.y.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(cc.y.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(cc.y.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(cc.y.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(cc.y.ctors(), cc.y.dtors() + 1); // 1 data member. BOOST_TEST_EQ(cc.t<'d'>::z.value, "dC"); - BOOST_TEST_EQ(cc.t<'d'>::z.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(cc.t<'d'>::z.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(cc.t<'d'>::z.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(cc.t<'d'>::z.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(cc.t<'d'>::z.ctors(), cc.t<'d'>::z.dtors() + 1); // 1 member. BOOST_TEST_EQ(cc.t<'e'>::z.value, "eC"); - BOOST_TEST_EQ(cc.t<'e'>::z.copies(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); - BOOST_TEST_EQ(cc.t<'e'>::z.evals(), - BOOST_PP_IIF(BOOST_CONTRACT_TEST_post, 1u, 0u)); + BOOST_TEST_EQ(cc.t<'e'>::z.copies(), BOOST_CONTRACT_TEST_old); + BOOST_TEST_EQ(cc.t<'e'>::z.evals(), BOOST_CONTRACT_TEST_old); BOOST_TEST_EQ(cc.t<'e'>::z.ctors(), cc.t<'e'>::z.dtors() + 1); // 1 member. + #undef BOOST_CONTRACT_TEST_old return boost::report_errors(); } diff --git a/test/public_function/virtual_sparse.cpp b/test/public_function/virtual_sparse.cpp index ab14b33..af6828a 100644 --- a/test/public_function/virtual_sparse.cpp +++ b/test/public_function/virtual_sparse.cpp @@ -201,7 +201,8 @@ int main() { << "h::f::pre" << std::endl << "a::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl << "i::f::old" << std::endl << "e::f::old" << std::endl @@ -252,7 +253,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "c::f::old" << std::endl #endif << "c::f::body" << std::endl @@ -278,7 +280,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "i::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "i::f::old" << std::endl #endif << "i::f::body" << std::endl @@ -307,7 +310,8 @@ int main() { << "i::f::pre" << std::endl << "e::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "i::f::old" << std::endl << "e::f::old" << std::endl #endif @@ -338,7 +342,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "i::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "i::f::old" << std::endl #endif << "i::f::body" << std::endl @@ -367,7 +372,8 @@ int main() { << "j::f::pre" << std::endl << "h::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "j::f::old" << std::endl << "h::f::old" << std::endl #endif @@ -398,7 +404,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "j::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "j::f::old" << std::endl #endif << "j::f::body" << std::endl diff --git a/test/result/mixed_optional.hpp b/test/result/mixed_optional.hpp index 9c8dca1..638da4b 100644 --- a/test/result/mixed_optional.hpp +++ b/test/result/mixed_optional.hpp @@ -239,7 +239,8 @@ int main() { << "b::f::pre" << std::endl << "a::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "d::f::old" << std::endl << "c::f::old" << std::endl << "b::f::old" << std::endl @@ -289,7 +290,8 @@ int main() { << "c::f::pre" << std::endl << "b::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "d::f::old" << std::endl << "c::f::old" << std::endl << "b::f::old" << std::endl @@ -331,7 +333,8 @@ int main() { << "d::f::pre" << std::endl << "c::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "d::f::old" << std::endl << "c::f::old" << std::endl #endif @@ -374,7 +377,8 @@ int main() { << "b::f::pre" << std::endl << "e::f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "d::f::old" << std::endl << "c::f::old" << std::endl << "b::f::old" << std::endl diff --git a/test/specify/old.cpp b/test/specify/old.cpp index 25d6db5..b1e8b5e 100644 --- a/test/specify/old.cpp +++ b/test/specify/old.cpp @@ -27,7 +27,8 @@ int main() { out.str(""); f(); ok.str(""); ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "f::old" << std::endl #endif << "f::body" << std::endl diff --git a/test/specify/old_except.cpp b/test/specify/old_except.cpp index c2bf032..d5eea77 100644 --- a/test/specify/old_except.cpp +++ b/test/specify/old_except.cpp @@ -29,7 +29,8 @@ int main() { f(); ok.str(""); ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "f::old" << std::endl #endif << "f::body" << std::endl diff --git a/test/specify/old_post.cpp b/test/specify/old_post.cpp index 98f4048..2f9c722 100644 --- a/test/specify/old_post.cpp +++ b/test/specify/old_post.cpp @@ -29,7 +29,8 @@ int main() { f(); ok.str(""); ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "f::old" << std::endl #endif << "f::body" << std::endl diff --git a/test/specify/old_post_except.cpp b/test/specify/old_post_except.cpp index 6051512..90a4de8 100644 --- a/test/specify/old_post_except.cpp +++ b/test/specify/old_post_except.cpp @@ -30,7 +30,8 @@ int main() { f(); ok.str(""); ok - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "f::old" << std::endl #endif << "f::body" << std::endl diff --git a/test/specify/pre_old.cpp b/test/specify/pre_old.cpp index de9f169..1c23a57 100644 --- a/test/specify/pre_old.cpp +++ b/test/specify/pre_old.cpp @@ -32,7 +32,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "f::old" << std::endl #endif << "f::body" << std::endl diff --git a/test/specify/pre_old_except.cpp b/test/specify/pre_old_except.cpp index 7887cb5..0a76dd5 100644 --- a/test/specify/pre_old_except.cpp +++ b/test/specify/pre_old_except.cpp @@ -33,7 +33,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "f::old" << std::endl #endif << "f::body" << std::endl diff --git a/test/specify/pre_old_post.cpp b/test/specify/pre_old_post.cpp index 9f71d10..9d1159e 100644 --- a/test/specify/pre_old_post.cpp +++ b/test/specify/pre_old_post.cpp @@ -33,7 +33,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "f::old" << std::endl #endif << "f::body" << std::endl diff --git a/test/specify/pre_old_post_except.cpp b/test/specify/pre_old_post_except.cpp index 52aeaeb..f57abe5 100644 --- a/test/specify/pre_old_post_except.cpp +++ b/test/specify/pre_old_post_except.cpp @@ -34,7 +34,8 @@ int main() { #ifndef BOOST_CONTRACT_NO_PRECONDITIONS << "f::pre" << std::endl #endif - #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS + #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \ + !defined(BOOST_CONTRACT_NO_EXCEPTS) << "f::old" << std::endl #endif << "f::body" << std::endl