1
#include <cppunit/Portability.h>
2
#include <cppunit/Test.h>
3
#include <cppunit/TestPath.h>
11
Test::getChildTestAt( int index ) const
13
checkIsValidIndex( index );
14
return doGetChildTestAt( index );
19
Test::findTest( const std::string &testName ) const
22
Test *mutableThis = CPPUNIT_CONST_CAST( Test *, this );
23
mutableThis->findTestPath( testName, path );
24
if ( !path.isValid() )
25
throw std::invalid_argument( "No test named <" + testName + "> found in test <"
27
return path.getChildTest();
32
Test::findTestPath( const std::string &testName,
33
TestPath &testPath ) const
35
Test *mutableThis = CPPUNIT_CONST_CAST( Test *, this );
36
if ( getName() == testName )
38
testPath.add( mutableThis );
42
int childCount = getChildTestCount();
43
for ( int childIndex =0; childIndex < childCount; ++childIndex )
45
if ( getChildTestAt( childIndex )->findTestPath( testName, testPath ) )
47
testPath.insert( mutableThis, 0 );
57
Test::findTestPath( const Test *test,
58
TestPath &testPath ) const
60
Test *mutableThis = CPPUNIT_CONST_CAST( Test *, this );
63
testPath.add( mutableThis );
67
int childCount = getChildTestCount();
68
for ( int childIndex =0; childIndex < childCount; ++childIndex )
70
if ( getChildTestAt( childIndex )->findTestPath( test, testPath ) )
72
testPath.insert( mutableThis, 0 );
82
Test::resolveTestPath( const std::string &testPath ) const
84
Test *mutableThis = CPPUNIT_CONST_CAST( Test *, this );
85
return TestPath( mutableThis, testPath );
90
Test::checkIsValidIndex( int index ) const
92
if ( index < 0 || index >= getChildTestCount() )
93
throw std::out_of_range( "Test::checkValidIndex(): invalid index" );