1 | // (C) Copyright Gennadiy Rozental 2001-2005. |
---|
2 | // (C) Copyright Beman Dawes 1995-2001. |
---|
3 | // Distributed under the Boost Software License, Version 1.0. |
---|
4 | // (See accompanying file LICENSE_1_0.txt or copy at |
---|
5 | // http://www.boost.org/LICENSE_1_0.txt) |
---|
6 | |
---|
7 | // See http://www.boost.org/libs/test for the library home page. |
---|
8 | // |
---|
9 | // File : $RCSfile: test_main.ipp,v $ |
---|
10 | // |
---|
11 | // Version : $$Revision: 1.6 $ |
---|
12 | // |
---|
13 | // Description : implements main function for Test Execution Monitor. |
---|
14 | // *************************************************************************** |
---|
15 | |
---|
16 | #ifndef BOOST_TEST_TEST_MAIN_IPP_012205GER |
---|
17 | #define BOOST_TEST_TEST_MAIN_IPP_012205GER |
---|
18 | |
---|
19 | // Boost.Test |
---|
20 | #include <boost/test/unit_test_suite.hpp> |
---|
21 | #include <boost/test/test_tools.hpp> |
---|
22 | |
---|
23 | // Boost |
---|
24 | #include <boost/cstdlib.hpp> |
---|
25 | |
---|
26 | #include <boost/test/detail/suppress_warnings.hpp> |
---|
27 | |
---|
28 | //____________________________________________________________________________// |
---|
29 | |
---|
30 | extern int test_main( int argc, char* argv[] ); // prototype for user's test_main() |
---|
31 | |
---|
32 | struct test_main_caller { |
---|
33 | test_main_caller( int argc, char** argv ) : m_argc( argc ), m_argv( argv ) {} |
---|
34 | |
---|
35 | void operator()() { |
---|
36 | int test_main_result = test_main( m_argc, m_argv ); |
---|
37 | |
---|
38 | // translate a test_main non-success return into a test error |
---|
39 | BOOST_CHECK( test_main_result == 0 || test_main_result == boost::exit_success ); |
---|
40 | } |
---|
41 | |
---|
42 | private: |
---|
43 | // Data members |
---|
44 | int m_argc; |
---|
45 | char** m_argv; |
---|
46 | }; |
---|
47 | |
---|
48 | // ************************************************************************** // |
---|
49 | // ************** test main ************** // |
---|
50 | // ************************************************************************** // |
---|
51 | |
---|
52 | ::boost::unit_test::test_suite* |
---|
53 | init_unit_test_suite( int argc, char* argv[] ) { |
---|
54 | using namespace ::boost::unit_test; |
---|
55 | |
---|
56 | test_suite* test = BOOST_TEST_SUITE( "Test Program" ); |
---|
57 | |
---|
58 | test->add( BOOST_TEST_CASE( test_main_caller( argc, argv ) ) ); |
---|
59 | |
---|
60 | return test; |
---|
61 | } |
---|
62 | |
---|
63 | //____________________________________________________________________________// |
---|
64 | |
---|
65 | #include <boost/test/detail/enable_warnings.hpp> |
---|
66 | |
---|
67 | // *************************************************************************** |
---|
68 | // Revision History : |
---|
69 | // |
---|
70 | // $Log: test_main.ipp,v $ |
---|
71 | // Revision 1.6 2005/02/20 08:27:07 rogeeff |
---|
72 | // This a major update for Boost.Test framework. See release docs for complete list of fixes/updates |
---|
73 | // |
---|
74 | // *************************************************************************** |
---|
75 | |
---|
76 | #endif // BOOST_TEST_TEST_MAIN_IPP_012205GER |
---|