You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
658 B
22 lines
658 B
#include <stdio.h>
|
|
#include "test_framework.h"
|
|
|
|
void run_tests(struct Test *tests, const char *module_name) {
|
|
printf("Running tests module \"%s\"...\n\n", module_name);
|
|
|
|
struct Test *t = &tests[0];
|
|
int passed = 0, failed = 0;
|
|
do {
|
|
printf("Running test \"%s\"...\n", t->name);
|
|
|
|
if (t->func()) {
|
|
printf("Test %s \x1b[32mPASSED\x1b[m\n", t->name);
|
|
passed++;
|
|
} else {
|
|
printf("Test %s \x1b[31mFAILED\x1b[m\n", t->name);
|
|
failed++;
|
|
}
|
|
} while((++t)->name != NULL);
|
|
|
|
printf("\nTests module \"%s\" done. %d passed, %d failed.\n\n", module_name, passed, failed);
|
|
}
|
|
|