CppUnit project page FAQ CppUnit home page

Asserter.h
Go to the documentation of this file.
1#ifndef CPPUNIT_ASSERTER_H
2#define CPPUNIT_ASSERTER_H
3
6#include <string>
7
9
10
11class Message;
12
13
46{
49 static void CPPUNIT_API fail( const Message &message,
50 const SourceLine &sourceLine = SourceLine() );
51
55 static void CPPUNIT_API fail( std::string message,
56 const SourceLine &sourceLine = SourceLine() );
57
64 static void CPPUNIT_API failIf( bool shouldFail,
65 const Message &message,
66 const SourceLine &sourceLine = SourceLine() );
67
75 static void CPPUNIT_API failIf( bool shouldFail,
76 std::string message,
77 const SourceLine &sourceLine = SourceLine() );
78
88 static std::string CPPUNIT_API makeExpected( const std::string &expectedValue );
89
99 static std::string CPPUNIT_API makeActual( const std::string &actualValue );
100
101 static Message CPPUNIT_API makeNotEqualMessage( const std::string &expectedValue,
102 const std::string &actualValue,
103 const AdditionalMessage &additionalMessage = AdditionalMessage(),
104 const std::string &shortDescription = "equality assertion failed");
105
114 static void CPPUNIT_API failNotEqual( std::string expected,
115 std::string actual,
116 const SourceLine &sourceLine,
117 const AdditionalMessage &additionalMessage = AdditionalMessage(),
118 std::string shortDescription = "equality assertion failed" );
119
130 static void CPPUNIT_API failNotEqualIf( bool shouldFail,
131 std::string expected,
132 std::string actual,
133 const SourceLine &sourceLine,
134 const AdditionalMessage &additionalMessage = AdditionalMessage(),
135 std::string shortDescription = "equality assertion failed" );
136
137};
138
139
141
142
143#endif // CPPUNIT_ASSERTER_H
#define CPPUNIT_API
Definition CppUnitApi.h:27
#define CPPUNIT_NS_END
Definition Portability.h:120
#define CPPUNIT_NS_BEGIN
Definition Portability.h:119
An additional Message for assertions.
Definition AdditionalMessage.h:40
Message associated to an Exception.A message is composed of two items:
Definition Message.h:39
Represents a source line location.
Definition SourceLine.h:31
A set of functions to help writing assertion macros.
Definition Asserter.h:46
static std::string CPPUNIT_API makeExpected(const std::string &expectedValue)
Returns a expected value string for a message. Typically used to create 'not equal' message,...
Definition Asserter.cpp:45
static void CPPUNIT_API fail(const Message &message, const SourceLine &sourceLine=SourceLine())
Throws a Exception with the specified message and location.
Definition Asserter.cpp:18
static 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.
Definition Asserter.cpp:74
static 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.
Definition Asserter.cpp:89
static void CPPUNIT_API failIf(bool shouldFail, const Message &message, const SourceLine &sourceLine=SourceLine())
Throws a Exception with the specified message and location.
Definition Asserter.cpp:26
static std::string CPPUNIT_API makeActual(const std::string &actualValue)
Returns an actual value string for a message. Typically used to create 'not equal' message,...
Definition Asserter.cpp:52
static Message CPPUNIT_API makeNotEqualMessage(const std::string &expectedValue, const std::string &actualValue, const AdditionalMessage &additionalMessage=AdditionalMessage(), const std::string &shortDescription="equality assertion failed")
Definition Asserter.cpp:59

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