asserts.h File Reference
`#include <stdexcept>`
`#include <sstream>`
`#include <vector>`
`#include <ostream>`

Go to the source code of this file.

## Classes

class | AssertException
struct | TestInternal::StdData

## Namespaces

namespace | TestInternal

## Macros

#define | STD_DATA TestInternal::StdData(__LINE__, __FILE__, __nameOfTest, __printDots)
#define | SILENT(X)
#define | ASSERT_EXCEPTION(CODE, EXCEPTION_TYPE)
#define | ASSERT_TRUE(VALUE)
#define | ASSERT_TRUE_SILENT(VALUE)
#define | ASSERT_TRUE1(VALUE, X)
#define | ASSERT_FALSE1(VALUE, X)
#define | ASSERT_TRUE2(VALUE, X, Y)
#define | ASSERT_FALSE2(VALUE, X, Y)
#define | ASSERT_TRUE2_SILENT(VALUE, A, B)
#define | ASSERT_FALSE(VALUE)
#define | ASSERT_FALSE_SILENT(VALUE)
#define | ASSERT_EQ(A, B)
#define | ASSERT_EQ_SILENT(A, B)
#define | ASSERT_NEQ(A, B)
#define | ASSERT_NEQ_SILENT(A, B)

## Functions

template<class T>
string | TestInternal::toStr (const T &t)
template<class T>
ostream & | TestInternal::operator<< (ostream &out, const vector< T > &v)
| Prints out a vector.
void | TestInternal::assertOK (const StdData &data)
void | TestInternal::assertFail (const char *cond, const char *expected, const StdData &data)
void | TestInternal::assertFail1 (const char *cond, const char *expected, const StdData &data, const char *exp1, string exp1Value)
void | TestInternal::assertFail2 (const char *cond, const char *expected, const StdData &data, const char *exp1, string exp1Value, const char *exp2, string exp2Value)
void | TestInternal::assertSucceeded (bool printDot)
void | TestInternal::assertFailed (const char *errorMsg, const char *testName, const char *file, size_t line)
void | TestInternal::assertTrue (bool value, const char *valueString, const char *testName, const char *file, size_t line, bool printDot)
void | TestInternal::assertTrue2Failed (const char *valueString, const char *testName, const char *file, size_t line, const char *expression1, const char *expression1Value, const char *expression2, const char *expression2Value)
template<class A, class B>
void | TestInternal::assertTrue2 (bool value, const char *valueString, const char *testName, const char *file, size_t line, const char *expression1, const A &a, const char *expression2, const B &b, bool printDot)
void | TestInternal::assertFalse (bool value, const char *valueString, const char *testName, const char *file, size_t line, bool printDot)
void | TestInternal::assertEqualFailed (const char *a, const char *b, const char *aString, const char *bString, const char *testName, const char *file, size_t line)
template<class T1, class T2>
void | TestInternal::assertEqual (const T1 &a, const T2 &b, const char *aString, const char *bString, const char *testName, const char *file, size_t line, bool printDot)
void | TestInternal::assertNotEqualFailed (const char *a, const char *b, const char *aString, const char *bString, const char *testName, const char *file, size_t line)
template<class T1, class T2>
void | TestInternal::assertNotEqual (const T1 &a, const T2 &b, const char *aString, const char *bString, const char *testName, const char *file, size_t line, bool printDot)

## Macro Definition Documentation

## ASSERT_EQ

#define ASSERT_EQ | ( |  | A,
|  |  | B )

Value:
TestInternal::assertEqual(A, B, #A, #B, __nameOfTest, __FILE__, __LINE__, __printDots)
TestInternal::assertEqual
void assertEqual(const T1 &a, const T2 &b, const char *aString, const char *bString, const char *testName, const char *file, size_t line, bool printDot)
Definition asserts.h:133

Definition at line 152 of file asserts.h.

## ASSERT_EQ_SILENT

#define ASSERT_EQ_SILENT | ( |  | A,
|  |  | B )

Value:
TestInternal::assertEqual(A, B, #A, #B, __nameOfTest, __FILE__, __LINE__, false)

Definition at line 154 of file asserts.h.

## ASSERT_EXCEPTION

#define ASSERT_EXCEPTION | ( |  | CODE,
|  |  | EXCEPTION_TYPE )

