-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Updated cxxtest to 4.0.3
- Loading branch information
Showing
75 changed files
with
16,388 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
------------------------------------------------------------------------- | ||
CxxTest: A lightweight C++ unit testing library. | ||
Copyright (c) 2008 Sandia Corporation. | ||
This software is distributed under the LGPL License v2.1 | ||
For more information, see the COPYING file in the top CxxTest directory. | ||
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, | ||
the U.S. Government retains certain rights in this software. | ||
------------------------------------------------------------------------- | ||
*/ | ||
|
||
#ifndef __cxxtest__Descriptions_cpp__ | ||
#define __cxxtest__Descriptions_cpp__ | ||
|
||
#include <cxxtest/Descriptions.h> | ||
|
||
namespace CxxTest | ||
{ | ||
TestDescription::~TestDescription() {} | ||
SuiteDescription::~SuiteDescription() {} | ||
WorldDescription::~WorldDescription() {} | ||
|
||
// | ||
// Convert total tests to string | ||
// | ||
#ifndef _CXXTEST_FACTOR | ||
char *WorldDescription::strTotalTests( char *s ) const | ||
{ | ||
numberToString( numTotalTests(), s ); | ||
return s; | ||
} | ||
#else // _CXXTEST_FACTOR | ||
char *WorldDescription::strTotalTests( char *s ) const | ||
{ | ||
char *p = numberToString( numTotalTests(), s ); | ||
|
||
if ( numTotalTests() <= 1 ) | ||
return s; | ||
|
||
unsigned n = numTotalTests(); | ||
unsigned numFactors = 0; | ||
|
||
for ( unsigned factor = 2; (factor * factor) <= n; factor += (factor == 2) ? 1 : 2 ) { | ||
unsigned power; | ||
|
||
for ( power = 0; (n % factor) == 0; n /= factor ) | ||
++ power; | ||
|
||
if ( !power ) | ||
continue; | ||
|
||
p = numberToString( factor, copyString( p, (numFactors == 0) ? " = " : " * " ) ); | ||
if ( power > 1 ) | ||
p = numberToString( power, copyString( p, "^" ) ); | ||
++ numFactors; | ||
} | ||
|
||
if ( n > 1 ) { | ||
if ( !numFactors ) | ||
copyString( p, tracker().failedTests() ? " :(" : tracker().warnings() ? " :|" : " :)" ); | ||
else | ||
numberToString( n, copyString( p, " * " ) ); | ||
} | ||
return s; | ||
} | ||
#endif // _CXXTEST_FACTOR | ||
} | ||
|
||
#endif // __cxxtest__Descriptions_cpp__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
------------------------------------------------------------------------- | ||
CxxTest: A lightweight C++ unit testing library. | ||
Copyright (c) 2008 Sandia Corporation. | ||
This software is distributed under the LGPL License v2.1 | ||
For more information, see the COPYING file in the top CxxTest directory. | ||
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, | ||
the U.S. Government retains certain rights in this software. | ||
------------------------------------------------------------------------- | ||
*/ | ||
|
||
#ifndef __cxxtest__Descriptions_h__ | ||
#define __cxxtest__Descriptions_h__ | ||
|
||
// | ||
// TestDescription, SuiteDescription and WorldDescription | ||
// hold information about tests so they can be run and reported. | ||
// | ||
|
||
#include <cxxtest/LinkedList.h> | ||
|
||
namespace CxxTest | ||
{ | ||
class TestSuite; | ||
|
||
class TestDescription : public Link | ||
{ | ||
public: | ||
virtual ~TestDescription(); | ||
|
||
virtual const char *file() const = 0; | ||
virtual int line() const = 0; | ||
virtual const char *testName() const = 0; | ||
virtual const char *suiteName() const = 0; | ||
|
||
virtual void run() = 0; | ||
virtual bool setUp() = 0; | ||
virtual bool tearDown() = 0; | ||
|
||
virtual const TestDescription *next() const = 0; | ||
virtual TestDescription *next() = 0; | ||
}; | ||
|
||
class SuiteDescription : public Link | ||
{ | ||
public: | ||
virtual ~SuiteDescription(); | ||
|
||
virtual const char *file() const = 0; | ||
virtual int line() const = 0; | ||
virtual const char *suiteName() const = 0; | ||
virtual TestSuite *suite() const = 0; | ||
|
||
virtual unsigned numTests() const = 0; | ||
virtual const TestDescription &testDescription( unsigned /*i*/ ) const = 0; | ||
|
||
virtual TestDescription *firstTest() = 0; | ||
virtual const TestDescription *firstTest() const = 0; | ||
virtual SuiteDescription *next() = 0; | ||
virtual const SuiteDescription *next() const = 0; | ||
|
||
virtual void activateAllTests() = 0; | ||
virtual bool leaveOnly( const char * /*testName*/ ) = 0; | ||
|
||
virtual bool setUp() = 0; | ||
virtual bool tearDown() = 0; | ||
}; | ||
|
||
class WorldDescription : public Link | ||
{ | ||
public: | ||
virtual ~WorldDescription(); | ||
|
||
virtual const char *worldName() const { return "cxxtest"; } | ||
virtual unsigned numSuites( void ) const = 0; | ||
virtual unsigned numTotalTests( void ) const = 0; | ||
virtual const SuiteDescription &suiteDescription( unsigned /*i*/ ) const = 0; | ||
|
||
enum { MAX_STRLEN_TOTAL_TESTS = 32 }; | ||
char *strTotalTests( char * /*buffer*/ ) const; | ||
|
||
virtual SuiteDescription *firstSuite() = 0; | ||
virtual const SuiteDescription *firstSuite() const = 0; | ||
|
||
virtual void activateAllTests() = 0; | ||
virtual bool leaveOnly( const char * /*suiteName*/, const char * /*testName*/ = 0 ) = 0; | ||
}; | ||
} | ||
|
||
#endif // __cxxtest__Descriptions_h__ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
------------------------------------------------------------------------- | ||
CxxTest: A lightweight C++ unit testing library. | ||
Copyright (c) 2008 Sandia Corporation. | ||
This software is distributed under the LGPL License v2.1 | ||
For more information, see the COPYING file in the top CxxTest directory. | ||
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, | ||
the U.S. Government retains certain rights in this software. | ||
------------------------------------------------------------------------- | ||
*/ | ||
|
||
#include <cxxtest/DummyDescriptions.h> | ||
|
||
namespace CxxTest | ||
{ | ||
DummyTestDescription::DummyTestDescription() {} | ||
|
||
const char *DummyTestDescription::file() const { return "<no file>"; } | ||
int DummyTestDescription::line() const { return 0; } | ||
const char *DummyTestDescription::testName() const { return "<no test>"; } | ||
const char *DummyTestDescription::suiteName() const { return "<no suite>"; } | ||
bool DummyTestDescription::setUp() { return true;} | ||
void DummyTestDescription::run() {} | ||
bool DummyTestDescription::tearDown() { return true;} | ||
|
||
TestDescription *DummyTestDescription::next() { return 0; } | ||
const TestDescription *DummyTestDescription::next() const { return 0; } | ||
|
||
DummySuiteDescription::DummySuiteDescription() : _test() {} | ||
|
||
const char *DummySuiteDescription::file() const { return "<no file>"; } | ||
int DummySuiteDescription::line() const { return 0; } | ||
const char *DummySuiteDescription::suiteName() const { return "<no suite>"; } | ||
TestSuite *DummySuiteDescription::suite() const { return 0; } | ||
unsigned DummySuiteDescription::numTests() const { return 0; } | ||
const TestDescription &DummySuiteDescription::testDescription( unsigned ) const { return _test; } | ||
SuiteDescription *DummySuiteDescription::next() { return 0; } | ||
TestDescription *DummySuiteDescription::firstTest() { return 0; } | ||
const SuiteDescription *DummySuiteDescription::next() const { return 0; } | ||
const TestDescription *DummySuiteDescription::firstTest() const { return 0; } | ||
void DummySuiteDescription::activateAllTests() {} | ||
bool DummySuiteDescription::leaveOnly( const char * /*testName*/ ) { return false; } | ||
|
||
bool DummySuiteDescription::setUp() { return true;} | ||
bool DummySuiteDescription::tearDown() { return true;} | ||
|
||
DummyWorldDescription::DummyWorldDescription() : _suite() {} | ||
|
||
unsigned DummyWorldDescription::numSuites( void ) const { return 0; } | ||
unsigned DummyWorldDescription::numTotalTests( void ) const { return 0; } | ||
const SuiteDescription &DummyWorldDescription::suiteDescription( unsigned ) const { return _suite; } | ||
SuiteDescription *DummyWorldDescription::firstSuite() { return 0; } | ||
const SuiteDescription *DummyWorldDescription::firstSuite() const { return 0; } | ||
void DummyWorldDescription::activateAllTests() {} | ||
bool DummyWorldDescription::leaveOnly( const char * /*suiteName*/, const char * /*testName*/ ) { return false; } | ||
|
||
bool DummyWorldDescription::setUp() { return true;} | ||
bool DummyWorldDescription::tearDown() { return true;} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
------------------------------------------------------------------------- | ||
CxxTest: A lightweight C++ unit testing library. | ||
Copyright (c) 2008 Sandia Corporation. | ||
This software is distributed under the LGPL License v2.1 | ||
For more information, see the COPYING file in the top CxxTest directory. | ||
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, | ||
the U.S. Government retains certain rights in this software. | ||
------------------------------------------------------------------------- | ||
*/ | ||
|
||
#ifndef __cxxtest__DummyDescriptions_h__ | ||
#define __cxxtest__DummyDescriptions_h__ | ||
|
||
// | ||
// DummyTestDescription, DummySuiteDescription and DummyWorldDescription | ||
// | ||
|
||
#include <cxxtest/Descriptions.h> | ||
|
||
namespace CxxTest | ||
{ | ||
class DummyTestDescription : public TestDescription | ||
{ | ||
public: | ||
DummyTestDescription(); | ||
|
||
const char *file() const; | ||
int line() const; | ||
const char *testName() const; | ||
const char *suiteName() const; | ||
bool setUp(); | ||
void run(); | ||
bool tearDown(); | ||
|
||
TestDescription *next(); | ||
const TestDescription *next() const; | ||
}; | ||
|
||
class DummySuiteDescription : public SuiteDescription | ||
{ | ||
public: | ||
DummySuiteDescription(); | ||
|
||
const char *file() const; | ||
int line() const; | ||
const char *suiteName() const; | ||
TestSuite *suite() const; | ||
unsigned numTests() const; | ||
const TestDescription &testDescription( unsigned ) const; | ||
SuiteDescription *next(); | ||
TestDescription *firstTest(); | ||
const SuiteDescription *next() const; | ||
const TestDescription *firstTest() const; | ||
void activateAllTests(); | ||
bool leaveOnly( const char * /*testName*/ ); | ||
|
||
bool setUp(); | ||
bool tearDown(); | ||
|
||
private: | ||
DummyTestDescription _test; | ||
}; | ||
|
||
class DummyWorldDescription : public WorldDescription | ||
{ | ||
public: | ||
DummyWorldDescription(); | ||
|
||
unsigned numSuites( void ) const; | ||
unsigned numTotalTests( void ) const; | ||
const SuiteDescription &suiteDescription( unsigned ) const; | ||
SuiteDescription *firstSuite(); | ||
const SuiteDescription *firstSuite() const; | ||
void activateAllTests(); | ||
bool leaveOnly( const char * /*suiteName*/, const char * /*testName*/ = 0 ); | ||
|
||
bool setUp(); | ||
bool tearDown(); | ||
|
||
private: | ||
DummySuiteDescription _suite; | ||
}; | ||
} | ||
|
||
#endif // __cxxtest__DummyDescriptions_h__ | ||
|
Oops, something went wrong.