cxxtools::unit::Assertion Class Reference

Test Assertion exceptionAssertions are modeled as an exception type, which is thrown by Unit tests when an assertion has failed. More...

#include <cxxtools/unit/assertion.h>

Public Member Functions

 Assertion (const std::string &what, const SourceInfo &si)
 Construct from a message and source info.
const SourceInfosourceInfo () const
const char * what () const

Detailed Description

Test Assertion exception

Assertions are modeled as an exception type, which is thrown by Unit tests when an assertion has failed.

This class implements std::exception and overrides std::exception::what() to return an error message Besides the error message, Assertions can provide information where the exception was raised in the source code through a SourceInfo object. It is recommended to use the CXXTOOLS_UNIT_ASSERT for easy creation from a source info object.

void myTest()
{
int ten = 5 + 5;
}

Constructor & Destructor Documentation

cxxtools::unit::Assertion::Assertion ( const std::string &  what,
const SourceInfo si 
)

Construct from a message and source info.

Constructs a assertion exception from a message string and a source info object that describes where the assertion failed. Use the CXXTOOLS_UNIT_ASSERT macro instead of this constructor.

Parameters
whatError message
siInfo where the assertion failed

Member Function Documentation

const SourceInfo& cxxtools::unit::Assertion::sourceInfo ( ) const
const char* cxxtools::unit::Assertion::what ( ) const
inline

The documentation for this class was generated from the following file: