• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//  (C) Copyright Gennadiy Rozental 2001.
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
10/// @brief Implements main function for Test Execution Monitor.
11// ***************************************************************************
12
13#ifndef BOOST_TEST_TEST_MAIN_IPP_012205GER
14#define BOOST_TEST_TEST_MAIN_IPP_012205GER
15
16// Boost.Test
17#include <boost/test/framework.hpp>
18#include <boost/test/test_tools.hpp>
19#include <boost/test/unit_test_suite.hpp>
20
21// Boost
22#include <boost/cstdlib.hpp>
23
24#include <boost/test/detail/suppress_warnings.hpp>
25
26//____________________________________________________________________________//
27
28extern int test_main( int argc, char* argv[] );    // prototype for user's test_main()
29
30struct test_main_caller {
31    test_main_caller( int argc, char** argv ) : m_argc( argc ), m_argv( argv ) {}
32
33    void operator()() {
34        int test_main_result = test_main( m_argc, m_argv );
35
36        // translate a test_main non-success return into a test error
37        BOOST_CHECK( test_main_result == 0 || test_main_result == boost::exit_success );
38    }
39
40private:
41    // Data members
42    int      m_argc;
43    char**   m_argv;
44};
45
46// ************************************************************************** //
47// **************                   test main                  ************** //
48// ************************************************************************** //
49
50::boost::unit_test::test_suite*
51init_unit_test_suite( int argc, char* argv[] ) {
52    using namespace ::boost::unit_test;
53
54    framework::master_test_suite().p_name.value = "Test Program";
55
56    framework::master_test_suite().add( BOOST_TEST_CASE( test_main_caller( argc, argv ) ) );
57
58    return 0;
59}
60
61//____________________________________________________________________________//
62
63#include <boost/test/detail/enable_warnings.hpp>
64
65#endif // BOOST_TEST_TEST_MAIN_IPP_012205GER
66