1 2 // no #include guard 3 4 // Copyright (C) 2008-2018 Lorenzo Caminiti 5 // Distributed under the Boost Software License, Version 1.0 (see accompanying 6 // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). 7 // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html 8 9 #include <boost/contract/assert.hpp> 10 #include <boost/contract/core/exception.hpp> 11 #include <boost/detail/lightweight_test.hpp> 12 main()13int main() { 14 bool threw = false; 15 try { 16 #ifdef BOOST_CONTRACT_TEST_ERROR 17 BOOST_CONTRACT_ASSERT_AUDIT( 18 BOOST_CONTRACT_TEST_ERROR_expected_undeclared_identifier); 19 #else 20 BOOST_CONTRACT_ASSERT_AUDIT(false); 21 #endif 22 } catch(boost::contract::assertion_failure const&) { threw = true; } 23 24 #if defined(BOOST_CONTRACT_AUDITS) && !defined(BOOST_CONTRACT_NO_ALL) 25 BOOST_TEST(threw); 26 #else 27 BOOST_TEST(!threw); 28 #endif 29 30 return boost::report_errors(); 31 } 32 33