Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame^] | 1 | // (C) Copyright Gennadiy Rozental 2001-2008. |
| 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$ |
| 10 | // |
| 11 | // Version : $$Revision: 49312 $ |
| 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 <ndnboost/test/framework.hpp> |
| 21 | #include <ndnboost/test/test_tools.hpp> |
| 22 | #include <ndnboost/test/unit_test_suite.hpp> |
| 23 | |
| 24 | // Boost |
| 25 | #include <ndnboost/cstdlib.hpp> |
| 26 | |
| 27 | #include <ndnboost/test/detail/suppress_warnings.hpp> |
| 28 | |
| 29 | //____________________________________________________________________________// |
| 30 | |
| 31 | extern int test_main( int argc, char* argv[] ); // prototype for user's test_main() |
| 32 | |
| 33 | struct test_main_caller { |
| 34 | test_main_caller( int argc, char** argv ) : m_argc( argc ), m_argv( argv ) {} |
| 35 | |
| 36 | void operator()() { |
| 37 | int test_main_result = test_main( m_argc, m_argv ); |
| 38 | |
| 39 | // translate a test_main non-success return into a test error |
| 40 | BOOST_CHECK( test_main_result == 0 || test_main_result == ndnboost::exit_success ); |
| 41 | } |
| 42 | |
| 43 | private: |
| 44 | // Data members |
| 45 | int m_argc; |
| 46 | char** m_argv; |
| 47 | }; |
| 48 | |
| 49 | // ************************************************************************** // |
| 50 | // ************** test main ************** // |
| 51 | // ************************************************************************** // |
| 52 | |
| 53 | ::ndnboost::unit_test::test_suite* |
| 54 | init_unit_test_suite( int argc, char* argv[] ) { |
| 55 | using namespace ::ndnboost::unit_test; |
| 56 | |
| 57 | framework::master_test_suite().p_name.value = "Test Program"; |
| 58 | |
| 59 | framework::master_test_suite().add( BOOST_TEST_CASE( test_main_caller( argc, argv ) ) ); |
| 60 | |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | //____________________________________________________________________________// |
| 65 | |
| 66 | #include <ndnboost/test/detail/enable_warnings.hpp> |
| 67 | |
| 68 | #endif // BOOST_TEST_TEST_MAIN_IPP_012205GER |