Value:
{bool _frobby_sawException = false; \
try {CODE;} catch (EXCEPTION_TYPE) {_frobby_sawException = true;} \
if (_frobby_sawException)assertOK(STD_DATA); \
else assertFail(#CODE,"throw exception of type " #EXCEPTION_TYPE,STD_DATA);}
STD_DATA
#define STD_DATA
Definition asserts.h:42
TestInternal::assertOK
void assertOK(const StdData &data)
Definition asserts.cpp:31
TestInternal::assertFail
void assertFail(const char *cond, const char *expected, const StdData &data)
Definition asserts.cpp:38

Definition at line 71 of file asserts.h.

## ASSERT_FALSE

#define ASSERT_FALSE | ( |  | VALUE | ) |

Value:
TestInternal::assertFalse(VALUE, #VALUE, __nameOfTest, __FILE__, __LINE__, __printDots)
TestInternal::assertFalse
void assertFalse(bool value, const char *valueString, const char *testName, const char *file, size_t line, bool printDot)
Definition asserts.cpp:178

Definition at line 124 of file asserts.h.

## ASSERT_FALSE1

#define ASSERT_FALSE1 | ( |  | VALUE,
|  |  | X )

Value:
{if(!VALUE)assertOK(STD_DATA);else assertFail1(#VALUE,"false",STD_DATA,#X,TestInternal::toStr(X));}
TestInternal::toStr
string toStr(const T &t)
Definition asserts.h:47

Definition at line 83 of file asserts.h.

## ASSERT_FALSE2

#define ASSERT_FALSE2 | ( |  | VALUE,
|  |  | X,
|  |  | Y )

Value:
{if(!VALUE)assertOK(STD_DATA);else assertFail2(#VALUE,"false",STD_DATA,#X,TestInternal::toStr(X),#Y,TestInternal::toStr(Y));}

Definition at line 88 of file asserts.h.

## ASSERT_FALSE_SILENT

#define ASSERT_FALSE_SILENT | ( |  | VALUE | ) |

Value:
TestInternal::assertFalse(VALUE, #VALUE, __nameOfTest, __FILE__, __LINE__, false)

Definition at line 126 of file asserts.h.

## ASSERT_NEQ

#define ASSERT_NEQ | ( |  | A,
|  |  | B )

Value:
TestInternal::assertNotEqual(A, B, #A, #B, __nameOfTest, __FILE__, __LINE__, __printDots)
TestInternal::assertNotEqual
void assertNotEqual(const T1 &a, const T2 &b, const char *aString, const char *bString, const char *testName, const char *file, size_t line, bool printDot)
Definition asserts.h:161

Definition at line 180 of file asserts.h.

## ASSERT_NEQ_SILENT

#define ASSERT_NEQ_SILENT | ( |  | A,
|  |  | B )

Value:
TestInternal::assertNotEqual(A, B, #A, #B, __nameOfTest, __FILE__, __LINE__, false)

Definition at line 182 of file asserts.h.

## ASSERT_TRUE

#define ASSERT_TRUE | ( |  | VALUE | ) |

Value:
{if(VALUE)assertOK(STD_DATA);else assertFail(#VALUE,"true",STD_DATA);}

Definition at line 77 of file asserts.h.

## ASSERT_TRUE1

#define ASSERT_TRUE1 | ( |  | VALUE,
|  |  | X )

Value:
{if(VALUE)assertOK(STD_DATA);else assertFail1(#VALUE,"true",STD_DATA,#X,TestInternal::toStr(X));}

Definition at line 81 of file asserts.h.

## ASSERT_TRUE2

#define ASSERT_TRUE2 | ( |  | VALUE,
|  |  | X,
|  |  | Y )

Value:
{if(VALUE)assertOK(STD_DATA);else assertFail2(#VALUE,"true",STD_DATA,#X,TestInternal::toStr(X),#Y,TestInternal::toStr(Y));}

Definition at line 86 of file asserts.h.

## ASSERT_TRUE2_SILENT

#define ASSERT_TRUE2_SILENT | ( |  | VALUE,
|  |  | A,
|  |  | B )

Value:
TestInternal::assertTrue2(VALUE, #VALUE, __nameOfTest, __FILE__, __LINE__, \
#A,A,#B,B, false);
TestInternal::assertTrue2
void assertTrue2(bool value, const char *valueString, const char *testName, const char *file, size_t line, const char *expression1, const A &a, const char *expression2, const B &b, bool printDot)
Definition asserts.h:96

Definition at line 116 of file asserts.h.

## ASSERT_TRUE_SILENT

#define ASSERT_TRUE_SILENT | ( |  | VALUE | ) |

Value:
SILENT(ASSERT_TRUE(VALUE))
SILENT
#define SILENT(X)
Definition asserts.h:43
ASSERT_TRUE
#define ASSERT_TRUE(VALUE)
Definition asserts.h:77

Definition at line 79 of file asserts.h.

## SILENT

#define SILENT | ( |  | X | ) |

Value:
{bool ___printDots = __printDots; __printDots = false; X; __printDots = ___printDots;}

Definition at line 43 of file asserts.h.

## STD_DATA

#define STD_DATA TestInternal::StdData(__LINE__, __FILE__, __nameOfTest, __printDots)

Definition at line 42 of file asserts.h.