compiled contracts on/off for all destructor tests

This commit is contained in:
Lorenzo Caminiti
2016-01-05 18:30:20 -08:00
parent c927e7293c
commit 095d72ade4
20 changed files with 1616 additions and 1277 deletions

View File

@@ -80,28 +80,55 @@ int main() {
a aa;
out.str("");
}
BOOST_TEST(false);
} catch(b::err const&) {
#if BOOST_CONTRACT_POSTCONDITIONS
BOOST_TEST(false);
} catch(b::err const&) {
#endif
ok.str(""); ok
<< "a::static_inv" << std::endl
<< "a::inv" << std::endl
<< "a::dtor::old" << std::endl
#if BOOST_CONTRACT_ENTRY_INVARIANTS
<< "a::static_inv" << std::endl
<< "a::inv" << std::endl
#endif
#if BOOST_CONTRACT_POSTCONDITIONS
<< "a::dtor::old" << std::endl
#endif
<< "a::dtor::body" << std::endl
// Test a destructed (so only static_inv and post, but no inv).
<< "a::static_inv" << std::endl
<< "a::dtor::post" << std::endl
#if BOOST_CONTRACT_EXIT_INVARIANTS
// Test a destructed (so only static_inv and post, but no inv).
<< "a::static_inv" << std::endl
#endif
#if BOOST_CONTRACT_POSTCONDITIONS
<< "a::dtor::post" << std::endl
#endif
<< "b::static_inv" << std::endl
<< "b::inv" << std::endl
<< "b::dtor::old" << std::endl // Test this threw.
#if BOOST_CONTRACT_ENTRY_INVARIANTS
<< "b::static_inv" << std::endl
<< "b::inv" << std::endl
#endif
#if BOOST_CONTRACT_POSTCONDITIONS
<< "b::dtor::old" << std::endl // Test this threw.
#else
<< "b::dtor::body" << std::endl
#if BOOST_CONTRACT_EXIT_INVARIANTS
<< "b::static_inv" << std::endl
#endif
#endif
<< "c::static_inv" << std::endl
<< "c::inv" << std::endl
<< "c::dtor::old" << std::endl
#if BOOST_CONTRACT_ENTRY_INVARIANTS
<< "c::static_inv" << std::endl
<< "c::inv" << std::endl
#endif
#if BOOST_CONTRACT_POSTCONDITIONS
<< "c::dtor::old" << std::endl
#endif
<< "c::dtor::body" << std::endl
// Test c not destructed (so both static_inv and inv, but no post).
<< "c::static_inv" << std::endl
<< "c::inv" << std::endl
#if BOOST_CONTRACT_EXIT_INVARIANTS
<< "c::static_inv" << std::endl
#if BOOST_CONTRACT_POSTCONDITIONS
// Test c not destructed (so both static_inv and inv).
<< "c::inv" << std::endl
#endif
#endif
;
BOOST_TEST(out.eq(ok.str()));
} catch(...) { BOOST_TEST(false); }