Code

moving trunk for module inkscape
[inkscape.git] / cxxtest / sample / only.tpl
1 // -*- C++ -*-
2 #include <cxxtest/StdioPrinter.h>
3 #include <stdio.h>
5 int main( int argc, char *argv[] )
6 {
7     if ( argc < 2 || argc > 3 ) {
8         fprintf( stderr, "Usage: only <suite name> [<test name>]\n\n" );
9         fprintf( stderr, "Available tests:\n" );
10         CxxTest::RealWorldDescription wd;
11         for ( CxxTest::SuiteDescription *sd = wd.firstSuite(); sd; sd = sd->next() )
12             for ( CxxTest::TestDescription *td = sd->firstTest(); td; td = td->next() )
13                 fprintf( stderr, " - %s::%s()\n", sd->suiteName(), td->testName() );
14         return 1;
15     }
17     const char *suiteName = argv[1];
18     const char *testName = (argc > 2) ? argv[2] : 0;
19     if ( !CxxTest::leaveOnly( suiteName, testName ) ) {
20         if ( testName )
21             fprintf( stderr, "Cannot find %s::%s()\n", argv[1], argv[2] );
22         else
23             fprintf( stderr, "Cannot find class %s\n", argv[1] );
24         return 2;
25     }
26     
27     return CxxTest::StdioPrinter().run();
28 }
31 // The CxxTest "world"
32 <CxxTest world>