CppUnit project page | FAQ | CppUnit home page |
#include <Asserter.h>
Static Public Member Functions | |
void CPPUNIT_API | fail (const Message &message, const SourceLine &sourceLine=SourceLine()) |
Throws a Exception with the specified message and location. | |
void CPPUNIT_API | fail (std::string message, const SourceLine &sourceLine=SourceLine()) |
Throws a Exception with the specified message and location. | |
void CPPUNIT_API | failIf (bool shouldFail, const Message &message, const SourceLine &sourceLine=SourceLine()) |
Throws a Exception with the specified message and location. | |
void CPPUNIT_API | failIf (bool shouldFail, std::string message, const SourceLine &sourceLine=SourceLine()) |
Throws a Exception with the specified message and location. | |
std::string CPPUNIT_API | makeExpected (const std::string &expectedValue) |
Returns a expected value string for a message. Typically used to create 'not equal' message, or to check that a message contains the expected content when writing unit tests for your custom assertions. | |
std::string CPPUNIT_API | makeActual (const std::string &actualValue) |
Returns an actual value string for a message. Typically used to create 'not equal' message, or to check that a message contains the expected content when writing unit tests for your custom assertions. | |
Message CPPUNIT_API | makeNotEqualMessage (const std::string &expectedValue, const std::string &actualValue, const AdditionalMessage &additionalMessage=AdditionalMessage(), const std::string &shortDescription="equality assertion failed") |
void CPPUNIT_API | failNotEqual (std::string expected, std::string actual, const SourceLine &sourceLine, const AdditionalMessage &additionalMessage=AdditionalMessage(), std::string shortDescription="equality assertion failed") |
Throws an Exception with the specified message and location. | |
void CPPUNIT_API | failNotEqualIf (bool shouldFail, std::string expected, std::string actual, const SourceLine &sourceLine, const AdditionalMessage &additionalMessage=AdditionalMessage(), std::string shortDescription="equality assertion failed") |
Throws an Exception with the specified message and location. |
Here is an example of assertion, a simplified version of the actual assertion implemented in examples/cppunittest/XmlUniformiser.h:
#include <cppunit/SourceLine.h> #include <cppunit/TestAssert.h> void checkXmlEqual( std::string expectedXml, std::string actualXml, CppUnit::SourceLine sourceLine ) { std::string expected = XmlUniformiser( expectedXml ).stripped(); std::string actual = XmlUniformiser( actualXml ).stripped(); if ( expected == actual ) return; ::CppUnit::Asserter::failNotEqual( expected, actual, sourceLine ); } #define CPPUNITTEST_ASSERT_XML_EQUAL( expected, actual ) \ checkXmlEqual( expected, actual, \ CPPUNIT_SOURCELINE() )
|
Throws a Exception with the specified message and location.
|
|
Throws a Exception with the specified message and location.
|
|
Throws a Exception with the specified message and location.
|
|
Throws a Exception with the specified message and location.
|
|
Throws an Exception with the specified message and location.
|
|
Throws an Exception with the specified message and location.
|
|
Returns an actual value string for a message. Typically used to create 'not equal' message, or to check that a message contains the expected content when writing unit tests for your custom assertions.
|
|
Returns a expected value string for a message. Typically used to create 'not equal' message, or to check that a message contains the expected content when writing unit tests for your custom assertions.
|
|
|
hosts this site. |
Send comments to: CppUnit Developers |