void TestPath::insert( const TestPath &path, int index ) { int itemIndex = path.getTestCount() -1; while ( itemIndex >= 0 ) insert( path.getTestAt( itemIndex-- ), index ); }
void TestRunner::run( TestResult &controller, const std::string &testPath ) { TestPath path = m_suite->resolveTestPath( testPath ); Test *testToRun = path.getChildTest(); controller.runTest( testToRun ); }
Test * Test::findTest( const std::string &testName ) const { TestPath path; Test *mutableThis = CPPUNIT_CONST_CAST( Test *, this ); mutableThis->findTestPath( testName, path ); if ( !path.isValid() ) throw std::invalid_argument( "No test named <" + testName + "> found in test <" + getName() + ">." ); return path.getChildTest(); }
bool test() { bool t1, t2, t3, t4; TestFile tf; t1 = tf.test(); TestFileInfo tfi; t2 = tfi.test(); TestPath tp; t3 = tp.test(); TestDirectory td; t4 = td.test(); return t1 && t2 && t3; }
TestPath::TestPath( const TestPath &other, int indexFirst, int count ) { int countAdjustment = 0; if ( indexFirst < 0 ) { countAdjustment = indexFirst; indexFirst = 0; } if ( count < 0 ) count = other.getTestCount(); else count += countAdjustment; int index = indexFirst; while ( count-- > 0 && index < other.getTestCount() ) add( other.getTestAt( index++ ) ); }
void runTest() { suite_TestPath.test_ctor(); }
void TestPath::add( const TestPath &path ) { for ( int index =0; index < path.getTestCount(); ++index ) add( path.getTestAt( index ) ); }