UnitTest.hpp File Reference

Macros and functions for writing simple unit tests. More...


Namespaces

namespace  Core

Defines

#define TEST_TRUE(x)
 Test that the expression result is true.
#define TEST_FALSE(x)
 Test that the expression result is false.
#define TEST_THROWS(x)
 Test that the expression casuses an exception.

Functions

void Core::WriteTestResult (const char *pszFile, size_t nLine, const tchar *pszExpression, bool bPassed)
 Write the test results to stdout.
void Core::WriteTestsSummary ()
 Write the summary of the test results to stdout.
int Core::GetTestProcessResult ()
 Get the test process result code.


Detailed Description

Macros and functions for writing simple unit tests.

Author:
Chris Oldwood

Define Documentation

#define TEST_TRUE (  ) 

Value:

try {                                                                   \
                            if (x)  Core::WriteTestResult(__FILE__, __LINE__, TXT(#x), true);   \
                            else    Core::WriteTestResult(__FILE__, __LINE__, TXT(#x), false);  \
                        } catch(...) {                                                          \
                            Core::WriteTestResult(__FILE__, __LINE__, TXT(#x), false);          \
                        }
Test that the expression result is true.

#define TEST_FALSE (  ) 

Value:

try {                                                                   \
                            if (x)  Core::WriteTestResult(__FILE__, __LINE__, TXT(#x), false);  \
                            else    Core::WriteTestResult(__FILE__, __LINE__, TXT(#x), true);   \
                        } catch(...) {                                                          \
                            Core::WriteTestResult(__FILE__, __LINE__, TXT(#x), false);          \
                        }
Test that the expression result is false.

#define TEST_THROWS (  ) 

Value:

try {                                                                   \
                            (x);                                                                \
                            Core::WriteTestResult(__FILE__, __LINE__, TXT(#x), false);          \
                        } catch(const std::exception& /*e*/) {                                  \
                            Core::WriteTestResult(__FILE__, __LINE__, TXT(#x), true);           \
                        } catch(...) {                                                          \
                            Core::WriteTestResult(__FILE__, __LINE__, TXT(#x), false);          \
                        }
Test that the expression casuses an exception.


Generated on Wed Feb 13 22:53:28 2008 for Core Library by  doxygen 1.5.2