#include #if !BOOST_PP_VARIADICS # error "this compiler does not support variadic macros" #else #include #define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_AUX_INDEX_TEST \ BOOST_CONTRACT_EXT_PP_TRAITS_AUX_INDEX_FUNC_POSTCONDITIONS #include "../aux_/pp_traits.hpp" #include "../aux_/pp_assertions.hpp" #include #include #include #include #include #include #include #include #define BOOST_CONTRACT_TEST_POSTCONDITIONS_(f) \ BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_IS_EMPTY( \ BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITIONS(f)), \ () BOOST_PP_TUPLE_EAT(3) \ , \ BOOST_PP_SEQ_FOLD_LEFT \ )(BOOST_CONTRACT_TEST_AUX_PP_POST_ASSERTIONS_S_1, (), \ BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_POSTCONDITIONS(f)) #define BOOST_CONTRACT_TEST_EQUAL_(postconditions, parsed_postconditions) \ BOOST_CONTRACT_TEST_AUX_PP_TRAITS( \ BOOST_CONTRACT_TEST_POSTCONDITIONS_, \ BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_PARSE_D, \ (std::map&) (f) ( ) throw(int, double) override final, \ BOOST_PP_EXPR_IIF(BOOST_PP_COMPL( \ BOOST_CONTRACT_EXT_PP_IS_EMPTY(postconditions)), \ postcondition \ ) \ postconditions, \ BOOST_PP_EMPTY(), \ parsed_postconditions \ ) #define BOOST_CONTRACT_TEST_(postconditions) \ BOOST_CONTRACT_TEST_EQUAL_(postconditions, postconditions) #define oldof BOOST_CONTRACT_OLDOF int main ( ) { #define BOOST_CONTRACT_TEST_ASSERTIONS_equal BOOST_CONTRACT_TEST_EQUAL_ #define BOOST_CONTRACT_TEST_ASSERTIONS_check BOOST_CONTRACT_TEST_ #define BOOST_CONTRACT_TEST_ASSERTIONS_post \ auto result1 = return, \ int const result2 = return, \ (map const&) result3 = return, \ \ auto old_size = BOOST_CONTRACT_OLDOF v.size(), \ unsigned int const old_capacity = oldof v.capacity(), \ (map const) old_map = \ BOOST_CONTRACT_OLDOF (map::clone(m)), #define BOOST_CONTRACT_TEST_ASSERTIONS_post_if \ auto c = return, \ long long const d = BOOST_CONTRACT_OLDOF v.size(), #include "./assertions.hpp" // Include actual assertion tests. #undef BOOST_CONTRACT_TEST_ASSERTIONS_equal #undef BOOST_CONTRACT_TEST_ASSERTIONS_check #undef BOOST_CONTRACT_TEST_ASSERTIONS_post #undef BOOST_CONTRACT_TEST_ASSERTIONS_post_if return BOOST_CONTRACT_TEST_AUX_PP_TRAITS_REPORT_ERRORS; } #endif // variadics