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