Revision 565, 1.1 kB
(checked in by vbarta, 15 years ago)
|
using own error macros (basically copied from IT++, but never aborting)
|
Rev | Line | |
---|
[496] | 1 | #include "Test.h" |
---|
| 2 | #include "TestReporterStdout.h" |
---|
[418] | 3 | #include "UnitTest++.h" |
---|
[565] | 4 | #include "bdmerror.h" |
---|
[452] | 5 | #include "itpp_ext.h" |
---|
[565] | 6 | #include <string.h> |
---|
[418] | 7 | |
---|
[496] | 8 | using namespace itpp; |
---|
| 9 | |
---|
| 10 | Array<const char *> selected_tests; |
---|
| 11 | |
---|
| 12 | bool is_selected_test( const UnitTest::Test *test ) { |
---|
[565] | 13 | bdm_assert_debug ( test, "NULL test" ); |
---|
[496] | 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; |
---|
[565] | 21 | bdm_assert_debug ( n, "NULL test name" ); |
---|
[496] | 22 | const char *sname = selected_tests(i); |
---|
[565] | 23 | bdm_assert_debug ( sname, "NULL selected test name" ); |
---|
[496] | 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 | |
---|
[477] | 44 | itpp::RNG_randomize(); |
---|
[496] | 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 ); |
---|
[418] | 52 | } |
---|