libcopp  1.1.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 
32 #if !defined(UTILS_TEST_MACRO_TEST_ENABLE_BOOST_TEST) || defined(BOOST_TEST_DYN_LINK) || defined(BOOST_TEST_NO_MAIN)
33 
34 int main(int argc, char *argv[]) {
35 
36 #ifdef UTILS_TEST_MACRO_TEST_ENABLE_GTEST
37  ::testing::InitGoogleTest(&argc, argv);
38  return RUN_ALL_TESTS();
39 
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 
48  return ::boost::unit_test::unit_test_main(init_func, argc, argv);
49 
50 #else
51 
52  return run_tests(argc, argv);
53 #endif
54 }
55 
56 #endif
int run_tests(int argc, char *argv[])
int main(int argc, char *argv[])
Definition: main.cpp:34