File: only.tpl

package info (click to toggle)
scummvm 2.7.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 363,784 kB
  • sloc: cpp: 3,622,060; asm: 27,410; python: 10,528; sh: 10,241; xml: 6,752; java: 5,579; perl: 2,570; yacc: 1,635; javascript: 1,016; lex: 539; makefile: 398; ansic: 378; awk: 275; objc: 82; sed: 11; php: 1
file content (32 lines) | stat: -rw-r--r-- 1,025 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// -*- C++ -*-
#include <cxxtest/StdioPrinter.h>
#include <stdio.h>

int main( int argc, char *argv[] )
{
    if ( argc < 2 || argc > 3 ) {
        fprintf( stderr, "Usage: only <suite name> [<test name>]\n\n" );
        fprintf( stderr, "Available tests:\n" );
        CxxTest::RealWorldDescription wd;
        for ( CxxTest::SuiteDescription *sd = wd.firstSuite(); sd; sd = sd->next() )
            for ( CxxTest::TestDescription *td = sd->firstTest(); td; td = td->next() )
                fprintf( stderr, " - %s::%s()\n", sd->suiteName(), td->testName() );
        return 1;
    }

    const char *suiteName = argv[1];
    const char *testName = (argc > 2) ? argv[2] : 0;
    if ( !CxxTest::leaveOnly( suiteName, testName ) ) {
        if ( testName )
            fprintf( stderr, "Cannot find %s::%s()\n", argv[1], argv[2] );
        else
            fprintf( stderr, "Cannot find class %s\n", argv[1] );
        return 2;
    }
    
    return CxxTest::StdioPrinter().run();
}


// The CxxTest "world"
<CxxTest world>