diff options
Diffstat (limited to 'minctest.c')
-rw-r--r-- | minctest.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -20,7 +20,7 @@ #include "minctest.h" -// Colours for terminal output +/* Colours for terminal output */ #define KRED "\x1B[31m" #define KGRN "\x1B[32m" #define RESET "\x1B[0m" @@ -39,9 +39,10 @@ struct tester *test_initialize() { void test_wrapup(struct tester* tester) { struct timeval end; + float time, used; gettimeofday(&end, NULL); - float time = (end.tv_usec - tester->created.tv_usec) / 1000.0; - float used = (tester->used) / 1000.0; + time = (end.tv_usec - tester->created.tv_usec) / 1000.0; + used = (tester->used) / 1000.0; if (tester->failed == 0) { printf(KGRN "\nAll tests passed (%d) [%.3fs / %.3fs]\n" RESET, @@ -70,9 +71,10 @@ void test_start_timer(struct tester *tester) { void test_true(struct tester *tester, bool check, const char* text) { struct timeval end; + float time; gettimeofday(&end, NULL); tester->used += end.tv_usec - tester->start_last_test.tv_usec; - float time = (end.tv_usec - tester->start_last_test.tv_usec) / 1000.0; + time = (end.tv_usec - tester->start_last_test.tv_usec) / 1000.0; if (!check || tester->show_pass) { puts(check ? KGRN : KRED); |