21
21
22
22
using namespace utest ::v1;
23
23
24
+ // case_t factory used by Case contructor
25
+ static inline case_t make_case (
26
+ const char *description,
27
+ const case_handler_t handler,
28
+ const case_control_handler_t control_handler,
29
+ const case_call_count_handler_t repeat_count_handler,
30
+ const case_setup_handler_t setup_handler,
31
+ const case_teardown_handler_t teardown_handler,
32
+ const case_failure_handler_t failure_handler)
33
+ {
34
+ case_t result = {
35
+ description,
36
+ handler,
37
+ control_handler,
38
+ repeat_count_handler,
39
+ setup_handler,
40
+ teardown_handler,
41
+ failure_handler
42
+ };
43
+
44
+ return result;
45
+ }
46
+
24
47
// normal handler
25
48
Case::Case (const char *description,
26
49
const case_setup_handler_t setup_handler,
27
50
const case_handler_t handler,
28
51
const case_teardown_handler_t teardown_handler,
29
52
const case_failure_handler_t failure_handler) :
30
- description(description),
31
- handler(handler),
32
- control_handler(ignore_handler),
33
- repeat_count_handler(ignore_handler),
34
- setup_handler(setup_handler),
35
- teardown_handler(teardown_handler),
36
- failure_handler(failure_handler)
53
+ case_t(make_case(
54
+ description,
55
+ handler,
56
+ ignore_handler,
57
+ ignore_handler,
58
+ setup_handler,
59
+ teardown_handler,
60
+ failure_handler
61
+ ))
62
+
37
63
{}
38
64
39
65
Case::Case (const char *description,
40
66
const case_handler_t handler,
41
67
const case_teardown_handler_t teardown_handler,
42
68
const case_failure_handler_t failure_handler) :
43
- description(description),
44
- handler(handler),
45
- control_handler(ignore_handler),
46
- repeat_count_handler(ignore_handler),
47
- setup_handler(default_handler),
48
- teardown_handler(teardown_handler),
49
- failure_handler(failure_handler)
69
+ case_t(make_case(
70
+ description,
71
+ handler,
72
+ ignore_handler,
73
+ ignore_handler,
74
+ default_handler,
75
+ teardown_handler,
76
+ failure_handler
77
+ ))
78
+
50
79
{}
51
80
52
81
Case::Case (const char *description,
53
82
const case_handler_t handler,
54
83
const case_failure_handler_t failure_handler) :
55
- description(description),
56
- handler(handler),
57
- control_handler(ignore_handler),
58
- repeat_count_handler(ignore_handler),
59
- setup_handler(default_handler),
60
- teardown_handler(default_handler),
61
- failure_handler(failure_handler)
84
+ case_t(make_case(
85
+ description,
86
+ handler,
87
+ ignore_handler,
88
+ ignore_handler,
89
+ default_handler,
90
+ default_handler,
91
+ failure_handler
92
+ ))
62
93
{}
63
94
64
95
// control handler
@@ -67,38 +98,44 @@ Case::Case(const char *description,
67
98
const case_control_handler_t handler,
68
99
const case_teardown_handler_t teardown_handler,
69
100
const case_failure_handler_t failure_handler) :
70
- description(description),
71
- handler(ignore_handler),
72
- control_handler(handler),
73
- repeat_count_handler(ignore_handler),
74
- setup_handler(setup_handler),
75
- teardown_handler(teardown_handler),
76
- failure_handler(failure_handler)
101
+ case_t(make_case(
102
+ description,
103
+ ignore_handler,
104
+ handler,
105
+ ignore_handler,
106
+ setup_handler,
107
+ teardown_handler,
108
+ failure_handler
109
+ ))
77
110
{}
78
111
79
112
Case::Case (const char *description,
80
113
const case_control_handler_t handler,
81
114
const case_teardown_handler_t teardown_handler,
82
115
const case_failure_handler_t failure_handler) :
83
- description(description),
84
- handler(ignore_handler),
85
- control_handler(handler),
86
- repeat_count_handler(ignore_handler),
87
- setup_handler(default_handler),
88
- teardown_handler(teardown_handler),
89
- failure_handler(failure_handler)
116
+ case_t(make_case(
117
+ description,
118
+ ignore_handler,
119
+ handler,
120
+ ignore_handler,
121
+ default_handler,
122
+ teardown_handler,
123
+ failure_handler
124
+ ))
90
125
{}
91
126
92
127
Case::Case (const char *description,
93
128
const case_control_handler_t handler,
94
129
const case_failure_handler_t failure_handler) :
95
- description(description),
96
- handler(ignore_handler),
97
- control_handler(handler),
98
- repeat_count_handler(ignore_handler),
99
- setup_handler(default_handler),
100
- teardown_handler(default_handler),
101
- failure_handler(failure_handler)
130
+ case_t(make_case(
131
+ description,
132
+ ignore_handler,
133
+ handler,
134
+ ignore_handler,
135
+ default_handler,
136
+ default_handler,
137
+ failure_handler
138
+ ))
102
139
{}
103
140
104
141
// control flow handler
@@ -107,38 +144,44 @@ Case::Case(const char *description,
107
144
const case_call_count_handler_t case_repeat_count_handler,
108
145
const case_teardown_handler_t teardown_handler,
109
146
const case_failure_handler_t failure_handler) :
110
- description(description),
111
- handler(ignore_handler),
112
- control_handler(ignore_handler),
113
- repeat_count_handler(case_repeat_count_handler),
114
- setup_handler(setup_handler),
115
- teardown_handler(teardown_handler),
116
- failure_handler(failure_handler)
147
+ case_t(make_case(
148
+ description,
149
+ ignore_handler,
150
+ ignore_handler,
151
+ case_repeat_count_handler,
152
+ setup_handler,
153
+ teardown_handler,
154
+ failure_handler
155
+ ))
117
156
{}
118
157
119
158
Case::Case (const char *description,
120
159
const case_call_count_handler_t case_repeat_count_handler,
121
160
const case_failure_handler_t failure_handler) :
122
- description(description),
123
- handler(ignore_handler),
124
- control_handler(ignore_handler),
125
- repeat_count_handler(case_repeat_count_handler),
126
- setup_handler(default_handler),
127
- teardown_handler(default_handler),
128
- failure_handler(failure_handler)
161
+ case_t(make_case(
162
+ description,
163
+ ignore_handler,
164
+ ignore_handler,
165
+ case_repeat_count_handler,
166
+ default_handler,
167
+ default_handler,
168
+ failure_handler
169
+ ))
129
170
{}
130
171
131
172
Case::Case (const char *description,
132
173
const case_call_count_handler_t case_repeat_count_handler,
133
174
const case_teardown_handler_t teardown_handler,
134
175
const case_failure_handler_t failure_handler) :
135
- description(description),
136
- handler(ignore_handler),
137
- control_handler(ignore_handler),
138
- repeat_count_handler(case_repeat_count_handler),
139
- setup_handler(default_handler),
140
- teardown_handler(teardown_handler),
141
- failure_handler(failure_handler)
176
+ case_t(make_case(
177
+ description,
178
+ ignore_handler,
179
+ ignore_handler,
180
+ case_repeat_count_handler,
181
+ default_handler,
182
+ teardown_handler,
183
+ failure_handler
184
+ ))
142
185
{}
143
186
144
187
const char *
0 commit comments