Added tests to testrect suite. Simple logger improvements. Fixed int-range fuzzer.

This commit is contained in:
Andreas Schiffler 2011-09-04 14:57:10 -07:00
parent d9a9cf5a98
commit 6584aa6a03
5 changed files with 216 additions and 19 deletions

View file

@ -195,19 +195,20 @@ RandomSint64()
Sint32
RandomIntegerInRange(Sint32 pMin, Sint32 pMax)
{
Sint64 min = (Sint64) pMin, max = (Sint64) pMax;
Sint64 min = pMin;
Sint64 max = pMax;
if(min > max) {
if(pMin > pMax) {
Sint64 temp = min;
min = max;
max = temp;
} else if(min == max) {
} else if(pMin == pMax) {
return min;
}
Sint32 number = RandomSint32(); // invocation count increment in there
Sint64 number = RandomUint32(); // invocation count increment in there
return (number % ((max + 1) - min)) + min;
return (Sint32)((number % ((max + 1) - min)) + min);
}
/*!

View file

@ -94,7 +94,6 @@ PlainRunStarted(int parameterCount, char *runnerParameters[], char *runSeed,
level = data->level;
//printf("Debug: %d == %d\n", level, data->level);
Output(indentLevel, "Test run started at %s", TimestampToString(eventTime));
Output(indentLevel, "Fuzzer seed is: %s", runSeed);
@ -113,6 +112,8 @@ void
PlainRunEnded(int testCount, int suiteCount, int testPassCount, int testFailCount,
int testSkippedCount, time_t endTime, double totalRuntime)
{
Output(indentLevel, "Test run ended at %s", TimestampToString(endTime));
Output(indentLevel, "Ran %d tests in %0.5f seconds from %d suites.",
testCount, totalRuntime, suiteCount);
@ -142,7 +143,7 @@ void
PlainTestStarted(const char *testName, const char *suiteName,
const char *testDescription, Uint64 execKey, time_t startTime)
{
Output(indentLevel, "Executing test: %s (in %s). Exec key: %llX", testName, suiteName, execKey);
Output(indentLevel, "Executing test: %s (in %s, exec key: %llX)", testName, suiteName, execKey);
Output(indentLevel++, "Test description: %s", testDescription);
}

View file

@ -1365,8 +1365,17 @@ main(int argc, char *argv[])
// if --show-tests option is given, only print tests and exit
if(only_print_tests) {
TestCase *testItem = NULL;
char *lastSuiteName = NULL;
for(testItem = testCases; testItem; testItem = testItem->next) {
printf("%s (in %s) - %s\n", testItem->testName, testItem->suiteName, testItem->description);
if ((lastSuiteName == NULL) || (strcmp(lastSuiteName, testItem->suiteName)!=0)) {
lastSuiteName = testItem->suiteName;
printf ("%s:\n", lastSuiteName);
}
printf(" %s: %s", testItem->testName, testItem->description);
if (testItem->timeout>0) {
printf (" (timeout: %i sec)", testItem->timeout);
}
printf ("\n");
}
return 0;