Core Library
|
Functions for writing simple unit tests. More...
#include "Common.hpp"
#include "UnitTest.hpp"
#include "StringUtils.hpp"
#include "tiostream.hpp"
#include "Algorithm.hpp"
#include "CmdLineException.hpp"
#include "CmdLineParser.hpp"
#include <algorithm>
#include <map>
#include <stdlib.h>
Classes | |
struct | Core::TestSetComparator |
Comparison functor for matching test sets against by test set name. More... | |
Namespaces | |
namespace | Core |
The Core Library namespace. | |
Typedefs | |
typedef std::map< tstring, TestSetFn > | Core::TestSets |
A collection of test sets. | |
typedef std::vector< tstring > | Core::TestCaseNames |
A collection of test case names. | |
Enumerations | |
enum | Core::SwitchID { Core::HELP = 0, Core::VERBOSE = 1, Core::QUIET = 2 } |
The test runner command line switch IDs. More... | |
enum | Core::TestResult { Core::UNKNOWN = 1, Core::SUCCEEDED = 2, Core::FAILED = 3 } |
Test case result state. More... | |
Functions | |
static void | Core::showUsage (const tchar *process, const Core::CmdLineParser &parser) |
Display the program options syntax. | |
bool | Core::parseCmdLine (int argc, tchar *argv[], TestSetFilters &filters) |
Parse the command line. | |
static TestSets & | Core::getTestSetCollection () |
Get the collection of test sets. | |
bool | Core::registerTestSet (const tchar *name, TestSetFn runner) |
Register a test set runner function. | |
bool | Core::runTestSets (const TestSetFilters &filters) |
Run the self-registering test sets. | |
void | Core::onStartTestSet (const tchar *name) |
Start the test set. | |
void | Core::onEndTestSet () |
End the test set. | |
void | Core::defineTestCaseSetup (TestCaseSetUpFn setup) |
Define the test case setup function. | |
void | Core::defineTestCaseTearDown (TestCaseTearDownFn teardown) |
Define the test case teardown function. | |
bool | Core::onStartTestCase (const tchar *name) |
Start a new test case. | |
void | Core::onEndTestCase () |
End a test case. | |
static const char * | Core::getFileName (const char *path) |
Get just the filename from the path. | |
void | Core::processAssertResult (const char *file, size_t line, const tchar *expression, bool passed) |
Write the assert result to stdout. | |
void | Core::processTestException (const char *file, size_t line, const tchar *error) |
Process an unexpected exception running a test case. | |
void | Core::processSetupTeardownException (const tchar *function, const tchar *error) |
Process an unexpected exception during setup or teardown. | |
void | Core::setTestRunFinalStatus (bool successful) |
Set how the test run completed. | |
void | Core::writeTestsSummary () |
Write the summary of the test results to the debugger stream and stdout. | |
int | Core::getTestProcessResult () |
Get the test process result code. | |
Variables | |
static bool | Core::s_successful = false |
The overall state of the test run. | |
static uint | Core::s_numPassed = 0 |
The number of tests that passed. | |
static uint | Core::s_numFailed = 0 |
The number of tests that failed. | |
static uint | Core::s_numUnknown = 0 |
The number of tests that were indeterminate. | |
static bool | Core::s_verbose = false |
Is verbose mode enabled? | |
static bool | Core::s_quiet = false |
Is quiet mode enabled? | |
static TestResult | Core::s_currentResult = UNKNOWN |
Current test case status. | |
static tstring | Core::s_currentTestSet |
The name of the executing test set. | |
static tstring | Core::s_currentTestCase |
The name of the executing test case. | |
static TestCaseNames | Core::s_failures |
The list of failed test cases for the set. | |
static TestCaseSetUpFn | Core::s_setup |
The test case SetUp function. | |
static TestCaseTearDownFn | Core::s_teardown |
The test case TearDown function. | |
static TestCaseNames | Core::s_executed |
The list of test cases executed. | |
static Core::CmdLineSwitch | Core::s_switches [] |
Parse the command line. | |
static size_t | Core::s_switchCount = ARRAY_SIZE(s_switches) |
Functions for writing simple unit tests.