-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
97 lines (81 loc) · 1.68 KB
/
main.c
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include "my_unity.h"
#include "fixture.h"
#include <stdio.h>
#include <stdlib.h>
int hoge;
void setupFunc(void) {
hoge = 1;
printf("start setup : with hoge = %d \n", hoge);
}
void teardownFunc(void) {
printf("teardown : with hoge = %d \n", hoge);
}
char* testName1 = "testName1";
char* testName2 = "testName2";
char *testName3 = "testName3";
char* groupName1 = "groupName1";
char* groupName2 = "groupName2";
char* groupName3 = "groupName3";
struct testGroup {
char* test;
char* group;
};
MAKE_GROUP(groupName1);
MAKE_TEST(groupName3, testName3) {
int fuga = 1;
checkInt(hoge, fuga);
return 0;
}
MAKE_TEST(groupName1, testName1) {
int fuga = 1;
checkInt(hoge, fuga);
return 0;
}
MAKE_TEST(groupName1, testName2) {
int fuga = 1;
checkInt(hoge, fuga);
return 0;
}
MAKE_TEST(groupName2, testName2) {
int fuga = 1;
checkInt(hoge, fuga);
return 0;
}
AFTER_ALL_TEST(groupName1) {
hoge = 2;
printf("-- after test [ hoge = %d ]\n", hoge);
return 1;
}
BEFORE_ALL_TEST(groupName1) {
hoge = 1;
printf("-- before test [ hoge = %d ] \n", hoge);
return 1;
}
BEFORE_EACH_TEST(groupName1) {
hoge = 3;
printf("- before each test [ hoge = %d ] \n", hoge);
return 1;
}
BEFORE_EACH_TEST(groupName2) {
hoge = 1;
printf("- before each test [ hoge = %d ] \n", hoge);
return 1;
}
int main(void) {
char* testNames[100] = {
testName1,
testName2
};
setup(setupFunc);
INIT_TEST(groupName3, testName3);
INIT_TEST(groupName1, testName1);
INIT_TEST(groupName1, testName2);
INIT_TEST(groupName2, testName2);
INIT_BEFORE_ALL_TEST(groupName1);
INIT_BEFORE_EACH_TEST(groupName1);
INIT_BEFORE_EACH_TEST(groupName2);
INIT_AFTER_ALL_TEST(groupName1);
runTest();
teardown(teardownFunc);
return 0;
}