summaryrefslogtreecommitdiff
path: root/src/cppunit
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-11 05:01:54 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-11 05:01:54 +0000
commit6943d47a76445bbfebc99859ed38698760354642 (patch)
treeffe6390ed4d606edb9539e255232cbe95c79d2ce /src/cppunit
parent85aa074c02154107459755b2a3ddbc0b5767558a (diff)
downloadcppunit-6943d47a76445bbfebc99859ed38698760354642.tar.gz
added missing files
Diffstat (limited to 'src/cppunit')
-rw-r--r--src/cppunit/AdditionalMessage.cpp42
-rw-r--r--src/cppunit/Exception.cpp2
-rw-r--r--src/cppunit/Test.cpp23
3 files changed, 56 insertions, 11 deletions
diff --git a/src/cppunit/AdditionalMessage.cpp b/src/cppunit/AdditionalMessage.cpp
new file mode 100644
index 0000000..49f73c7
--- /dev/null
+++ b/src/cppunit/AdditionalMessage.cpp
@@ -0,0 +1,42 @@
+#include <cppunit/AdditionalMessage.h>
+
+
+namespace CppUnit
+{
+
+
+AdditionalMessage::AdditionalMessage()
+{
+}
+
+
+AdditionalMessage::AdditionalMessage( const std::string &detail1 )
+{
+ if ( !detail1.empty() )
+ addDetail( detail1 );
+}
+
+
+AdditionalMessage::AdditionalMessage( const char *detail1 )
+{
+ if ( detail1 && !std::string( detail1 ).empty() )
+ addDetail( std::string(detail1) );
+}
+
+
+AdditionalMessage::AdditionalMessage( const CppUnit::Message &other )
+ : SuperClass( other )
+{
+}
+
+
+AdditionalMessage &
+AdditionalMessage::operator =( const CppUnit::Message &other )
+{
+ SuperClass::operator =( other );
+
+ return *this;
+}
+
+
+} // namespace CppUnit
diff --git a/src/cppunit/Exception.cpp b/src/cppunit/Exception.cpp
index 871a40a..68d8e61 100644
--- a/src/cppunit/Exception.cpp
+++ b/src/cppunit/Exception.cpp
@@ -70,7 +70,7 @@ Exception::operator =( const Exception& other )
const char*
Exception::what() const throw()
{
- Exception *mutableThis = const_cast<Exception *>( this );
+ Exception *mutableThis = CPPUNIT_CONST_CAST( Exception *, this );
mutableThis->m_whatMessage = m_message.shortDescription() + "\n" +
m_message.details();
return m_whatMessage.c_str();
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 );
}