zenilib
0.5.3.0
|
#include "SDL_config.h"
#include "SDL_test.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
Go to the source code of this file.
Functions | |
float | GetClock () |
void | SDLTest_BailOut () |
Timeout handler. Aborts test run and exits harness process. More... | |
Uint64 | SDLTest_GenerateExecKey (char *runSeed, char *suiteName, char *testName, int iteration) |
char * | SDLTest_GenerateRunSeed (const int length) |
void | SDLTest_LogTestSuiteSummary (SDLTest_TestSuiteReference *testSuites) |
int | SDLTest_RunSuites (SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations) |
Execute a test suite using the given run seend and execution key. More... | |
int | SDLTest_RunTest (SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey) |
Execute a test using the given execution key. More... | |
SDL_TimerID | SDLTest_SetTestTimeout (int timeout, void(*callback)()) |
Set timeout handler for test. More... | |
Variables | |
const char * | SDLTest_FinalResultFormat = ">>> %s '%s': %s\n" |
const char * | SDLTest_InvalidNameFormat = "(Invalid)" |
const char * | SDLTest_LogSummaryFormat = "%s Summary: Total=%d Passed=%d Failed=%d Skipped=%d" |
static Uint32 | SDLTest_TestCaseTimeout = 3600 |
float GetClock | ( | ) |
Definition at line 343 of file SDL_test_harness.c.
Referenced by SDLTest_RunSuites().
void SDLTest_BailOut | ( | ) |
Timeout handler. Aborts test run and exits harness process.
Definition at line 208 of file SDL_test_harness.c.
References SDLTest_LogError(), and TEST_ABORTED.
Referenced by SDLTest_RunTest().
Generates an execution key for the fuzzer.
runSeed | The run seed to use |
suiteName | The name of the test suite |
testName | The name of the test |
iteration | The iteration count |
Definition at line 100 of file SDL_test_harness.c.
References SDLTest_Md5Context::digest, NULL, SDL_free(), SDL_malloc(), SDL_memset(), SDL_snprintf(), SDL_strlen(), SDLTest_LogError(), SDLTest_Md5Final(), SDLTest_Md5Init(), and SDLTest_Md5Update().
Referenced by SDLTest_RunSuites().
Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z).
Note: The returned string needs to be deallocated by the caller.
length | The length of the seed string to generate |
Definition at line 54 of file SDL_test_harness.c.
References NULL, SDL_malloc(), SDLTest_LogError(), SDLTest_Random(), and SDLTest_RandomInitTime().
Referenced by SDLTest_RunSuites().
void SDLTest_LogTestSuiteSummary | ( | SDLTest_TestSuiteReference * | testSuites | ) |
Definition at line 314 of file SDL_test_harness.c.
References SDLTest_TestCaseReference::description, SDLTest_TestCaseReference::name, SDLTest_TestSuiteReference::name, SDLTest_InvalidNameFormat, SDLTest_Log(), and SDLTest_TestSuiteReference::testCases.
int SDLTest_RunSuites | ( | SDLTest_TestSuiteReference * | testSuites[], |
const char * | userRunSeed, | ||
Uint64 | userExecKey, | ||
const char * | filter, | ||
int | testIterations | ||
) |
Execute a test suite using the given run seend and execution key.
Execute a test suite using the given run seed and execution key.
The filter string is matched to the suite name (full comparison) to select a single suite, or if no suite matches, it is matched to the test names (full comparison) to select a single test.
testSuites | Suites containing the test case. |
userRunSeed | Custom run seed provided by user, or NULL to autogenerate one. |
userExecKey | Custom execution key provided by user, or 0 to autogenerate one. |
filter | Filter specification. NULL disables. Case sensitive. |
testIterations | Number of iterations to run each test case. |
Definition at line 363 of file SDL_test_harness.c.
References SDLTest_TestCaseReference::description, SDLTest_TestCaseReference::enabled, GetClock(), if(), SDLTest_TestCaseReference::name, SDLTest_TestSuiteReference::name, NULL, SDL_strcmp(), SDLTest_FinalResultFormat, SDLTest_GenerateExecKey(), SDLTest_GenerateRunSeed(), SDLTest_InvalidNameFormat, SDLTest_Log(), SDLTest_LogError(), SDLTest_LogSummaryFormat, SDLTest_RunTest(), TEST_RESULT_FAILED, TEST_RESULT_NO_ASSERT, TEST_RESULT_PASSED, TEST_RESULT_SKIPPED, and SDLTest_TestSuiteReference::testCases.
int SDLTest_RunTest | ( | SDLTest_TestSuiteReference * | testSuite, |
SDLTest_TestCaseReference * | testCase, | ||
Uint64 | execKey | ||
) |
Execute a test using the given execution key.
testSuite | Suite containing the test case. |
testCase | Case to execute. |
execKey | Execution key for the fuzzer. |
Definition at line 224 of file SDL_test_harness.c.
References SDLTest_TestCaseReference::enabled, SDLTest_TestCaseReference::name, SDLTest_TestSuiteReference::name, NULL, SDL_RemoveTimer(), SDLTest_AssertSummaryToTestResult(), SDLTest_BailOut(), SDLTest_FinalResultFormat, SDLTest_FuzzerInit(), SDLTest_GetFuzzerInvocationCount(), SDLTest_Log(), SDLTest_LogAssertSummary(), SDLTest_LogError(), SDLTest_ResetAssertSummary(), SDLTest_SetTestTimeout(), SDLTest_TestCaseTimeout, TEST_ABORTED, TEST_RESULT_FAILED, TEST_RESULT_SETUP_FAILURE, TEST_RESULT_SKIPPED, TEST_SKIPPED, TEST_STARTED, SDLTest_TestCaseReference::testCase, SDLTest_TestSuiteReference::testSetUp, and SDLTest_TestSuiteReference::testTearDown.
Referenced by SDLTest_RunSuites().
SDL_TimerID SDLTest_SetTestTimeout | ( | int | timeout, |
void(*)() | callback | ||
) |
Set timeout handler for test.
Note: SDL_Init(SDL_INIT_TIMER) will be called if it wasn't done so before.
timeout | Timeout interval in seconds. |
callback | Function that will be called after timeout has elapsed. |
Definition at line 170 of file SDL_test_harness.c.
References NULL, SDL_AddTimer(), SDL_GetError(), SDL_INIT_TIMER, SDL_InitSubSystem(), SDL_WasInit(), and SDLTest_LogError().
Referenced by SDLTest_RunTest().
Definition at line 38 of file SDL_test_harness.c.
Referenced by SDLTest_RunSuites(), and SDLTest_RunTest().
const char* SDLTest_InvalidNameFormat = "(Invalid)" |
Definition at line 32 of file SDL_test_harness.c.
Referenced by SDLTest_LogTestSuiteSummary(), and SDLTest_RunSuites().
Definition at line 35 of file SDL_test_harness.c.
Referenced by SDLTest_RunSuites().
|
static |
Definition at line 41 of file SDL_test_harness.c.
Referenced by SDLTest_RunTest().