1 // (C) Copyright Gennadiy Rozental 2005-2008. 2 // Distributed under the Boost Software License, Version 1.0. 3 // (See accompanying file LICENSE_1_0.txt or copy at 4 // http://www.boost.org/LICENSE_1_0.txt) 5 6 // See http://www.boost.org/libs/test for the library home page. 7 // 8 // File : $RCSfile$ 9 // 10 // Version : $Revision$ 11 // 12 // Description : Facilities to perform interaction based testng of logged expectations 13 // *************************************************************************** 14 15 #ifndef BOOST_TEST_LOGGED_EXPECTATIONS_HPP_120905GER 16 #define BOOST_TEST_LOGGED_EXPECTATIONS_HPP_120905GER 17 18 // Boost.Test 19 #include <boost/test/detail/config.hpp> 20 #include <boost/test/detail/unit_test_parameters.hpp> 21 #include <boost/test/utils/callback.hpp> 22 23 #include <boost/test/detail/suppress_warnings.hpp> 24 25 //____________________________________________________________________________// 26 27 // ************************************************************************** // 28 // ************** BOOST_TEST_LOGGED_EXPECTATIONS ************** // 29 // ************************************************************************** // 30 31 #define BOOST_TEST_LOGGED_EXPECTATIONS( test_name ) \ 32 struct test_name : public BOOST_AUTO_TEST_CASE_FIXTURE \ 33 { void test_method(); }; \ 34 \ 35 static void BOOST_AUTO_TC_INVOKER( test_name )() \ 36 { \ 37 test_name t; \ 38 ::boost::itest::logged_expectations( \ 39 boost::bind( &test_name::test_method, t ), \ 40 BOOST_STRINGIZE(test_name) ".elog", \ 41 !::boost::unit_test::runtime_config::save_pattern() ); \ 42 } \ 43 \ 44 struct BOOST_AUTO_TC_UNIQUE_ID( test_name ) {}; \ 45 \ 46 BOOST_AUTO_TU_REGISTRAR( test_name )( \ 47 boost::unit_test::make_test_case( \ 48 &BOOST_AUTO_TC_INVOKER( test_name ), #test_name ), \ 49 boost::unit_test::ut_detail::auto_tc_exp_fail< \ 50 BOOST_AUTO_TC_UNIQUE_ID( test_name )>::instance()->value() ); \ 51 \ 52 void test_name::test_method() \ 53 /**/ 54 55 namespace boost { 56 57 namespace itest { 58 59 // ************************************************************************** // 60 // ************** logged expectations test ************** // 61 // ************************************************************************** // 62 63 void BOOST_TEST_DECL 64 logged_expectations( unit_test::callback0<> const& F, 65 unit_test::const_string log_file_name, 66 bool test_or_log = true ); 67 68 } // namespace itest 69 70 } // namespace boost 71 72 #include <boost/test/detail/enable_warnings.hpp> 73 74 #endif // BOOST_TEST_LOGGED_EXPECTATIONS_HPP_120905GER 75