munittest::MUnittest Class Reference

A unittest class. More...

#include <munittest.h>

List of all members.

Public Member Functions

 MUnittest (const MString &unitName)
 ~MUnittest ()
void begin (const MString &title)
bool test (bool result, const MString &failureComment=MString())
bool test (char result, char expected)
bool test (int result, int expected)
bool test (long result, long expected)
bool test (uint result, uint expected)
bool test (ulong result, ulong expected)
bool test (float result, float expected)
bool test (double result, double expected)
bool test (const MString &result)
bool test (const MString &result, const MString &expected)
bool test (const MStringList &result, const MStringList &expected)
void comment (const MString &comment) const
bool totals ()
void setExitOnError (bool exitOnError)
bool exitOnError () const


Detailed Description

A lightweight unittest class. Uses MString.
Author:
Martin "Murphy" Gebert <Murphy dot Gebert at gmx dot de>


Constructor & Destructor Documentation

munittest::MUnittest::MUnittest ( const MString unitName  ) 

Constructs a unit test for a unit with the given name.

munittest::MUnittest::~MUnittest (  ) 


Member Function Documentation

void munittest::MUnittest::begin ( const MString title  ) 

Marks the end of a previous and the beginning of a new test and sets its title. If the title is empty nothing will be prompted on beginning. If no test() calls have been made the test will not be counted in the totals.

bool munittest::MUnittest::test ( bool  result,
const MString failureComment = MString() 
)

Echo a test result (true if test passed) with an optional comment on failure. Returns the result.

bool munittest::MUnittest::test ( char  result,
char  expected 
)

Test a char against an expected value. Returns the result.

bool munittest::MUnittest::test ( int  result,
int  expected 
)

Test an int against an expected value. Returns the result.

bool munittest::MUnittest::test ( long  result,
long  expected 
)

Test a long int against an expected value. Returns the result.

bool munittest::MUnittest::test ( uint  result,
uint  expected 
)

Test an unsigned int against an expected value. Returns the result.

bool munittest::MUnittest::test ( ulong  result,
ulong  expected 
)

Test an unsigned long int an expected value. Returns the result.

bool munittest::MUnittest::test ( float  result,
float  expected 
)

Test a float against an expected value. Returns the result.

bool munittest::MUnittest::test ( double  result,
double  expected 
)

Test a double precision against an expected value. Returns the result.

bool munittest::MUnittest::test ( const MString result  ) 

Test a string on not being empty. Returns the result.

bool munittest::MUnittest::test ( const MString result,
const MString expected 
)

Test a string against an expected value. Returns the result.

bool munittest::MUnittest::test ( const MStringList result,
const MStringList expected 
)

Test a string list against an expected list. Returns the result.

void munittest::MUnittest::comment ( const MString comment  )  const

Displays a comment on the current test.

bool munittest::MUnittest::totals (  ) 

Prints the totals and resets the state of the test object. Returns true if all tests had been successful.

void munittest::MUnittest::setExitOnError ( bool  exitOnError  ) 

Set if the test should be aborted on the first error. Default is false.

bool munittest::MUnittest::exitOnError (  )  const

Get the current exit-on-error setting.


Generated on Mon Jul 30 23:50:20 2007 for MString by  doxygen 1.5.2