Debian Codegraph @

research/minunit_example.c

raw symbols SCIP
1 /* see http://www.jera.com/techinfo/jtns/jtn002.html */
2 /* code modified to compile without warnings [phf] */
3
4 #include <stdio.h>
5 #include "minunit.h"
6
7 int tests_run = 0;
8
9 int foo = 7;
10 int bar = 4;
11
12 static const char * test_foo(void) {
13 mu_assert("error, foo != 7", foo == 7);
14 return 0;
15 }
16
17 static const char * test_bar(void) {
18 mu_assert("error, bar != 5", bar == 5);
19 return 0;
20 }
21
22 static const char * all_tests(void) {
23 mu_run_test(test_foo);
24 mu_run_test(test_bar);
25 return 0;
26 }
27
28 int main(int argc, char **argv) {
29 const char *result = all_tests();
30 if (result != 0) {
31 printf("%s\n", result);
32 }
33 else {
34 printf("ALL TESTS PASSED\n");
35 }
36 printf("Tests run: %d\n", tests_run);
37
38 return result != 0;
39 }