393a4acb8ecc63ca70d689ae6bd75a8a0eefdc64
[mono.git] / eglib / test / test.c
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <stdarg.h>
4
5 #include "test.h"
6
7 void 
8 run_test(Test *test)
9 {
10         char *result; 
11         printf("  %s: ", test->name);
12         fflush(stdout);
13         if((result = test->handler()) == NULL) {
14                 printf("OK\n");
15         } else {
16                 printf("FAILED (%s)\n", result);
17                 /* It is ok to leak if the test fails, so we dont force people to use g_strdup */
18         }
19 }
20
21 void
22 run_group(Group *group)
23 {
24         Test *tests = group->handler();
25         int i;
26         
27         printf("[%s]\n", group->name);
28
29         for(i = 0; tests[i].name != NULL; i++) {
30                 run_test(&(tests[i]));
31         }
32 }
33