CPUnit 0.7 (beta)
The REAL C++ port of JUnit.
|
Namespaces | |
namespace | impl |
namespace | priv |
Classes | |
class | AssertionException |
Thrown when an assert fails, or if someone calls unittest::fail(). More... | |
class | BasicTestRunner |
The only implementation of TestRunner that actually executes tests. More... | |
class | Callable |
class | CmdLineParser |
Class implementing command line parsing functionality. More... | |
class | ConformityChecker |
class | ErrorReportFormat |
class | ExecutionReport |
class | FixtureRegistrar |
class | FuncTestRegistrar |
class | FunctionCall |
class | GlobMatcher |
class | IllegalArgumentException |
class | RegInfo |
Registration data for unit tests. More... | |
class | RunAllTestRunner |
class | StopWatch |
class | StringFlyweightStore |
Flyweight pattern implementation for std::string objects. More... | |
class | StringFlyweightStoreUsage |
Users of the StringFlyweightStore may contain an instance of StringFlyweightStoreUsage to make sure the StringFlyweightStore is not disposed before the user object dies. More... | |
class | TestExecutionFacade |
class | TestRunner |
class | TestRunnerDecorator |
This class implements functionality enabling objects to be part of the test runner chain. More... | |
class | TestStore |
class | TestTreeNode |
class | SafeTearDown |
class | TestUnit |
class | TimeFormat |
class | TimeGuardRunner |
class | UnitTestException |
class | WrongSetupException |
Functions | |
template<class T > | |
void | assert_equals (const std::string msg, const T &expected, const T &actual) |
Check that two objects are equal, using ==. | |
template<class T > | |
void | assert_equals (const T &expected, const T &actual) |
Check that two objects are equal, using ==. | |
template<class T , class Eq > | |
void | assert_equals (const std::string msg, const T &expected, const T &actual, const Eq &eq) |
Check that two objects are equal, using a custom comparator. | |
template<class T , class Eq > | |
void | assert_equals (const T &expected, const T &actual, const Eq &eq) |
Check that two objects are equal, using a custom comparator. | |
void | assert_equals (const std::string msg, const double expected, const double actual, const double error) |
Check that two floating point numbers are sufficiently closed to be reckoned as equal. | |
void | assert_equals (const double expected, const double actual, const double error) |
Check that two floating point numbers are sufficiently closed to be reckoned as equal. | |
void | assert_true (const std::string msg, const bool statement) |
Checks that a statement is true . | |
void | assert_true (const bool statement) |
Checks that a statement is true . | |
void | assert_false (const std::string msg, const bool statement) |
Checks that a statement is false . | |
void | assert_false (const bool statement) |
Checks that a statement is false . | |
void | assert_not_null (const std::string msg, const void *data) |
Checks that a pointer is not NULL . | |
void | assert_not_null (const void *data) |
Checks that a pointer is not NULL . | |
void | assert_null (const std::string msg, const void *data) |
Checks that a pointer is NULL . | |
void | assert_null (const void *data) |
Checks that a pointer is NULL . | |
void | fail (const std::string msg) |
Causes an AssertionException to be thrown. | |
void | fail () |
Causes an AssertionException to be thrown. | |
template<> | |
std::string | CmdLineParser::value_of< std::string > (const std::string arg) const |
CmdLineParser | get_cmd_line_parser () |
Creates a command line parser initialized with default values. | |
int | main (const int argc, const char **args) |
Forward your program parameters directly from main to this function to start CPUnit. | |
int | main (const CmdLineParser &parser) |
If you have extra command line parameters, you may use this method to start CPUnit after you have done your own. | |
template<class T , class A > | |
std::ostream & | operator<< (std::ostream &out, const std::vector< T, A > &vec) |
template<class T , class A > | |
std::ostream & | operator<< (std::ostream &out, const std::list< T, A > &lst) |
template<class T , class A > | |
std::ostream & | operator<< (std::ostream &out, const std::deque< T, A > &d) |
template<class T , class C > | |
std::ostream & | operator<< (std::ostream &out, const std::set< T, C > &s) |
template<class K , class C , class A > | |
std::ostream & | operator<< (std::ostream &out, const std::multiset< K, C, A > &s) |
template<class K , class T , class C , class A > | |
std::ostream & | operator<< (std::ostream &out, const std::map< K, T, C, A > &m) |
template<class K , class T , class C , class A > | |
std::ostream & | operator<< (std::ostream &out, const std::multimap< K, T, C, A > &m) |
template<class Iterator > | |
std::ostream & | stream_objects (std::ostream &out, const Iterator &start, const int count, const char *bounds) |
template<class Iterator > | |
std::ostream & | stream_pairs (std::ostream &out, const Iterator &start, const int count, const char *bounds) |
std::ostream & | operator<< (std::ostream &out, const TimeFormat &f) |
void unittest::assert_equals | ( | const std::string | msg, |
const T & | expected, | ||
const T & | actual | ||
) |
Check that two objects are equal, using ==.
If you need comparisons on objects which do not support ==, or == is insufficient, please use assert_equals(const std::string, const T&, const T&, const Eq&).
T | The type of the objects to compare. The type must support the operator '==' as well as the stream operator std::ostream& operator << (std::ostream&, const T&) |
msg | A text to be displayed together with the error message if the comparison fails. |
expected | The expected value. |
actual | The actual value to test against the facit 'expected'. |
AssertionException | if the assert fails. |
Definition at line 50 of file unittest_Assert.tcc.
void unittest::assert_equals | ( | const T & | expected, |
const T & | actual | ||
) |
Check that two objects are equal, using ==.
If you need comparisons on objects which do not support ==, or == is insufficient, please use assert_equals(const T&, const T&, const Eq&).
T | The type of the objects to compare. The type must support the operator '==' as well as the stream operator std::ostream& operator << (std::ostream&, const T&) |
expected | The expected value. |
actual | The actual value to test against the facit 'expected'. |
AssertionException | if the assert fails. |
Definition at line 68 of file unittest_Assert.tcc.
void unittest::assert_equals | ( | const T & | expected, |
const T & | actual, | ||
const Eq & | eq | ||
) |
Check that two objects are equal, using a custom comparator.
T | The type of the objects to compare. The type must support the operator '==' as well as the stream operator std::ostream& operator << (std::ostream&, const T&) |
Eq | The type of comparator to use. The type must offer an operator 'bool operator () (const T&, const T&) const'. |
expected | The expected value. |
actual | The actual value to test against the facit 'expected'. |
eq | The comparator object to use. |
AssertionException | if the assert fails. |
Definition at line 105 of file unittest_Assert.tcc.
void unittest::assert_equals | ( | const std::string | msg, |
const double | expected, | ||
const double | actual, | ||
const double | error | ||
) |
Check that two floating point numbers are sufficiently closed to be reckoned as equal.
The expected and actual values are considered equal if abs(expected - actual) <= error.
msg | A text to be displayed together with the error message if the comparison fails. |
expected | The expected value. |
actual | The actual value to test against the facit 'expected'. |
error | The maximal allowed difference between 'expected' and 'actual'. |
AssertionException | if the assert fails. |
Definition at line 109 of file unittest_Assert.cpp.
void unittest::assert_equals | ( | const std::string | msg, |
const T & | expected, | ||
const T & | actual, | ||
const Eq & | eq | ||
) |
Check that two objects are equal, using a custom comparator.
T | The type of the objects to compare. The type must support the operator '==' as well as the stream operator std::ostream& operator << (std::ostream&, const T&) |
Eq | The type of comparator to use. The type must offer an operator 'bool operator () (const T&, const T&) const'. |
msg | A text to be displayed together with the error message if the comparison fails. |
expected | The expected value. |
actual | The actual value to test against the facit 'expected'. |
eq | The comparator object to use. |
AssertionException | if the assert fails. |
Definition at line 86 of file unittest_Assert.tcc.
void unittest::assert_equals | ( | const double | expected, |
const double | actual, | ||
const double | error | ||
) |
Check that two floating point numbers are sufficiently closed to be reckoned as equal.
The expected and actual values are considered equal if abs(expected - actual) <= error.
expected | The expected value. |
actual | The actual value to test against the facit 'expected'. |
error | The maximal allowed difference between 'expected' and 'actual'. |
AssertionException | if the assert fails. |
Definition at line 123 of file unittest_Assert.cpp.
void unittest::assert_false | ( | const std::string | msg, |
const bool | statement | ||
) |
Checks that a statement is false
.
msg | A text to be displayed together with the error message if the assertion fails. |
statement | The statement to check for falseness. |
AssertionException | if the assert fails. |
Definition at line 83 of file unittest_Assert.cpp.
void unittest::assert_false | ( | const bool | statement | ) |
Checks that a statement is false
.
statement | The statement to check for falseness. |
AssertionException | if the assert fails. |
Definition at line 96 of file unittest_Assert.cpp.
void unittest::assert_not_null | ( | const std::string | msg, |
const void * | data | ||
) |
Checks that a pointer is not NULL
.
msg | A text to be displayed together with the error message if the test fails. |
data | The pointer to test. |
AssertionException | if the assert fails. |
Definition at line 133 of file unittest_Assert.cpp.
void unittest::assert_not_null | ( | const void * | data | ) |
Checks that a pointer is not NULL
.
data | The pointer to test. |
AssertionException | if the assert fails. |
Definition at line 146 of file unittest_Assert.cpp.
void unittest::assert_null | ( | const std::string | msg, |
const void * | data | ||
) |
Checks that a pointer is NULL
.
msg | A text to be displayed together with the error message if the test fails. |
data | The pointer to test. |
AssertionException | if the assert fails. |
Definition at line 156 of file unittest_Assert.cpp.
void unittest::assert_null | ( | const void * | data | ) |
Checks that a pointer is NULL
.
data | The pointer to test. |
AssertionException | if the assert fails. |
Definition at line 169 of file unittest_Assert.cpp.
void unittest::assert_true | ( | const bool | statement | ) |
Checks that a statement is true
.
statement | The statement to check for truthfulness. |
AssertionException | if the assert fails. |
Definition at line 73 of file unittest_Assert.cpp.
void unittest::assert_true | ( | const std::string | msg, |
const bool | statement | ||
) |
Checks that a statement is true
.
msg | A text to be displayed together with the error message if the assertion fails. |
statement | The statement to check for truthfulness. |
AssertionException | if the assert fails. |
Definition at line 60 of file unittest_Assert.cpp.
std::string unittest::CmdLineParser::value_of< std::string > | ( | const std::string | arg | ) | const |
void unittest::fail | ( | ) |
Causes an AssertionException to be thrown.
AssertionException | allways. |
Definition at line 50 of file unittest_Assert.cpp.
void unittest::fail | ( | const std::string | msg | ) |
Causes an AssertionException to be thrown.
msg | The error message to display. |
AssertionException | allways. |
Definition at line 40 of file unittest_Assert.cpp.
CmdLineParser unittest::get_cmd_line_parser | ( | ) |
Creates a command line parser initialized with default values.
Definition at line 233 of file unittest_EntryPoint.cpp.
int unittest::main | ( | const int | argc, |
const char ** | args | ||
) |
Forward your program parameters directly from main to this function to start CPUnit.
argc | The number of arguments, including the program name. |
args | The program arguments, including the program name. |
Definition at line 255 of file unittest_EntryPoint.cpp.
int unittest::main | ( | const CmdLineParser & | parser | ) |
If you have extra command line parameters, you may use this method to start CPUnit after you have done your own.
You should use get_cmd_line_parser() to obtain a parser which is already set up to accept the CPUnit specific command line parameters, and then use CmdLineParser.add_legal to specify the arguments you expect in addition.
parser | A parser contaiing the command line arguments, excluding the program name. I.e. from main(int& argc,char** args), the parser would be called as parser.parse(arcg-1,args+1). |
Definition at line 272 of file unittest_EntryPoint.cpp.
std::ostream & unittest::operator<< | ( | std::ostream & | out, |
const std::multiset< K, C, A > & | s | ||
) |
Definition at line 105 of file unittest_Ostreams.tcc.
std::ostream & unittest::operator<< | ( | std::ostream & | out, |
const std::set< T, C > & | s | ||
) |
Definition at line 99 of file unittest_Ostreams.tcc.
std::ostream & unittest::operator<< | ( | std::ostream & | out, |
const std::vector< T, A > & | vec | ||
) |
Definition at line 81 of file unittest_Ostreams.tcc.
std::ostream & unittest::operator<< | ( | std::ostream & | out, |
const std::deque< T, A > & | d | ||
) |
Definition at line 93 of file unittest_Ostreams.tcc.
std::ostream & unittest::operator<< | ( | std::ostream & | out, |
const TimeFormat & | f | ||
) |
Definition at line 51 of file unittest_TimeFormat.cpp.
std::ostream & unittest::operator<< | ( | std::ostream & | out, |
const std::multimap< K, T, C, A > & | m | ||
) |
Definition at line 117 of file unittest_Ostreams.tcc.
std::ostream & unittest::operator<< | ( | std::ostream & | out, |
const std::map< K, T, C, A > & | m | ||
) |
Definition at line 111 of file unittest_Ostreams.tcc.
std::ostream & unittest::operator<< | ( | std::ostream & | out, |
const std::list< T, A > & | lst | ||
) |
Definition at line 87 of file unittest_Ostreams.tcc.
std::ostream & unittest::stream_objects | ( | std::ostream & | out, |
const Iterator & | start, | ||
const int | count, | ||
const char * | bounds | ||
) |
Definition at line 36 of file unittest_Ostreams.tcc.
std::ostream & unittest::stream_pairs | ( | std::ostream & | out, |
const Iterator & | start, | ||
const int | count, | ||
const char * | bounds | ||
) |
Definition at line 58 of file unittest_Ostreams.tcc.