blob: 933183e2ba77b75145ff44c2a5818b8e2b2b31b2 [file] [log] [blame]
Jeff Thompsonef2d5a42013-08-22 19:09:24 -07001// (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
Jeff Thompson3d613fd2013-10-15 15:39:04 -070016#ifndef NDNBOOST_TEST_TEST_MAIN_IPP_012205GER
17#define NDNBOOST_TEST_TEST_MAIN_IPP_012205GER
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070018
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
31extern int test_main( int argc, char* argv[] ); // prototype for user's test_main()
32
33struct 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
Jeff Thompson3d613fd2013-10-15 15:39:04 -070040 NDNBOOST_CHECK( test_main_result == 0 || test_main_result == ndnboost::exit_success );
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070041 }
42
43private:
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*
54init_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
Jeff Thompson3d613fd2013-10-15 15:39:04 -070059 framework::master_test_suite().add( NDNBOOST_TEST_CASE( test_main_caller( argc, argv ) ) );
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070060
61 return 0;
62}
63
64//____________________________________________________________________________//
65
66#include <ndnboost/test/detail/enable_warnings.hpp>
67
Jeff Thompson3d613fd2013-10-15 15:39:04 -070068#endif // NDNBOOST_TEST_TEST_MAIN_IPP_012205GER