blob: 9333aec3956a60a741ac51b8e45e93f970e0e00d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include <stdio.h>
#include <stdbool.h>
#include <time.h>
#define TEST_MOD
#include "../generated/tests.c"
double diff_time(struct timespec a, struct timespec b) {
double a_time = (double)a.tv_sec + a.tv_nsec * 1e-9;
double b_time = (double)b.tv_sec + b.tv_nsec * 1e-9;
return a_time - b_time;
}
int main() {
int i = 0;
while (i < total_test_count) {
char padded_testname[max_test_name_size + 2];
int j = 0;
while (test_names[i][j] != 0) {
padded_testname[j] = test_names[i][j];
j++;
}
while (j < max_test_name_size + 2) {
padded_testname[j++] = ' ';
}
padded_testname[j] = 0;
printf("%s", padded_testname);
fflush(stdout);
struct timespec begin, end;
clock_gettime(CLOCK_MONOTONIC, &begin);
bool result = tests[i]();
clock_gettime(CLOCK_MONOTONIC, &end);
printf(" %s %.2lfs\n", result ? "P" : "F", diff_time(end, begin));
i++;
}
}
|