CppUnit project page FAQ CppUnit home page

Creating custom assertions

Collaboration diagram for Creating custom assertions:

Classes

class  AdditionalMessage
 An additional Message for assertions.

Provides a implicit constructor that takes a single string. This allow this class to be used as the message arguments in macros. More...

struct  Asserter
 A set of functions to help writing assertion macros.

Here is an example of assertion, a simplified version of the actual assertion implemented in examples/cppunittest/XmlUniformiser.h:. More...

class  Message
 Message associated to an Exception.

A message is composed of two items:

  • a short description (~20/30 characters)
  • a list of detail strings.
More...
class  SourceLine
 Represents a source line location.

Used to capture the failure location in assertion. More...


Defines

#define CPPUNIT_SOURCELINE()   CPPUNIT_NS::SourceLine( __FILE__, __LINE__ )
 Constructs a SourceLine object initialized with the location where the macro is expanded.

Define Documentation

 
#define CPPUNIT_SOURCELINE (  )     CPPUNIT_NS::SourceLine( __FILE__, __LINE__ )

Constructs a SourceLine object initialized with the location where the macro is expanded.

Used to write your own assertion macros.

See also:
Asserter for example of usage.


SourceForge Logo hosts this site. Send comments to:
CppUnit Developers