* fix gcc4 build of cppunit library by explicitly spelling out std:: in

the headers and importing the required classes in the implementation files
* automatic whitespace cleanup

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30586 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe
2009-05-02 19:04:52 +00:00
parent 226136446a
commit 58481f0f6e
50 changed files with 683 additions and 605 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
//! Base class for single threaded unit tests //! Base class for single threaded unit tests
class CPPUNIT_API BTestCase : public CppUnit::TestCase { class CPPUNIT_API BTestCase : public CppUnit::TestCase {
public: public:
BTestCase(string Name = ""); BTestCase(std::string Name = "");
//! Displays the next sub test progress indicator (i.e. [0][1][2][3]...). //! Displays the next sub test progress indicator (i.e. [0][1][2][3]...).
virtual void NextSubTest(); virtual void NextSubTest();
+5 -3
View File
@@ -4,9 +4,11 @@
#include <cppunit/TestListener.h> #include <cppunit/TestListener.h>
#include <SupportDefs.h> #include <SupportDefs.h>
class CppUnit::Test; namespace CppUnit {
class CppUnit::TestFailure; class Test;
class CppUnit::Exception; class TestFailure;
class Exception;
}
//! Handles printing of test information //! Handles printing of test information
/*! Receives notification of the beginning and end of each test, /*! Receives notification of the beginning and end of each test,
+9 -9
View File
@@ -48,7 +48,7 @@ typedef CppUnit::SynchronizedObject::SynchronizationObject SyncObject;
*/ */
class CPPUNIT_API BTestShell { class CPPUNIT_API BTestShell {
public: public:
BTestShell(const string &description = "", SyncObject *syncObject = 0); BTestShell(const std::string &description = "", SyncObject *syncObject = 0);
virtual ~BTestShell(); virtual ~BTestShell();
// This function is used to add the tests for a given kit (as contained // This function is used to add the tests for a given kit (as contained
@@ -64,7 +64,7 @@ public:
// when the program is run with "--list" as an argument. Usually the // when the program is run with "--list" as an argument. Usually the
// given suite would be a test suite for an entire class, but that's // given suite would be a test suite for an entire class, but that's
// not a requirement. // not a requirement.
void AddTest(const string &name, CppUnit::Test* test); void AddTest(const std::string &name, CppUnit::Test* test);
// This function loads all the test addons it finds in the given // This function loads all the test addons it finds in the given
// directory, returning the number of tests actually loaded. // directory, returning the number of tests actually loaded.
@@ -104,18 +104,18 @@ public:
bool WasDebuggerCalled(); bool WasDebuggerCalled();
protected: protected:
typedef map<string, CppUnit::Test*> TestMap; typedef std::map<std::string, CppUnit::Test*> TestMap;
typedef map<string, BTestSuite*> SuiteMap; typedef std::map<std::string, BTestSuite*> SuiteMap;
VerbosityLevel fVerbosityLevel; VerbosityLevel fVerbosityLevel;
set<string> fTestsToRun; std::set<std::string> fTestsToRun;
set<string> fSuitesToRun; std::set<std::string> fSuitesToRun;
TestMap fTests; TestMap fTests;
SuiteMap fSuites; SuiteMap fSuites;
set<string> fLibDirs; std::set<std::string> fLibDirs;
CppUnit::TestResult fTestResults; CppUnit::TestResult fTestResults;
CppUnit::TestResultCollector fResultsCollector; CppUnit::TestResultCollector fResultsCollector;
string fDescription; std::string fDescription;
static BTestShell* fGlobalShell; static BTestShell* fGlobalShell;
static const char indent[]; static const char indent[];
bool fListTestsAndExit; bool fListTestsAndExit;
@@ -150,7 +150,7 @@ protected:
bool ProcessArguments(int argc, char *argv[]); bool ProcessArguments(int argc, char *argv[]);
//! Processes a single argument, given by the \c arg parameter. //! Processes a single argument, given by the \c arg parameter.
virtual bool ProcessArgument(string arg, int argc, char *argv[]); virtual bool ProcessArgument(std::string arg, int argc, char *argv[]);
//! Makes any necessary pre-test preparations //! Makes any necessary pre-test preparations
void InitOutput(); void InitOutput();
+10 -8
View File
@@ -6,27 +6,29 @@
#include <map> #include <map>
#include <string> #include <string>
class CppUnit::TestResult; namespace CppUnit {
class TestResult;
}
//! Groups together a set of tests for a given kit. //! Groups together a set of tests for a given kit.
class CPPUNIT_API BTestSuite : public CppUnit::Test { class CPPUNIT_API BTestSuite : public CppUnit::Test {
public: public:
BTestSuite( string name = "" ); BTestSuite(std::string name = "");
virtual ~BTestSuite(); virtual ~BTestSuite();
virtual void run(CppUnit::TestResult *result); virtual void run(CppUnit::TestResult *result);
virtual int countTestCases() const; virtual int countTestCases() const;
virtual string getName() const; virtual std::string getName() const;
virtual string toString() const; virtual std::string toString() const;
virtual void addTest(string name, CppUnit::Test *test); virtual void addTest(std::string name, CppUnit::Test *test);
virtual void deleteContents(); virtual void deleteContents();
const map<string, CppUnit::Test*> &getTests() const; const std::map<std::string, CppUnit::Test*> &getTests() const;
protected: protected:
map<string, CppUnit::Test*> fTests; std::map<std::string, CppUnit::Test*> fTests;
const string fName; const std::string fName;
private: private:
BTestSuite(const BTestSuite &other); BTestSuite(const BTestSuite &other);
+1 -1
View File
@@ -28,7 +28,7 @@ Equals(const A &a, const B &b, const C &c)
} }
// Returns a string version of the given integer // Returns a string version of the given integer
extern CPPUNIT_API string IntToStr(int i); extern CPPUNIT_API std::string IntToStr(int i);
// Calls system() with the concatenated string of command and parameter. // Calls system() with the concatenated string of command and parameter.
extern CPPUNIT_API void ExecCommand(const char *command, const char *parameter); extern CPPUNIT_API void ExecCommand(const char *command, const char *parameter);
+2 -2
View File
@@ -79,7 +79,7 @@ template <class TestClass, class ExpectedException>
BThreadedTestCaller<TestClass, ExpectedException>::~BThreadedTestCaller() { BThreadedTestCaller<TestClass, ExpectedException>::~BThreadedTestCaller() {
if (fOwnObject) if (fOwnObject)
delete fObject; delete fObject;
for (ThreadManagerMap::iterator it = fThreads.begin(); it != fThreads.end (); ++it) { for (typename ThreadManagerMap::iterator it = fThreads.begin(); it != fThreads.end (); ++it) {
delete it->second; delete it->second;
} }
} }
@@ -137,7 +137,7 @@ BThreadedTestCaller<TestClass, ExpectedException>::run(CppUnit::TestResult *resu
throw CppUnit::Exception("BThreadedTestCaller::run() -- Error creating fThreadSem"); throw CppUnit::Exception("BThreadedTestCaller::run() -- Error creating fThreadSem");
// Launch all the threads. // Launch all the threads.
for (ThreadManagerMap::iterator i = fThreads.begin(); for (typename ThreadManagerMap::iterator i = fThreads.begin();
i != fThreads.end (); i != fThreads.end ();
++i) ++i)
{ {
+7 -7
View File
@@ -11,7 +11,7 @@
//! Base class for single threaded unit tests //! Base class for single threaded unit tests
class CPPUNIT_API BThreadedTestCase : public BTestCase { class CPPUNIT_API BThreadedTestCase : public BTestCase {
public: public:
BThreadedTestCase(string Name = "", string progressSeparator = "."); BThreadedTestCase(std::string Name = "", std::string progressSeparator = ".");
virtual ~BThreadedTestCase(); virtual ~BThreadedTestCase();
/*! \brief Displays the next sub test progress indicator for the /*! \brief Displays the next sub test progress indicator for the
@@ -33,24 +33,24 @@ public:
//! Restores the current working directory to last directory saved by a call to SaveCWD(). //! Restores the current working directory to last directory saved by a call to SaveCWD().
void RestoreCWD(const char *alternate = NULL); void RestoreCWD(const char *alternate = NULL);
void InitThreadInfo(thread_id id, string threadName); void InitThreadInfo(thread_id id, std::string threadName);
bool RegisterForUse(); bool RegisterForUse();
void UnregisterForUse(); void UnregisterForUse();
vector<string>& AcquireUpdateList(); std::vector<std::string>& AcquireUpdateList();
void ReleaseUpdateList(); void ReleaseUpdateList();
protected: protected:
bool fInUse; bool fInUse;
// friend class ThreadManager<BThreadedTestCase>; // friend class ThreadManager<BThreadedTestCase>;
string fProgressSeparator; std::string fProgressSeparator;
struct ThreadSubTestInfo { struct ThreadSubTestInfo {
string name; std::string name;
int32 subTestNum; int32 subTestNum;
}; };
map<thread_id, ThreadSubTestInfo*> fNumberMap; std::map<thread_id, ThreadSubTestInfo*> fNumberMap;
vector<string> fUpdateList; std::vector<std::string> fUpdateList;
BLocker *fUpdateLock; BLocker *fUpdateLock;
}; };
+8 -8
View File
@@ -44,7 +44,7 @@ namespace Asserter
/*! Throws a Exception with the specified message and location. /*! Throws a Exception with the specified message and location.
*/ */
void CPPUNIT_API fail( string message, void CPPUNIT_API fail( std::string message,
SourceLine sourceLine = SourceLine() ); SourceLine sourceLine = SourceLine() );
/*! Throws a Exception with the specified message and location. /*! Throws a Exception with the specified message and location.
@@ -54,7 +54,7 @@ namespace Asserter
* \param sourceLine Location of the assertion. * \param sourceLine Location of the assertion.
*/ */
void CPPUNIT_API failIf( bool shouldFail, void CPPUNIT_API failIf( bool shouldFail,
string message, std::string message,
SourceLine sourceLine = SourceLine() ); SourceLine sourceLine = SourceLine() );
/*! Throws a NotEqualException with the specified message and location. /*! Throws a NotEqualException with the specified message and location.
@@ -64,10 +64,10 @@ namespace Asserter
* where the "difference" is located. * where the "difference" is located.
* \param sourceLine Location of the assertion. * \param sourceLine Location of the assertion.
*/ */
void CPPUNIT_API failNotEqual( string expected, void CPPUNIT_API failNotEqual( std::string expected,
string actual, std::string actual,
SourceLine sourceLine = SourceLine(), SourceLine sourceLine = SourceLine(),
string additionalMessage ="" ); std::string additionalMessage ="" );
/*! Throws a NotEqualException with the specified message and location. /*! Throws a NotEqualException with the specified message and location.
* \param shouldFail if \c true then the exception is thrown. Otherwise * \param shouldFail if \c true then the exception is thrown. Otherwise
@@ -79,10 +79,10 @@ namespace Asserter
* \param sourceLine Location of the assertion. * \param sourceLine Location of the assertion.
*/ */
void CPPUNIT_API failNotEqualIf( bool shouldFail, void CPPUNIT_API failNotEqualIf( bool shouldFail,
string expected, std::string expected,
string actual, std::string actual,
SourceLine sourceLine = SourceLine(), SourceLine sourceLine = SourceLine(),
string additionalMessage ="" ); std::string additionalMessage ="" );
} // namespace Asserter } // namespace Asserter
} // namespace CppUnit } // namespace CppUnit
@@ -61,7 +61,7 @@ public:
/*! Constructs a CompilerOutputter object. /*! Constructs a CompilerOutputter object.
*/ */
CompilerOutputter( TestResultCollector *result, CompilerOutputter( TestResultCollector *result,
ostream &stream ); std::ostream &stream );
/// Destructor. /// Destructor.
virtual ~CompilerOutputter(); virtual ~CompilerOutputter();
@@ -69,7 +69,7 @@ public:
/*! Creates an instance of an outputter that matches your current compiler. /*! Creates an instance of an outputter that matches your current compiler.
*/ */
static CompilerOutputter *defaultOutputter( TestResultCollector *result, static CompilerOutputter *defaultOutputter( TestResultCollector *result,
ostream &stream ); std::ostream &stream );
void write(); void write();
@@ -84,7 +84,7 @@ public:
virtual void printFailureMessage( TestFailure *failure ); virtual void printFailureMessage( TestFailure *failure );
virtual void printNotEqualMessage( Exception *thrownException ); virtual void printNotEqualMessage( Exception *thrownException );
virtual void printDefaultMessage( Exception *thrownException ); virtual void printDefaultMessage( Exception *thrownException );
virtual string wrap( string message ); virtual std::string wrap( std::string message );
private: private:
/// Prevents the use of the copy constructor. /// Prevents the use of the copy constructor.
@@ -93,12 +93,12 @@ private:
/// Prevents the use of the copy operator. /// Prevents the use of the copy operator.
void operator =( const CompilerOutputter &copy ); void operator =( const CompilerOutputter &copy );
typedef vector<string> Lines; typedef std::vector<std::string> Lines;
static Lines splitMessageIntoLines( string message ); static Lines splitMessageIntoLines( std::string message );
private: private:
TestResultCollector *m_result; TestResultCollector *m_result;
ostream &m_stream; std::ostream &m_stream;
}; };
+9 -9
View File
@@ -14,31 +14,31 @@ namespace CppUnit {
* Exception is an exception that serves * Exception is an exception that serves
* descriptive strings through its what() method * descriptive strings through its what() method
*/ */
class CPPUNIT_API Exception : public exception class CPPUNIT_API Exception : public std::exception
{ {
public: public:
class Type class Type
{ {
public: public:
Type( string type ) : m_type ( type ) {} Type( std::string type ) : m_type ( type ) {}
bool operator ==( const Type &other ) const bool operator ==( const Type &other ) const
{ {
return m_type == other.m_type; return m_type == other.m_type;
} }
private: private:
const string m_type; const std::string m_type;
}; };
Exception( string message = "", Exception( std::string message = "",
SourceLine sourceLine = SourceLine() ); SourceLine sourceLine = SourceLine() );
#ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
Exception( string message, Exception( std::string message,
long lineNumber, long lineNumber,
string fileName ); std::string fileName );
#endif #endif
Exception (const Exception& other); Exception (const Exception& other);
@@ -55,7 +55,7 @@ public:
long lineNumber() const; long lineNumber() const;
string fileName() const; string fileName() const;
static const string UNKNOWNFILENAME; static const std::string UNKNOWNFILENAME;
static const long UNKNOWNLINENUMBER; static const long UNKNOWNLINENUMBER;
#endif #endif
@@ -68,9 +68,9 @@ public:
private: private:
// VC++ does not recognize call to parent class when prefixed // VC++ does not recognize call to parent class when prefixed
// with a namespace. This is a workaround. // with a namespace. This is a workaround.
typedef exception SuperClass; typedef std::exception SuperClass;
string m_message; std::string m_message;
SourceLine m_sourceLine; SourceLine m_sourceLine;
}; };
@@ -19,16 +19,16 @@ public:
* \param additionalMessage Additionnal information provided to further qualify * \param additionalMessage Additionnal information provided to further qualify
* the inequality. * the inequality.
*/ */
NotEqualException( string expected, NotEqualException( std::string expected,
string actual, std::string actual,
SourceLine sourceLine = SourceLine(), SourceLine sourceLine = SourceLine(),
string additionalMessage = "" ); std::string additionalMessage = "" );
#ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
NotEqualException( string expected, NotEqualException( std::string expected,
string actual, std::string actual,
long lineNumber, long lineNumber,
string fileName ); std::string fileName );
#endif #endif
NotEqualException( const NotEqualException &other ); NotEqualException( const NotEqualException &other );
@@ -36,11 +36,11 @@ public:
virtual ~NotEqualException() throw(); virtual ~NotEqualException() throw();
string expectedValue() const; std::string expectedValue() const;
string actualValue() const; std::string actualValue() const;
string additionalMessage() const; std::string additionalMessage() const;
/*! Copy operator. /*! Copy operator.
* @param other Object to copy. * @param other Object to copy.
@@ -55,9 +55,9 @@ public:
static Type type(); static Type type();
private: private:
string m_expected; std::string m_expected;
string m_actual; std::string m_actual;
string m_additionalMessage; std::string m_additionalMessage;
}; };
} // namespace CppUnit } // namespace CppUnit
+8 -4
View File
@@ -21,6 +21,10 @@
#undef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST #undef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST
#endif #endif
#if __GNUC__ > 2
#undef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST
#endif
/* Define to 1 if you wish to have the old-style macros /* Define to 1 if you wish to have the old-style macros
assert(), assertEqual(), assertDoublesEqual(), and assertLongsEqual() */ assert(), assertEqual(), assertDoublesEqual(), and assertLongsEqual() */
#ifndef CPPUNIT_ENABLE_NAKED_ASSERT #ifndef CPPUNIT_ENABLE_NAKED_ASSERT
@@ -74,14 +78,14 @@
# endif # endif
namespace CppUnit { namespace CppUnit {
class OStringStream : public ostrstream class OStringStream : public std::ostrstream
{ {
public: public:
string str() std::string str()
{ {
(*this) << '\0'; (*this) << '\0';
string msg(ostrstream::str()); std::string msg(std::ostrstream::str());
ostrstream::freeze(false); std::ostrstream::freeze(false);
return msg; return msg;
} }
}; };
+3 -3
View File
@@ -32,7 +32,7 @@ class CPPUNIT_API SourceLine
public: public:
SourceLine(); SourceLine();
SourceLine( const string &fileName, SourceLine( const std::string &fileName,
int lineNumber ); int lineNumber );
/// Destructor. /// Destructor.
@@ -42,13 +42,13 @@ public:
int lineNumber() const; int lineNumber() const;
string fileName() const; std::string fileName() const;
bool operator ==( const SourceLine &other ) const; bool operator ==( const SourceLine &other ) const;
bool operator !=( const SourceLine &other ) const; bool operator !=( const SourceLine &other ) const;
private: private:
string m_fileName; std::string m_fileName;
int m_lineNumber; int m_lineNumber;
}; };
+2 -2
View File
@@ -42,7 +42,7 @@ public:
* Each test has a name. This name may be used to find the * Each test has a name. This name may be used to find the
* test in a suite or registry of tests. * test in a suite or registry of tests.
*/ */
virtual string getName () const = 0; virtual std::string getName () const = 0;
/*! \brief Description of the test, for diagnostic output. /*! \brief Description of the test, for diagnostic output.
* *
@@ -51,7 +51,7 @@ public:
* suite named <tt>complex_add</tt> may be described as * suite named <tt>complex_add</tt> may be described as
* <tt>suite complex_add</tt>. * <tt>suite complex_add</tt>.
*/ */
virtual string toString () const = 0; virtual std::string toString () const = 0;
}; };
+9 -9
View File
@@ -39,7 +39,7 @@ namespace CppUnit {
return x == y; return x == y;
} }
static string toString( const T& x ) static std::string toString( const T& x )
{ {
OStringStream ost; OStringStream ost;
ost << x; ost << x;
@@ -52,21 +52,21 @@ namespace CppUnit {
{ {
#ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
void CPPUNIT_API assertImplementation( bool condition, void CPPUNIT_API assertImplementation( bool condition,
string conditionExpression = "", std::string conditionExpression = "",
long lineNumber, long lineNumber,
string fileName ); std::string fileName );
void CPPUNIT_API assertNotEqualImplementation( string expected, void CPPUNIT_API assertNotEqualImplementation( std::string expected,
string actual, std::string actual,
long lineNumber, long lineNumber,
string fileName ); std::string fileName );
template <class T> template <class T>
void assertEquals( const T& expected, void assertEquals( const T& expected,
const T& actual, const T& actual,
long lineNumber, long lineNumber,
string fileName ) std::string fileName )
{ {
if ( !assertion_traits<T>::equal(expected,actual) ) // lazy toString conversion... if ( !assertion_traits<T>::equal(expected,actual) ) // lazy toString conversion...
{ {
@@ -81,7 +81,7 @@ namespace CppUnit {
double actual, double actual,
double delta, double delta,
long lineNumber, long lineNumber,
string fileName ); std::string fileName );
#else // using SourceLine #else // using SourceLine
@@ -89,7 +89,7 @@ namespace CppUnit {
void assertEquals( const T& expected, void assertEquals( const T& expected,
const T& actual, const T& actual,
SourceLine sourceLine, SourceLine sourceLine,
const string &message ="" ) const std::string &message ="" )
{ {
if ( !assertion_traits<T>::equal(expected,actual) ) // lazy toString conversion... if ( !assertion_traits<T>::equal(expected,actual) ) // lazy toString conversion...
{ {
+6 -6
View File
@@ -33,11 +33,11 @@ struct ExpectedExceptionTraits
static void expectedException() static void expectedException()
{ {
#if CPPUNIT_USE_TYPEINFO_NAME #if CPPUNIT_USE_TYPEINFO_NAME
string message( "Expected exception of type " ); std::string message( "Expected exception of type " );
message += TypeInfoHelper::getClassName( typeid( ExceptionType ) ); message += TypeInfoHelper::getClassName( typeid( ExceptionType ) );
message += ", but got none"; message += ", but got none";
#else #else
string message( "Expected exception but got none" ); std::string message( "Expected exception but got none" );
#endif #endif
throw Exception( message ); throw Exception( message );
} }
@@ -111,7 +111,7 @@ public:
* \param name name of this TestCaller * \param name name of this TestCaller
* \param test the method this TestCaller calls in runTest() * \param test the method this TestCaller calls in runTest()
*/ */
TestCaller( string name, TestMethod test ) : TestCaller( std::string name, TestMethod test ) :
TestCase( name ), TestCase( name ),
m_ownFixture( true ), m_ownFixture( true ),
m_fixture( new Fixture() ), m_fixture( new Fixture() ),
@@ -128,7 +128,7 @@ public:
* \param test the method this TestCaller calls in runTest() * \param test the method this TestCaller calls in runTest()
* \param fixture the Fixture to invoke the test method on. * \param fixture the Fixture to invoke the test method on.
*/ */
TestCaller(string name, TestMethod test, Fixture& fixture) : TestCaller(std::string name, TestMethod test, Fixture& fixture) :
TestCase( name ), TestCase( name ),
m_ownFixture( false ), m_ownFixture( false ),
m_fixture( &fixture ), m_fixture( &fixture ),
@@ -145,7 +145,7 @@ public:
* \param test the method this TestCaller calls in runTest() * \param test the method this TestCaller calls in runTest()
* \param fixture the Fixture to invoke the test method on. * \param fixture the Fixture to invoke the test method on.
*/ */
TestCaller(string name, TestMethod test, Fixture* fixture) : TestCaller(std::string name, TestMethod test, Fixture* fixture) :
TestCase( name ), TestCase( name ),
m_ownFixture( true ), m_ownFixture( true ),
m_fixture( fixture ), m_fixture( fixture ),
@@ -182,7 +182,7 @@ protected:
m_fixture->tearDown (); m_fixture->tearDown ();
} }
string toString() const std::string toString() const
{ {
return "TestCaller " + getName(); return "TestCaller " + getName();
} }
+4 -4
View File
@@ -28,15 +28,15 @@ class CPPUNIT_API TestCase : public Test,
{ {
public: public:
TestCase( string Name ); TestCase( std::string Name );
//! \internal //! \internal
TestCase(); TestCase();
~TestCase(); ~TestCase();
virtual void run(TestResult *result); virtual void run(TestResult *result);
virtual int countTestCases() const; virtual int countTestCases() const;
string getName() const; std::string getName() const;
string toString() const; std::string toString() const;
//! FIXME: what is this for? //! FIXME: what is this for?
virtual TestResult *run(); virtual TestResult *run();
@@ -53,7 +53,7 @@ private:
TestCase &operator=( const TestCase &other ); TestCase &operator=( const TestCase &other );
private: private:
const string m_name; const std::string m_name;
}; };
} // namespace CppUnit } // namespace CppUnit
+2 -2
View File
@@ -37,9 +37,9 @@ public:
virtual bool isError() const; virtual bool isError() const;
virtual string failedTestName() const; virtual std::string failedTestName() const;
virtual string toString() const; virtual std::string toString() const;
virtual TestFailure *clone() const; virtual TestFailure *clone() const;
+1 -1
View File
@@ -65,7 +65,7 @@ protected:
void addFailure( const TestFailure &failure ); void addFailure( const TestFailure &failure );
protected: protected:
typedef deque<TestListener *> TestListeners; typedef std::deque<TestListener *> TestListeners;
TestListeners m_listeners; TestListeners m_listeners;
bool m_stop; bool m_stop;
@@ -38,8 +38,8 @@ namespace CppUnit
class CPPUNIT_API TestResultCollector : public TestSucessListener class CPPUNIT_API TestResultCollector : public TestSucessListener
{ {
public: public:
typedef deque<TestFailure *> TestFailures; typedef std::deque<TestFailure *> TestFailures;
typedef deque<Test *> Tests; typedef std::deque<Test *> Tests;
/*! Constructs a TestResultCollector object. /*! Constructs a TestResultCollector object.
@@ -12,6 +12,9 @@
#include <vector> #include <vector>
#include <string> #include <string>
using std::string;
using std::vector;
namespace CppUnit { namespace CppUnit {
class TestResult; class TestResult;
@@ -21,7 +21,7 @@ class CPPUNIT_API TextOutputter : public Outputter
{ {
public: public:
TextOutputter( TestResultCollector *result, TextOutputter( TestResultCollector *result,
ostream &stream ); std::ostream &stream );
/// Destructor. /// Destructor.
virtual ~TextOutputter(); virtual ~TextOutputter();
@@ -42,7 +42,7 @@ public:
protected: protected:
TestResultCollector *m_result; TestResultCollector *m_result;
ostream &m_stream; std::ostream &m_stream;
private: private:
/// Prevents the use of the copy constructor. /// Prevents the use of the copy constructor.
+12 -12
View File
@@ -25,29 +25,29 @@ public:
virtual void addFailure( Test *test, Exception *e ); virtual void addFailure( Test *test, Exception *e );
virtual void addFailure( const TestFailure &failure ); virtual void addFailure( const TestFailure &failure );
virtual void startTest( Test *test ); virtual void startTest( Test *test );
virtual void print( ostream &stream ); virtual void print( std::ostream &stream );
virtual void printFailures( ostream &stream ); virtual void printFailures( std::ostream &stream );
virtual void printHeader( ostream &stream ); virtual void printHeader( std::ostream &stream );
virtual void printFailure( TestFailure *failure, virtual void printFailure( TestFailure *failure,
int failureNumber, int failureNumber,
ostream &stream ); std::ostream &stream );
virtual void printFailureListMark( int failureNumber, virtual void printFailureListMark( int failureNumber,
ostream &stream ); std::ostream &stream );
virtual void printFailureTestName( TestFailure *failure, virtual void printFailureTestName( TestFailure *failure,
ostream &stream ); std::ostream &stream );
virtual void printFailureType( TestFailure *failure, virtual void printFailureType( TestFailure *failure,
ostream &stream ); std::ostream &stream );
virtual void printFailureLocation( SourceLine sourceLine, virtual void printFailureLocation( SourceLine sourceLine,
ostream &stream ); std::ostream &stream );
virtual void printFailureDetail( Exception *thrownException, virtual void printFailureDetail( Exception *thrownException,
ostream &stream ); std::ostream &stream );
virtual void printFailureWarning( ostream &stream ); virtual void printFailureWarning( std::ostream &stream );
virtual void printStatistics( ostream &stream ); virtual void printStatistics( std::ostream &stream );
}; };
/** insertion operator for easy output */ /** insertion operator for easy output */
ostream &operator <<( ostream &stream, std::ostream &operator <<( std::ostream &stream,
TextTestResult &result ); TextTestResult &result );
} // namespace CppUnit } // namespace CppUnit
+20 -20
View File
@@ -36,8 +36,8 @@ public:
* \param encoding Encoding used in the XML file (default is Latin-1). * \param encoding Encoding used in the XML file (default is Latin-1).
*/ */
XmlOutputter( TestResultCollector *result, XmlOutputter( TestResultCollector *result,
ostream &stream, std::ostream &stream,
string encoding = "ISO-8859-1" ); std::string encoding = "ISO-8859-1" );
/// Destructor. /// Destructor.
virtual ~XmlOutputter(); virtual ~XmlOutputter();
@@ -56,33 +56,33 @@ public:
class CPPUNIT_API Node class CPPUNIT_API Node
{ {
public: public:
Node( string elementName, Node( std::string elementName,
string content ="" ); std::string content ="" );
Node( string elementName, Node( std::string elementName,
int numericContent ); int numericContent );
virtual ~Node(); virtual ~Node();
void addAttribute( string attributeName, void addAttribute( std::string attributeName,
string value ); std::string value );
void addAttribute( string attributeName, void addAttribute( std::string attributeName,
int numericValue ); int numericValue );
void addNode( Node *node ); void addNode( Node *node );
string toString() const; std::string toString() const;
private: private:
typedef pair<string,string> Attribute; typedef std::pair<std::string,std::string> Attribute;
string attributesAsString() const; std::string attributesAsString() const;
string escape( string value ) const; std::string escape( std::string value ) const;
static string asString( int value ); static std::string asString( int value );
private: private:
string m_name; std::string m_name;
string m_content; std::string m_content;
typedef deque<Attribute> Attributes; typedef std::deque<Attribute> Attributes;
Attributes m_attributes; Attributes m_attributes;
typedef deque<Node *> Nodes; typedef std::deque<Node *> Nodes;
Nodes m_nodes; Nodes m_nodes;
}; };
@@ -90,7 +90,7 @@ public:
virtual void writeProlog(); virtual void writeProlog();
virtual void writeTestsResult(); virtual void writeTestsResult();
typedef map<Test *,TestFailure*> FailedTests; typedef std::map<Test *,TestFailure*> FailedTests;
virtual Node *makeRootNode(); virtual Node *makeRootNode();
virtual void addFailedTests( FailedTests &failedTests, virtual void addFailedTests( FailedTests &failedTests,
Node *rootNode ); Node *rootNode );
@@ -111,8 +111,8 @@ protected:
protected: protected:
TestResultCollector *m_result; TestResultCollector *m_result;
ostream &m_stream; std::ostream &m_stream;
string m_encoding; std::string m_encoding;
private: private:
/// Prevents the use of the copy constructor. /// Prevents the use of the copy constructor.
@@ -24,7 +24,7 @@ public:
void run( TestResult *result ); void run( TestResult *result );
int countTestCases() const; int countTestCases() const;
string toString() const; std::string toString() const;
private: private:
RepeatedTest( const RepeatedTest & ); RepeatedTest( const RepeatedTest & );
@@ -25,8 +25,8 @@ public:
void run (TestResult *result); void run (TestResult *result);
int countTestCases () const; int countTestCases () const;
string getName () const; std::string getName () const;
string toString () const; std::string toString () const;
protected: protected:
Test *m_test; Test *m_test;
@@ -53,11 +53,11 @@ inline void TestDecorator::run (TestResult *result)
{ m_test->run (result); } { m_test->run (result); }
inline string TestDecorator::toString () const inline std::string TestDecorator::toString () const
{ return m_test->toString (); } { return m_test->toString (); }
inline string TestDecorator::getName () const inline std::string TestDecorator::getName () const
{ return m_test->getName(); } { return m_test->getName(); }
} // namespace CppUnit } // namespace CppUnit
@@ -79,7 +79,7 @@ public:
* \param name Name of the registry. It is the name of TestSuite returned by * \param name Name of the registry. It is the name of TestSuite returned by
* makeTest(). * makeTest().
*/ */
TestFactoryRegistry( string name = "All Tests" ); TestFactoryRegistry( std::string name = "All Tests" );
/// Destructor. /// Destructor.
virtual ~TestFactoryRegistry(); virtual ~TestFactoryRegistry();
@@ -104,7 +104,7 @@ public:
* \return Registry. If the registry does not exist, it is created with the * \return Registry. If the registry does not exist, it is created with the
* specified name. * specified name.
*/ */
static TestFactoryRegistry &getRegistry( const string &name ); static TestFactoryRegistry &getRegistry( const std::string &name );
/** Adds the registered tests to the specified suite. /** Adds the registered tests to the specified suite.
* \param suite Suite the tests are added to. * \param suite Suite the tests are added to.
@@ -116,7 +116,7 @@ public:
* \param factory Factory to register. * \param factory Factory to register.
* \deprecated Use registerFactory( TestFactory *) instead. * \deprecated Use registerFactory( TestFactory *) instead.
*/ */
void registerFactory( const string &name, void registerFactory( const std::string &name,
TestFactory *factory ); TestFactory *factory );
/** Adds the specified TestFactory to the registry. /** Adds the specified TestFactory to the registry.
@@ -130,10 +130,10 @@ private:
void operator =( const TestFactoryRegistry &copy ); void operator =( const TestFactoryRegistry &copy );
private: private:
typedef map<string, TestFactory *> Factories; typedef std::map<std::string, TestFactory *> Factories;
Factories m_factories; Factories m_factories;
string m_name; std::string m_name;
}; };
@@ -21,7 +21,7 @@ namespace CppUnit {
* the "class" prefix. If the name is not prefixed * the "class" prefix. If the name is not prefixed
* by "class", it is returned as this. * by "class", it is returned as this.
*/ */
static string getClassName( const type_info &info ); static std::string getClassName( const std::type_info &info );
}; };
} // namespace CppUnit } // namespace CppUnit
+2
View File
@@ -4,6 +4,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
using std::string;
_EXPORT _EXPORT
BTestCase::BTestCase(string name) BTestCase::BTestCase(string name)
: CppUnit::TestCase(name) : CppUnit::TestCase(name)
+3
View File
@@ -2,6 +2,9 @@
#include <cppunit/Test.h> #include <cppunit/Test.h>
#include <cppunit/TestResult.h> #include <cppunit/TestResult.h>
using std::map;
using std::string;
// Default constructor // Default constructor
_EXPORT _EXPORT
BTestSuite::BTestSuite( string name ) BTestSuite::BTestSuite( string name )
+1
View File
@@ -1,6 +1,7 @@
// TestApp.cpp // TestApp.cpp
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <Autolock.h> #include <Autolock.h>
+3
View File
@@ -7,6 +7,9 @@
#include <stdio.h> #include <stdio.h>
#include <OS.h> #include <OS.h>
using std::cout;
using std::endl;
_EXPORT _EXPORT
void void
BTestListener::startTest( CppUnit::Test *test ) { BTestListener::startTest( CppUnit::Test *test ) {
+4
View File
@@ -26,6 +26,10 @@
# include <ElfSymbolPatcher.h> # include <ElfSymbolPatcher.h>
#endif #endif
using std::cout;
using std::endl;
using std::set;
_EXPORT BTestShell *BTestShell::fGlobalShell = NULL; _EXPORT BTestShell *BTestShell::fGlobalShell = NULL;
const char BTestShell::indent[] = " "; const char BTestShell::indent[] = " ";
+8
View File
@@ -3,8 +3,16 @@
#include <TestUtils.h> #include <TestUtils.h>
#include <TestShell.h> #include <TestShell.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream> #include <iostream>
using std::cout;
using std::dec;
using std::endl;
using std::hex;
using std::string;
_EXPORT _EXPORT
status_t DecodeResult(status_t result) { status_t DecodeResult(status_t result) {
if (!BTestShell::GlobalBeVerbose()) if (!BTestShell::GlobalBeVerbose())
+4
View File
@@ -4,6 +4,10 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
using std::map;
using std::string;
using std::vector;
_EXPORT _EXPORT
BThreadedTestCase::BThreadedTestCase(string name, string progressSeparator) BThreadedTestCase::BThreadedTestCase(string name, string progressSeparator)
: BTestCase(name) : BTestCase(name)
+2
View File
@@ -2,6 +2,8 @@
#include <cppunit/NotEqualException.h> #include <cppunit/NotEqualException.h>
using std::string;
namespace CppUnit namespace CppUnit
{ {
@@ -6,6 +6,10 @@
#include <cppunit/CompilerOutputter.h> #include <cppunit/CompilerOutputter.h>
using std::endl;
using std::ostream;
using std::string;
namespace CppUnit namespace CppUnit
{ {
+3 -3
View File
@@ -29,7 +29,7 @@ Exception::Exception( const Exception &other ) :
/*! /*!
* \deprecated Use other constructor instead. * \deprecated Use other constructor instead.
*/ */
Exception::Exception( string message, Exception::Exception( std::string message,
SourceLine sourceLine ) : SourceLine sourceLine ) :
m_message( message ), m_message( message ),
m_sourceLine( sourceLine ) m_sourceLine( sourceLine )
@@ -41,9 +41,9 @@ Exception::Exception( string message,
/*! /*!
* \deprecated Use other constructor instead. * \deprecated Use other constructor instead.
*/ */
Exception::Exception( string message, Exception::Exception( std::string message,
long lineNumber, long lineNumber,
string fileName ) : std::string fileName ) :
m_message( message ), m_message( message ),
m_sourceLine( fileName, lineNumber ) m_sourceLine( fileName, lineNumber )
{ {
@@ -3,6 +3,8 @@
namespace CppUnit { namespace CppUnit {
using std::string;
NotEqualException::NotEqualException( string expected, NotEqualException::NotEqualException( string expected,
string actual, string actual,
SourceLine sourceLine , SourceLine sourceLine ,
@@ -4,6 +4,7 @@
namespace CppUnit { namespace CppUnit {
using std::string;
// Counts the number of test cases that will be run by this test. // Counts the number of test cases that will be run by this test.
int int
+2
View File
@@ -1,6 +1,8 @@
#include <cppunit/SourceLine.h> #include <cppunit/SourceLine.h>
using std::string;
namespace CppUnit namespace CppUnit
{ {
+4 -1
View File
@@ -7,6 +7,9 @@
#include "cppunit/TestResult.h" #include "cppunit/TestResult.h"
using std::exception;
using std::string;
namespace CppUnit { namespace CppUnit {
/// Create a default TestResult /// Create a default TestResult
@@ -122,7 +125,7 @@ TestCase::toString() const
string className; string className;
#if CPPUNIT_USE_TYPEINFO_NAME #if CPPUNIT_USE_TYPEINFO_NAME
const type_info& thisClass = typeid( *this ); const std::type_info& thisClass = typeid( *this );
className = thisClass.name(); className = thisClass.name();
#else #else
className = "TestCase"; className = "TestCase";
@@ -9,6 +9,10 @@
#endif #endif
using std::map;
using std::set;
using std::string;
namespace CppUnit { namespace CppUnit {
/** (Implementation) This class manages all the TestFactoryRegistry. /** (Implementation) This class manages all the TestFactoryRegistry.
@@ -2,6 +2,8 @@
#include "cppunit/Test.h" #include "cppunit/Test.h"
#include "cppunit/TestFailure.h" #include "cppunit/TestFailure.h"
using std::string;
namespace CppUnit { namespace CppUnit {
/// Constructs a TestFailure with the given test and exception. /// Constructs a TestFailure with the given test and exception.
+3
View File
@@ -6,6 +6,9 @@
#include <cppunit/ui/text/TestRunner.h> #include <cppunit/ui/text/TestRunner.h>
#include <iostream> #include <iostream>
using std::cin;
using std::cout;
using std::endl;
namespace CppUnit { namespace CppUnit {
namespace TextUi { namespace TextUi {
@@ -5,6 +5,9 @@
#include <cppunit/TextOutputter.h> #include <cppunit/TextOutputter.h>
using std::endl;
using std::ostream;
namespace CppUnit namespace CppUnit
{ {
@@ -3,6 +3,9 @@
#include <iostream> #include <iostream>
using std::cerr;
using std::endl;
namespace CppUnit namespace CppUnit
{ {
@@ -6,6 +6,10 @@
#include <iostream> #include <iostream>
using std::cerr;
using std::endl;
using std::ostream;
namespace CppUnit { namespace CppUnit {
@@ -6,6 +6,9 @@
#include <cppunit/extensions/TypeInfoHelper.h> #include <cppunit/extensions/TypeInfoHelper.h>
using std::string;
using std::type_info;
namespace CppUnit { namespace CppUnit {
string string
@@ -7,6 +7,12 @@
#include <stdlib.h> #include <stdlib.h>
using std::endl;
using std::ostream;
using std::pair;
using std::string;
namespace CppUnit namespace CppUnit
{ {