Revision 565, 1.1 kB
(checked in by vbarta, 15 years ago)
|
using own error macros (basically copied from IT++, but never aborting)
|
Line | |
---|
1 | #include "Test.h" |
---|
2 | #include "TestReporterStdout.h" |
---|
3 | #include "UnitTest++.h" |
---|
4 | #include "bdmerror.h" |
---|
5 | #include "itpp_ext.h" |
---|
6 | #include <string.h> |
---|
7 | |
---|
8 | using namespace itpp; |
---|
9 | |
---|
10 | Array<const char *> selected_tests; |
---|
11 | |
---|
12 | bool is_selected_test( const UnitTest::Test *test ) { |
---|
13 | bdm_assert_debug ( test, "NULL test" ); |
---|
14 | |
---|
15 | if (!selected_tests.length()) { |
---|
16 | return true; |
---|
17 | } |
---|
18 | |
---|
19 | for (int i = 0; i < selected_tests.length(); ++i) { |
---|
20 | const char *n = test->m_details.testName; |
---|
21 | bdm_assert_debug ( n, "NULL test name" ); |
---|
22 | const char *sname = selected_tests(i); |
---|
23 | bdm_assert_debug ( sname, "NULL selected test name" ); |
---|
24 | if ( !strcmp ( n, sname ) ) { |
---|
25 | return true; |
---|
26 | } |
---|
27 | } |
---|
28 | |
---|
29 | return false; |
---|
30 | } |
---|
31 | |
---|
32 | int main ( int argc, char const *argv[] ) { |
---|
33 | if ( argc > 1 ) { |
---|
34 | selected_tests.set_length( argc - 1 ); |
---|
35 | const char **param = argv + 1; |
---|
36 | int i = 0; |
---|
37 | while ( *param ) { |
---|
38 | selected_tests ( i ) = *param; |
---|
39 | ++i; |
---|
40 | ++param; |
---|
41 | } |
---|
42 | } |
---|
43 | |
---|
44 | itpp::RNG_randomize(); |
---|
45 | |
---|
46 | UnitTest::TestReporterStdout reporter; |
---|
47 | UnitTest::TestRunner runner ( reporter ); |
---|
48 | return runner.RunTestsIf ( UnitTest::Test::GetTestList(), |
---|
49 | 0, |
---|
50 | is_selected_test, |
---|
51 | 0 ); |
---|
52 | } |
---|