Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code

This commit is contained in:
Andreas Schiffler 2012-12-14 23:05:34 -08:00
parent dfe7f2bc59
commit a6185d6ad9
10 changed files with 907 additions and 94 deletions

View file

@ -49,9 +49,13 @@ extern "C" {
/* *INDENT-ON* */
#endif
/* Function prototypes */
/* Global definitions */
/* ADD STUFF HERE */
/*
* Note: Maximum size of SDLTest log message is less than SDLs limit
* to ensure we can fit additional information such as the timestamp.
*/
#define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

View file

@ -60,17 +60,24 @@ extern "C" {
* \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
* \param assertDescription Message to log with the assert describing it.
*/
void SDLTest_Assert(int assertCondition, char *assertDescription);
void SDLTest_Assert(int assertCondition, char *assertDescription, ...);
/**
* \brief Assert for test cases that logs but does not break execution flow on failures.
* \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters.
*
* \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
* \param assertDescription Message to log with the assert describing it.
*
* \returns Returns the assertCondition so it can be used to externall to break execution flow if desired.
* \returns Returns the assertCondition so it can be used to externally to break execution flow if desired.
*/
int SDLTest_AssertCheck(int assertCondition, char *assertDescription);
int SDLTest_AssertCheck(int assertCondition, char *assertDescription, ...);
/**
* \brief Explicitely pass without checking an assertion condition. Updates assertion counter.
*
* \param assertDescription Message to log with the assert describing it.
*/
void SDLTest_AssertPass(char *assertDescription, ...);
/**
* \brief Resets the assert summary counters to zero.

View file

@ -98,6 +98,20 @@ typedef struct SDLTest_TestSuiteReference {
SDLTest_TestCaseTearDownFp testTearDown;
} SDLTest_TestSuiteReference;
/**
* \brief Execute a test suite using the given run seed and execution key.
*
* \param testSuites Suites containing the test case.
* \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one.
* \param userExecKey Custom execution key provided by user, or 0 to autogenerate one.
* \param testIterations Number of iterations to run each test case.
*
* \returns Test run result; 0 when all tests passed, 1 if any tests failed.
*/
int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], char *userRunSeed, Uint64 userExecKey, int testIterations);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
/* *INDENT-OFF* */