diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-07-11 05:01:54 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-07-11 05:01:54 +0000 |
| commit | 6943d47a76445bbfebc99859ed38698760354642 (patch) | |
| tree | ffe6390ed4d606edb9539e255232cbe95c79d2ce /src/cppunit/Test.cpp | |
| parent | 85aa074c02154107459755b2a3ddbc0b5767558a (diff) | |
| download | cppunit-6943d47a76445bbfebc99859ed38698760354642.tar.gz | |
added missing files
Diffstat (limited to 'src/cppunit/Test.cpp')
| -rw-r--r-- | src/cppunit/Test.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/cppunit/Test.cpp b/src/cppunit/Test.cpp index b751bad..3069f57 100644 --- a/src/cppunit/Test.cpp +++ b/src/cppunit/Test.cpp @@ -18,8 +18,8 @@ Test * Test::findTest( const std::string &testName ) const { TestPath path; - // since path is discarded, it is really a const method. - const_cast<Test *>(this)->findTestPath( testName, 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() + ">." ); @@ -29,11 +29,12 @@ Test::findTest( const std::string &testName ) const bool Test::findTestPath( const std::string &testName, - TestPath &testPath ) + TestPath &testPath ) const { + Test *mutableThis = CPPUNIT_CONST_CAST( Test *, this ); if ( getName() == testName ) { - testPath.add( this ); + testPath.add( mutableThis ); return true; } @@ -42,7 +43,7 @@ Test::findTestPath( const std::string &testName, { if ( getChildTestAt( childIndex )->findTestPath( testName, testPath ) ) { - testPath.insert( this, 0 ); + testPath.insert( mutableThis, 0 ); return true; } } @@ -53,11 +54,12 @@ Test::findTestPath( const std::string &testName, bool Test::findTestPath( const Test *test, - TestPath &testPath ) + TestPath &testPath ) const { + Test *mutableThis = CPPUNIT_CONST_CAST( Test *, this ); if ( this == test ) { - testPath.add( this ); + testPath.add( mutableThis ); return true; } @@ -66,7 +68,7 @@ Test::findTestPath( const Test *test, { if ( getChildTestAt( childIndex )->findTestPath( test, testPath ) ) { - testPath.insert( this, 0 ); + testPath.insert( mutableThis, 0 ); return true; } } @@ -76,9 +78,10 @@ Test::findTestPath( const Test *test, TestPath -Test::resolveTestPath( const std::string &testPath ) +Test::resolveTestPath( const std::string &testPath ) const { - return TestPath( this, testPath ); + Test *mutableThis = CPPUNIT_CONST_CAST( Test *, this ); + return TestPath( mutableThis, testPath ); } |
