libcopp  2.2.0
main.cpp
Go to the documentation of this file.
1 /*
2  * main.cpp
3  *
4  * Created on: 2014年3月11日
5  * Author: owent
6  *
7  * Released under the MIT license
8  */
9 
10 #include "frame/test_macros.h"
11 
12 #if defined(UTILS_TEST_MACRO_TEST_ENABLE_BOOST_TEST)
13 
14 # ifdef BOOST_TEST_ALTERNATIVE_INIT_API
15 bool init_unit_test() {
16 # else
17 boost::unit_test::test_suite *init_unit_test_suite(int argc, char *argv[]) {
18 # endif
19 
20  run_tests(argc, argv);
21 
22 # ifdef BOOST_TEST_ALTERNATIVE_INIT_API
23  return true;
24 # else
25  return 0;
26 # endif
27 }
28 
29 #endif
30 
31 #if !defined(UTILS_TEST_MACRO_TEST_ENABLE_BOOST_TEST) || defined(BOOST_TEST_DYN_LINK) || defined(BOOST_TEST_NO_MAIN)
32 
33 int main(int argc, char *argv[]) {
34 # ifdef UTILS_TEST_MACRO_TEST_ENABLE_GTEST
35  ::testing::InitGoogleTest(&argc, argv);
37  int ret = RUN_ALL_TESTS();
39  return ret;
40 # elif defined(UTILS_TEST_MACRO_TEST_ENABLE_BOOST_TEST)
41 // prototype for user's unit test init function
42 # ifdef BOOST_TEST_ALTERNATIVE_INIT_API
43  boost::unit_test::init_unit_test_func init_func = &init_unit_test;
44 # else
45  boost::unit_test::init_unit_test_func init_func = &init_unit_test_suite;
46 # endif
47 
49  int ret = ::boost::unit_test::unit_test_main(init_func, argc, argv);
51  return ret;
52 # else
53 
54  return run_tests(argc, argv);
55 # endif
56 }
57 
58 #endif
int main()
Definition: main.cpp:118
int run_event_on_exit()
int run_event_on_start()
int run_tests(int argc, char *argv[])