32 #define SDLTEST_INVALID_NAME_FORMAT "(Invalid)"
35 #define SDLTEST_LOG_SUMMARY_FORMAT "%s Summary: Total=%d Passed=%d Failed=%d Skipped=%d"
38 #define SDLTEST_FINAL_RESULT_FORMAT ">>> %s '%s': %s\n"
78 char ch = (char) (number % (91 - 48)) + 48;
79 if (ch >= 58 && ch <= 64) {
105 char iterationString[16];
106 size_t runSeedLength;
107 size_t suiteNameLength;
108 size_t testNameLength;
109 size_t iterationStringLength;
110 size_t entireStringLength;
113 if (runSeed ==
NULL || runSeed[0] ==
'\0') {
118 if (suiteName ==
NULL || suiteName[0] ==
'\0') {
123 if (testName ==
NULL || testName[0] ==
'\0') {
134 SDL_memset(iterationString, 0,
sizeof(iterationString));
141 iterationStringLength =
SDL_strlen(iterationString);
142 entireStringLength = runSeedLength + suiteNameLength + testNameLength + iterationStringLength + 1;
174 Uint32 timeoutInMilliseconds;
196 timeoutInMilliseconds =
timeout * 1000;
209 #if defined(__WATCOMC__)
210 #pragma aux SDLTest_BailOut aborts;
233 int testCaseResult = 0;
297 if (fuzzerCount > 0) {
298 SDLTest_Log(
"Fuzzer invocations: %d", fuzzerCount);
352 float currentClock = clock() / (float) CLOCKS_PER_SEC;
372 int totalNumberOfTests = 0;
373 int failedNumberOfTests = 0;
376 int iterationCounter;
379 const char *runSeed =
NULL;
380 char *currentSuiteName;
381 char *currentTestName;
383 float runStartSeconds;
384 float suiteStartSeconds;
385 float testStartSeconds;
387 float suiteEndSeconds;
388 float testEndSeconds;
391 char *suiteFilterName =
NULL;
393 char *testFilterName =
NULL;
397 Uint32 totalTestFailedCount = 0;
398 Uint32 totalTestPassedCount = 0;
399 Uint32 totalTestSkippedCount = 0;
400 Uint32 testFailedCount = 0;
401 Uint32 testPassedCount = 0;
402 Uint32 testSkippedCount = 0;
407 if (testIterations < 1) {
412 if (userRunSeed ==
NULL || userRunSeed[0] ==
'\0') {
414 if (runSeed ==
NULL) {
419 runSeed = userRunSeed;
424 totalTestFailedCount = 0;
425 totalTestPassedCount = 0;
426 totalTestSkippedCount = 0;
432 SDLTest_Log(
"::::: Test Run /w seed '%s' started\n", runSeed);
440 while (testSuite->
testCases[testCounter])
443 totalNumberOfTests++;
449 if (failedTests ==
NULL) {
459 while (
testSuites[suiteCounter] && suiteFilter == 0) {
465 suiteFilterName = testSuite->
name;
466 SDLTest_Log(
"Filtering: running only suite '%s'", suiteFilterName);
472 while (testSuite->
testCases[testCounter] && testFilter == 0)
474 testCase = testSuite->
testCases[testCounter];
479 suiteFilterName = testSuite->
name;
481 testFilterName = testCase->
name;
482 SDLTest_Log(
"Filtering: running only test '%s' in suite '%s'", testFilterName, suiteFilterName);
488 if (suiteFilter == 0 && testFilter == 0) {
504 if (suiteFilter == 1 && suiteFilterName !=
NULL && testSuite->
name !=
NULL &&
515 testSkippedCount = 0;
529 testCase = testSuite->
testCases[testCounter];
534 if (testFilter == 1 && testFilterName !=
NULL && testCase->
name !=
NULL &&
537 SDLTest_Log(
"===== Test Case %i.%i: '%s' skipped\n",
543 if (testFilter == 1 && !testCase->
enabled) {
544 SDLTest_Log(
"Force run of disabled test since test filter was set");
562 iterationCounter = 0;
563 while(iterationCounter < testIterations)
567 if (userExecKey != 0) {
568 execKey = userExecKey;
574 testResult =
SDLTest_RunTest(testSuite, testCase, execKey, forceTestRun);
578 totalTestPassedCount++;
581 totalTestSkippedCount++;
584 totalTestFailedCount++;
590 runtime = testEndSeconds - testStartSeconds;
591 if (runtime < 0.0
f) runtime = 0.0f;
593 if (testIterations > 1) {
595 SDLTest_Log(
"Runtime of %i iterations: %.1f sec", testIterations, runtime);
596 SDLTest_Log(
"Average Test runtime: %.5f sec", runtime / (
float)testIterations);
599 SDLTest_Log(
"Total Test runtime: %.1f sec", runtime);
603 switch (testResult) {
617 failedTests[failedNumberOfTests] = testCase;
618 failedNumberOfTests++;
625 runtime = suiteEndSeconds - suiteStartSeconds;
626 if (runtime < 0.0
f) runtime = 0.0f;
629 SDLTest_Log(
"Total Suite runtime: %.1f sec", runtime);
632 countSum = testPassedCount + testFailedCount + testSkippedCount;
633 if (testFailedCount == 0)
649 runtime = runEndSeconds - runStartSeconds;
650 if (runtime < 0.0
f) runtime = 0.0f;
653 SDLTest_Log(
"Total Run runtime: %.1f sec", runtime);
656 countSum = totalTestPassedCount + totalTestFailedCount + totalTestSkippedCount;
657 if (totalTestFailedCount == 0)
671 if (failedNumberOfTests > 0) {
673 for (testCounter = 0; testCounter < failedNumberOfTests; testCounter++) {
674 SDLTest_Log(
" --seed %s --filter %s", runSeed, failedTests[testCounter]->
name);