Revision 1064, 1.5 kB
(checked in by mido, 14 years ago)
|
astyle applied all over the library
|
Line | |
---|
1 | #include "general_suite.h" |
---|
2 | |
---|
3 | namespace UnitTest { |
---|
4 | |
---|
5 | Array<const char *> selected_tests; |
---|
6 | |
---|
7 | bool is_selected_test ( const UnitTest::Test *test ) { |
---|
8 | bdm_assert_debug ( test, "NULL test" ); |
---|
9 | |
---|
10 | if ( !selected_tests.length() ) { |
---|
11 | return true; |
---|
12 | } |
---|
13 | |
---|
14 | for ( int i = 0; i < selected_tests.length(); ++i ) { |
---|
15 | const char *n = test->m_details.testName; |
---|
16 | bdm_assert_debug ( n, "NULL test name" ); |
---|
17 | const char *sname = selected_tests ( i ); |
---|
18 | bdm_assert_debug ( sname, "NULL selected test name" ); |
---|
19 | if ( !strcmp ( n, sname ) ) { |
---|
20 | return true; |
---|
21 | } |
---|
22 | } |
---|
23 | |
---|
24 | return false; |
---|
25 | } |
---|
26 | |
---|
27 | void print_test_list() { |
---|
28 | UnitTest::Test* curTest = UnitTest::Test::GetTestList().GetHead(); |
---|
29 | |
---|
30 | while ( curTest != 0 ) { |
---|
31 | const char *n = curTest->m_details.testName; |
---|
32 | printf ( "%s\n", n ); |
---|
33 | curTest = curTest->next; |
---|
34 | } |
---|
35 | } |
---|
36 | |
---|
37 | void pick_selected_tests ( int argc, char const *argv[] ) { |
---|
38 | selected_tests.set_length ( argc - 1 ); |
---|
39 | const char **param = argv + 1; |
---|
40 | int i = 0; |
---|
41 | while ( *param ) { |
---|
42 | selected_tests ( i ) = *param; |
---|
43 | ++i; |
---|
44 | ++param; |
---|
45 | } |
---|
46 | } |
---|
47 | |
---|
48 | int run_selected_tests() { |
---|
49 | itpp::RNG_randomize(); |
---|
50 | |
---|
51 | UnitTest::TestReporterStdout reporter; |
---|
52 | UnitTest::TestRunner runner ( reporter ); |
---|
53 | return runner.RunTestsIf ( UnitTest::Test::GetTestList(), |
---|
54 | 0, |
---|
55 | is_selected_test, |
---|
56 | 0 ); |
---|
57 | } |
---|
58 | |
---|
59 | } |
---|