unittest Namespace Reference


Detailed Description

Classes, methods and marcos to write unit tests using the ut4cpp framework.


Classes

class  Throwable
 An exception class that can be used as a base class for specific exceptions, ut4cpp catches this exception and is able to output a meaningful message. More...
class  AssertionException
 ut4cpp raises a AssertionException exception when an assertion fails. More...
class  Test
 The actual tests must implement this Test interface. More...
class  TestReport
 A TestReport object is used to record the test results. More...
class  TestSet
 A TestSet contains all the tests to run. More...

Typedefs

typedef Test *(* TestFactory )()
 Method signature for test factory methods.
typedef void(* SetupMethod )()
 Method signature for setup methods.
typedef void(* TeardownMethod )()
 Method signature for tear down methods.

Functions

void fail (string msg)
 Raises a AssertionException setting the given message as the cause the failure.
void assertTrue (string msg, bool assertion)
 Raises a AssertionException if the given assertion is not true.
template<typename T>
void assertEquals (string msg, const T &expected, const T &actual)
 Compares the expected and actual values, if they are not equal, raises a AssertionException.
template<typename T>
void assertEquals (const T &expected, const T &actual)
 Compares the expected and actual values, if they are not equal, raises a AssertionException.
template<typename T>
void assertNotEquals (string msg, const T &expected, const T &actual)
 Compares the expected and actual values, if they are equal, raises a AssertionException.
template<typename T>
void assertNotEquals (const T &expected, const T &actual)
 Compares the expected and actual values, if they are equal, raises a AssertionException.
void assertTrue (bool assertion)
 Raises a AssertionException if the given assertion is not true.
void assertFalse (bool assertion)
 Raises a AssertionException if the given assertion is true.
void assertFalse (string msg, bool assertion)
 Raises a AssertionException if the given assertion is true.
void assertEquals (const char *expected, const char *actual)
 Compares two C strings (char*), if they are not equal, raises a AssertionException.
void assertEquals (const char *expected, string actual)
 Compares a C string (char*) with a string object, if they are not equal, raises a AssertionException.
void assertEquals (string expected, const char *actual)
 Compares a string object with a C string (char*) , if they are not equal, raises a AssertionException.
void assertNotEquals (const char *expected, const char *actual)
 Compares two C strings (char*), if they are equal, raises a AssertionException.
void assertNotEquals (const char *expected, string actual)
 Compares a C string (char*) with a string object, if they are equal, raises a AssertionException.
void assertNotEquals (string expected, const char *actual)
 Compares a string object with a C string (char*) , if they are equal, raises a AssertionException.


Function Documentation

void unittest::assertEquals string  expected,
const char *  actual
[inline]
 

Compares a string object with a C string (char*) , if they are not equal, raises a AssertionException.

Parameters:
expected the expected string
actual the actual C string

Definition at line 460 of file Assertion.hpp.

References assertEquals().

void unittest::assertEquals const char *  expected,
string  actual
[inline]
 

Compares a C string (char*) with a string object, if they are not equal, raises a AssertionException.

Parameters:
expected the expected C string
actual the actual string

Definition at line 452 of file Assertion.hpp.

References assertEquals().

void unittest::assertEquals const char *  expected,
const char *  actual
[inline]
 

Compares two C strings (char*), if they are not equal, raises a AssertionException.

Parameters:
expected the expected string
actual the actual string

Definition at line 444 of file Assertion.hpp.

References assertEquals().

template<typename T>
void unittest::assertEquals const T &  expected,
const T &  actual
 

Compares the expected and actual values, if they are not equal, raises a AssertionException.

Parameters:
expected the expected value
actual the actual value

Definition at line 358 of file Assertion.hpp.

template<typename T>
void unittest::assertEquals string  msg,
const T &  expected,
const T &  actual
 

Compares the expected and actual values, if they are not equal, raises a AssertionException.

Parameters:
msg the description to add to the exception message
expected the expected value
actual the actual value
Examples:
TestAssertion.cpp.

Definition at line 334 of file Assertion.hpp.

Referenced by assertEquals().

void unittest::assertFalse string  msg,
bool  assertion
[inline]
 

Raises a AssertionException if the given assertion is true.

Parameters:
msg the description to add to the exception message
assertion the value to assert being false

Definition at line 433 of file Assertion.hpp.

References assertTrue().

void unittest::assertFalse bool  assertion  )  [inline]
 

Raises a AssertionException if the given assertion is true.

Parameters:
assertion the value to assert being false

Definition at line 425 of file Assertion.hpp.

References assertTrue().

void unittest::assertNotEquals string  expected,
const char *  actual
[inline]
 

Compares a string object with a C string (char*) , if they are equal, raises a AssertionException.

Parameters:
expected the expected string
actual the actual C string

Definition at line 487 of file Assertion.hpp.

References assertNotEquals().

void unittest::assertNotEquals const char *  expected,
string  actual
[inline]
 

Compares a C string (char*) with a string object, if they are equal, raises a AssertionException.

Parameters:
expected the expected C string
actual the actual string

Definition at line 479 of file Assertion.hpp.

References assertNotEquals().

void unittest::assertNotEquals const char *  expected,
const char *  actual
[inline]
 

Compares two C strings (char*), if they are equal, raises a AssertionException.

Parameters:
expected the expected string
actual the actual string

Definition at line 471 of file Assertion.hpp.

References assertNotEquals().

template<typename T>
void unittest::assertNotEquals const T &  expected,
const T &  actual
 

Compares the expected and actual values, if they are equal, raises a AssertionException.

Parameters:
expected the expected value
actual the actual value

Definition at line 397 of file Assertion.hpp.

template<typename T>
void unittest::assertNotEquals string  msg,
const T &  expected,
const T &  actual
 

Compares the expected and actual values, if they are equal, raises a AssertionException.

Parameters:
msg the description to add to the exception message
expected the expected value
actual the actual value
Examples:
TestAssertion.cpp.

Definition at line 373 of file Assertion.hpp.

Referenced by assertNotEquals().

void unittest::assertTrue bool  assertion  )  [inline]
 

Raises a AssertionException if the given assertion is not true.

Parameters:
assertion the value to assert being true
Examples:
TestAssertion.cpp.

Definition at line 418 of file Assertion.hpp.

References assertTrue().

void unittest::assertTrue string  msg,
bool  assertion
 

Raises a AssertionException if the given assertion is not true.

Parameters:
msg the description to add to the exception message
assertion the value to assert being true
Examples:
TestAssertion.cpp.

Definition at line 411 of file Assertion.cpp.

Referenced by assertFalse(), and assertTrue().

void unittest::fail string  msg  ) 
 

Raises a AssertionException setting the given message as the cause the failure.

Parameters:
msg the description of the failure

Definition at line 405 of file Assertion.cpp.


Generated on Mon Jun 5 22:05:27 2006 for ut4cpp by  doxygen 1.4.6-NO