Browse Source

Add macros to define test suite & runner

Four macros were added :
 - TTAIL_CHECK_START(char *test_suite_str, char *test_case_str)
 - TTAIL_SET_FIXTURE(void (*setup)(), void (*teardown)())
 - TTAIL_ADD_TEST( libcheck_test test)
 - TTAIL_CHECK_END
Yann Weber 7 years ago
parent
commit
9e1539a780

+ 9
- 20
tests/ttail_argparse_badarg.c View File

@@ -74,24 +74,13 @@ START_TEST (test_argparse_bad7)
74 74
 }
75 75
 END_TEST
76 76
 
77
-Suite * ttail_init_suite(void)
78
-{
79
-	Suite *s;
80
-	TCase *tc_argparse_badarg;
81
-
82
-	s = suite_create("ttail argument parsing checks");
83
-
84
-	tc_argparse_badarg = tcase_create("bad arguments parsing");
85
-	tcase_add_test(tc_argparse_badarg, test_argparse_bad1);
86
-	tcase_add_test(tc_argparse_badarg, test_argparse_bad2);
87
-	tcase_add_test(tc_argparse_badarg, test_argparse_bad3);
88
-	tcase_add_test(tc_argparse_badarg, test_argparse_bad4);
89
-	tcase_add_test(tc_argparse_badarg, test_argparse_bad5);
90
-	tcase_add_test(tc_argparse_badarg, test_argparse_bad6);
91
-	tcase_add_test(tc_argparse_badarg, test_argparse_bad7);
92
-
93
-	suite_add_tcase(s, tc_argparse_badarg);
94
-	return s;
95
-}
77
+TTAIL_CHECK_START("ttail argument parsing checks", "bad arguments parsing")
78
+	TTAIL_ADD_TEST(test_argparse_bad1);
79
+	TTAIL_ADD_TEST(test_argparse_bad2);
80
+	TTAIL_ADD_TEST(test_argparse_bad3);
81
+	TTAIL_ADD_TEST(test_argparse_bad4);
82
+	TTAIL_ADD_TEST(test_argparse_bad5);
83
+	TTAIL_ADD_TEST(test_argparse_bad6);
84
+	TTAIL_ADD_TEST(test_argparse_bad7);
85
+TTAIL_CHECK_END
96 86
 
97
-TTAIL_CHECK_MAIN(ttail_init_suite)

+ 6
- 16
tests/ttail_argparse_date_fmt.c View File

@@ -34,20 +34,10 @@ START_TEST (test_argparse_fmt_multiple)
34 34
 }
35 35
 END_TEST
36 36
 
37
-Suite * ttail_init_suite(void)
38
-{
39
-	Suite *s;
40
-	TCase *tc_argparse_fmt;
41
-
42
-	s = suite_create("ttail argument parsing checks");
43
-
44
-	tc_argparse_fmt = tcase_create("date format arguments parsing");
45
-	tcase_add_test(tc_argparse_fmt, test_argparse_fmt_short);
46
-	tcase_add_test(tc_argparse_fmt, test_argparse_fmt_long);
47
-	tcase_add_test(tc_argparse_fmt, test_argparse_fmt_multiple);
48
-
49
-	suite_add_tcase(s, tc_argparse_fmt);
50
-	return s;
51
-}
37
+TTAIL_CHECK_START(	"ttail argument parsing checks", \
38
+			"date format arguments parsing")
39
+	TTAIL_ADD_TEST(test_argparse_fmt_short);
40
+	TTAIL_ADD_TEST(test_argparse_fmt_long);
41
+	TTAIL_ADD_TEST(test_argparse_fmt_multiple);
42
+TTAIL_CHECK_END
52 43
 
53
-TTAIL_CHECK_MAIN(ttail_init_suite)

+ 11
- 23
tests/ttail_argparse_empty.c View File

@@ -59,27 +59,15 @@ START_TEST (test_argparse_empty_session)
59 59
 }
60 60
 END_TEST
61 61
 
62
-Suite * ttail_init_suite(void)
63
-{
64
-	Suite *s;
65
-	TCase *tc_argparse_empty;
66
-
67
-	s = suite_create("ttail argument parsing checks");
68
-
69
-	tc_argparse_empty = tcase_create("empty arguments parsing");
70
-	tcase_add_checked_fixture(tc_argparse_empty,
71
-		setup_ttail_empty, teardown_ttail);
72
-	tcase_add_test(tc_argparse_empty, test_argparse_empty_logfilename);
73
-	tcase_add_test(tc_argparse_empty, test_argparse_empty_logfile);
74
-	tcase_add_test(tc_argparse_empty, test_argparse_empty_logfilesz);
75
-	tcase_add_test(tc_argparse_empty, test_argparse_empty_flag);
76
-	tcase_add_test(tc_argparse_empty, test_argparse_empty_fmt);
77
-	tcase_add_test(tc_argparse_empty, test_argparse_empty_verbose);
78
-	tcase_add_test(tc_argparse_empty, test_argparse_empty_prefixsz);
79
-	tcase_add_test(tc_argparse_empty, test_argparse_empty_session);
80
-
81
-	suite_add_tcase(s, tc_argparse_empty);
82
-	return s;
83
-}
62
+TTAIL_CHECK_START("ttail argument parsing checks", "empty arguments parsing")
63
+	TTAIL_SET_FIXTURE(setup_ttail_empty, teardown_ttail);
64
+	TTAIL_ADD_TEST(test_argparse_empty_logfilename);
65
+	TTAIL_ADD_TEST(test_argparse_empty_logfile);
66
+	TTAIL_ADD_TEST(test_argparse_empty_logfilesz);
67
+	TTAIL_ADD_TEST(test_argparse_empty_flag);
68
+	TTAIL_ADD_TEST(test_argparse_empty_fmt);
69
+	TTAIL_ADD_TEST(test_argparse_empty_verbose);
70
+	TTAIL_ADD_TEST(test_argparse_empty_prefixsz);
71
+	TTAIL_ADD_TEST(test_argparse_empty_session);
72
+TTAIL_CHECK_END
84 73
 
85
-TTAIL_CHECK_MAIN(ttail_init_suite)

+ 6
- 18
tests/ttail_argparse_files.c View File

@@ -91,22 +91,10 @@ START_TEST (test_argparse_file_multiple)
91 91
 }
92 92
 END_TEST
93 93
 
94
-Suite * ttail_init_suite(void)
95
-{
96
-	Suite *s;
97
-	TCase *tc_argparse_files;
98
-
99
-	s = suite_create("ttail argument parsing checks");
100
-
101
-	tc_argparse_files = tcase_create("files options parse");
102
-	tcase_add_checked_fixture(tc_argparse_files,
103
-		setup_fname, teardown_fname);
104
-	tcase_add_test(tc_argparse_files, test_argparse_file_non_exist);
105
-	tcase_add_test(tc_argparse_files, test_argparse_file_exist);
106
-	tcase_add_test(tc_argparse_files, test_argparse_file_multiple);
107
-
108
-	suite_add_tcase(s, tc_argparse_files);
109
-	return s;
110
-}
94
+TTAIL_CHECK_START("ttail argument parsing checks", "files options parse")
95
+	TTAIL_SET_FIXTURE(setup_fname, teardown_fname);
96
+	TTAIL_ADD_TEST(test_argparse_file_non_exist);
97
+	TTAIL_ADD_TEST(test_argparse_file_exist);
98
+	TTAIL_ADD_TEST(test_argparse_file_multiple);
99
+TTAIL_CHECK_END
111 100
 
112
-TTAIL_CHECK_MAIN(ttail_init_suite)

+ 8
- 18
tests/ttail_argparse_re_prefix.c View File

@@ -59,22 +59,12 @@ START_TEST (test_argparse_prefix_multiple)
59 59
 }
60 60
 END_TEST
61 61
 
62
-Suite * ttail_init_suite(void)
63
-{
64
-	Suite *s;
65
-	TCase *tc_argparse_prefix;
66
-
67
-	s = suite_create("ttail argument parsing checks");
68
-
69
-	tc_argparse_prefix = tcase_create("re-prefix arguments parsing");
70
-	tcase_add_test(tc_argparse_prefix, test_argparse_reprefix_short);
71
-	tcase_add_test(tc_argparse_prefix, test_argparse_reprefix_long);
72
-	tcase_add_test(tc_argparse_prefix, test_argparse_prefixlen_short);
73
-	tcase_add_test(tc_argparse_prefix, test_argparse_prefixlen_long);
74
-	tcase_add_test(tc_argparse_prefix, test_argparse_prefix_multiple);
75
-
76
-	suite_add_tcase(s, tc_argparse_prefix);
77
-	return s;
78
-}
62
+TTAIL_CHECK_START(	"ttail argument parsing checks",\
63
+			"re-prefix arguments parsing")
64
+	TTAIL_ADD_TEST(test_argparse_reprefix_short);
65
+	TTAIL_ADD_TEST(test_argparse_reprefix_long);
66
+	TTAIL_ADD_TEST(test_argparse_prefixlen_short);
67
+	TTAIL_ADD_TEST(test_argparse_prefixlen_long);
68
+	TTAIL_ADD_TEST(test_argparse_prefix_multiple);
69
+TTAIL_CHECK_END
79 70
 
80
-TTAIL_CHECK_MAIN(ttail_init_suite)

+ 31
- 3
tests/ttail_check.h View File

@@ -119,12 +119,40 @@ void teardown_closest_fileinit(void)
119 119
 	teardown_closest();
120 120
 }
121 121
 
122
-
123
-#define TTAIL_CHECK_MAIN(suite) int main(int argc, char **argv) {\
122
+/**@brief Start a ttail test
123
+ *@param const char* suite_str test suite string
124
+ *@param const char* tc_str test case string
125
+ */
126
+#define TTAIL_CHECK_START(suite_str, tc_str) \
127
+Suite * ttail_test_suite(void) \
128
+{\
129
+	Suite *s;\
130
+	TCase *tc;\
131
+	s = suite_create(suite_str);\
132
+	tc = tcase_create(tc_str);
133
+
134
+
135
+/**@brief Set the setup & teardown fixture
136
+ *@param void (*setup)()
137
+ *@param void (*teardown)()
138
+ */
139
+#define TTAIL_SET_FIXTURE(setup, teardown) \
140
+		tcase_add_checked_fixture(tc, setup, teardown)
141
+/**@brief Add a test function defined using START_TEST(name) { ... } END_TEST
142
+ */
143
+#define TTAIL_ADD_TEST(test) tcase_add_test(tc, test)
144
+
145
+/**@brief End a ttail test */
146
+#define TTAIL_CHECK_END \
147
+	suite_add_tcase(s, tc);\
148
+	return s;\
149
+}\
150
+\
151
+int main(int argc, char **argv) {\
124 152
 	int n_fail;\
125 153
 	SRunner *sr;\
126 154
 	chdir(dirname(argv[0])); /* move in ./tests dir */ \
127
-	sr = srunner_create(suite());\
155
+	sr = srunner_create(ttail_test_suite());\
128 156
 	srunner_set_fork_status(sr, CK_FORK);\
129 157
 	srunner_run_all(sr, CK_VERBOSE);\
130 158
 	n_fail = srunner_ntests_failed(sr);\

+ 6
- 18
tests/ttail_init_check.c View File

@@ -42,22 +42,10 @@ START_TEST (test_init_check1)
42 42
 }
43 43
 END_TEST
44 44
 
45
-Suite * ttail_init_suite(void)
46
-{
47
-	Suite *s;
48
-	TCase	*tc_init_check;
49
-
50
-	s = suite_create("ttail init checks");
51
-
52
-	tc_init_check = tcase_create("ttail_init_check() checks");
53
-	tcase_add_checked_fixture(tc_init_check,
54
-		setup_ttail_empty, teardown_ttail);
55
-	tcase_add_test(tc_init_check, test_init_check_bad1);
56
-	tcase_add_test(tc_init_check, test_init_check_bad2);
57
-	tcase_add_test(tc_init_check, test_init_check1);
58
-
59
-	suite_add_tcase(s, tc_init_check);
60
-	return s;
61
-}
45
+TTAIL_CHECK_START("ttail init checks", "ttail_init_check() checks")
46
+	TTAIL_SET_FIXTURE(setup_ttail_empty, teardown_ttail);
47
+	TTAIL_ADD_TEST(test_init_check_bad1);
48
+	TTAIL_ADD_TEST(test_init_check_bad2);
49
+	TTAIL_ADD_TEST(test_init_check1);
50
+TTAIL_CHECK_END
62 51
 
63
-TTAIL_CHECK_MAIN(ttail_init_suite)

+ 5
- 17
tests/ttail_init_format.c View File

@@ -31,21 +31,9 @@ START_TEST (test_init_fmt_again)
31 31
 }
32 32
 END_TEST
33 33
 
34
-Suite * ttail_init_suite(void)
35
-{
36
-	Suite *s;
37
-	TCase	*tc_init_fmt;
38
-
39
-	s = suite_create("ttail init checks");
40
-
41
-	tc_init_fmt = tcase_create("date format init checks");
42
-	tcase_add_checked_fixture(tc_init_fmt,
43
-		setup_ttail_empty, teardown_ttail);
44
-	tcase_add_test(tc_init_fmt, test_init_fmt);
45
-	tcase_add_test(tc_init_fmt, test_init_fmt_again);
46
-
47
-	suite_add_tcase(s, tc_init_fmt);
48
-	return s;
49
-}
34
+TTAIL_CHECK_START("ttail init checks", "date format init checks")
35
+	TTAIL_SET_FIXTURE(setup_ttail_empty, teardown_ttail);
36
+	TTAIL_ADD_TEST(test_init_fmt);
37
+	TTAIL_ADD_TEST(test_init_fmt_again);
38
+TTAIL_CHECK_END
50 39
 
51
-TTAIL_CHECK_MAIN(ttail_init_suite)

+ 10
- 22
tests/ttail_init_format_guess.c View File

@@ -124,26 +124,14 @@ START_TEST (test_init_guess_fmt_set)
124 124
 }
125 125
 END_TEST
126 126
 
127
-Suite * ttail_init_suite(void)
128
-{
129
-	Suite *s;
130
-	TCase	*tc_init_fmt_guess;
131
-
132
-	s = suite_create("ttail init checks");
133
-
134
-	tc_init_fmt_guess = tcase_create("date format guess init checks");
135
-	tcase_add_checked_fixture(tc_init_fmt_guess,
136
-		setup_ttail_empty, teardown_ttail);
137
-	tcase_add_test(tc_init_fmt_guess, test_init_guess_date);
138
-	tcase_add_test(tc_init_fmt_guess, test_init_guess_datetime);
139
-	tcase_add_test(tc_init_fmt_guess, test_init_guess_datetime2);
140
-	tcase_add_test(tc_init_fmt_guess, test_init_guess_noguess);
141
-	tcase_add_test(tc_init_fmt_guess, test_init_guess_date_notm);
142
-	tcase_add_test(tc_init_fmt_guess, test_init_guess_noguess_notm);
143
-	tcase_add_test(tc_init_fmt_guess, test_init_guess_fmt_set);
144
-
145
-	suite_add_tcase(s, tc_init_fmt_guess);
146
-	return s;
147
-}
127
+TTAIL_CHECK_START("ttail init checks", "date format guess init checks")
128
+	TTAIL_SET_FIXTURE(setup_ttail_empty, teardown_ttail);
129
+	TTAIL_ADD_TEST(test_init_guess_date);
130
+	TTAIL_ADD_TEST(test_init_guess_datetime);
131
+	TTAIL_ADD_TEST(test_init_guess_datetime2);
132
+	TTAIL_ADD_TEST(test_init_guess_noguess);
133
+	TTAIL_ADD_TEST(test_init_guess_date_notm);
134
+	TTAIL_ADD_TEST(test_init_guess_noguess_notm);
135
+	TTAIL_ADD_TEST(test_init_guess_fmt_set);
136
+TTAIL_CHECK_END
148 137
 
149
-TTAIL_CHECK_MAIN(ttail_init_suite)

+ 9
- 21
tests/ttail_init_logfile.c View File

@@ -140,25 +140,13 @@ START_TEST (test_init_multiple_logfilename)
140 140
 }
141 141
 END_TEST
142 142
 
143
-Suite * ttail_init_suite(void)
144
-{
145
-	Suite *s;
146
-	TCase	*tc_init_logfile;
147
-
148
-	s = suite_create("ttail init checks");
149
-
150
-	tc_init_logfile = tcase_create("logfile init checks");
151
-	tcase_add_checked_fixture(tc_init_logfile,
152
-		setup_ttail_empty, teardown_ttail);
153
-	tcase_add_test(tc_init_logfile, test_init_empty_logfilename);
154
-	tcase_add_test(tc_init_logfile, test_init_nonexist_logfilename);
155
-	tcase_add_test(tc_init_logfile, test_init_exist_logfilename);
156
-	tcase_add_test(tc_init_logfile, test_init_same_exist_logfilename);
157
-	tcase_add_test(tc_init_logfile, test_init_same_nonexist_logfilename);
158
-	tcase_add_test(tc_init_logfile, test_init_multiple_logfilename);
159
-
160
-	suite_add_tcase(s, tc_init_logfile);
161
-	return s;
162
-}
143
+TTAIL_CHECK_START("ttail init checks", "logfile init checks")
144
+	TTAIL_SET_FIXTURE(setup_ttail_empty, teardown_ttail);
145
+	TTAIL_ADD_TEST(test_init_empty_logfilename);
146
+	TTAIL_ADD_TEST(test_init_nonexist_logfilename);
147
+	TTAIL_ADD_TEST(test_init_exist_logfilename);
148
+	TTAIL_ADD_TEST(test_init_same_exist_logfilename);
149
+	TTAIL_ADD_TEST(test_init_same_nonexist_logfilename);
150
+	TTAIL_ADD_TEST(test_init_multiple_logfilename);
151
+TTAIL_CHECK_END
163 152
 
164
-TTAIL_CHECK_MAIN(ttail_init_suite)

+ 8
- 21
tests/ttail_init_norm_dates.c View File

@@ -174,25 +174,12 @@ START_TEST (test_norm_dates_flags_full)
174 174
 }
175 175
 END_TEST
176 176
 
177
+TTAIL_CHECK_START("ttail init checks", "ttail_init_check() checks")
178
+	TTAIL_SET_FIXTURE(setup_ttail_empty, teardown_ttail);
179
+	TTAIL_ADD_TEST(test_norm_dates_flags_none);
180
+	TTAIL_ADD_TEST(test_norm_dates_flags_min);
181
+	TTAIL_ADD_TEST(test_norm_dates_flags_max);
182
+	TTAIL_ADD_TEST(test_norm_dates_flags_both);
183
+	TTAIL_ADD_TEST(test_norm_dates_flags_full);
184
+TTAIL_CHECK_END
177 185
 
178
-Suite * ttail_init_suite(void)
179
-{
180
-	Suite *s;
181
-	TCase	*tc_init_norm_dates;
182
-
183
-	s = suite_create("ttail init checks");
184
-
185
-	tc_init_norm_dates = tcase_create("ttail_init_check() checks");
186
-	tcase_add_checked_fixture(tc_init_norm_dates,
187
-		setup_ttail_empty, teardown_ttail);
188
-	tcase_add_test(tc_init_norm_dates, test_norm_dates_flags_none);
189
-	tcase_add_test(tc_init_norm_dates, test_norm_dates_flags_min);
190
-	tcase_add_test(tc_init_norm_dates, test_norm_dates_flags_max);
191
-	tcase_add_test(tc_init_norm_dates, test_norm_dates_flags_both);
192
-	tcase_add_test(tc_init_norm_dates, test_norm_dates_flags_full);
193
-
194
-	suite_add_tcase(s, tc_init_norm_dates);
195
-	return s;
196
-}
197
-
198
-TTAIL_CHECK_MAIN(ttail_init_suite)

+ 7
- 19
tests/ttail_init_re_prefix.c View File

@@ -53,23 +53,11 @@ START_TEST (test_init_againbad_prefix)
53 53
 }
54 54
 END_TEST
55 55
 
56
-Suite * ttail_init_suite(void)
57
-{
58
-	Suite *s;
59
-	TCase	*tc_init_prefix;
60
-
61
-	s = suite_create("ttail init checks");
62
-
63
-	tc_init_prefix = tcase_create("date prefix regex init checks");
64
-	tcase_add_checked_fixture(tc_init_prefix,
65
-		setup_ttail_empty, teardown_ttail);
66
-	tcase_add_test(tc_init_prefix, test_init_prefix);
67
-	tcase_add_test(tc_init_prefix, test_init_bad_prefix);
68
-	tcase_add_test(tc_init_prefix, test_init_again_prefix);
69
-	tcase_add_test(tc_init_prefix, test_init_againbad_prefix);
70
-
71
-	suite_add_tcase(s, tc_init_prefix);
72
-	return s;
73
-}
56
+TTAIL_CHECK_START("ttail init checks", "date prefix regex init checks")
57
+	TTAIL_SET_FIXTURE(setup_ttail_empty, teardown_ttail);
58
+	TTAIL_ADD_TEST(test_init_prefix);
59
+	TTAIL_ADD_TEST(test_init_bad_prefix);
60
+	TTAIL_ADD_TEST(test_init_again_prefix);
61
+	TTAIL_ADD_TEST(test_init_againbad_prefix);
62
+TTAIL_CHECK_END
74 63
 
75
-TTAIL_CHECK_MAIN(ttail_init_suite)

+ 7
- 19
tests/ttail_init_set_dates.c View File

@@ -142,23 +142,11 @@ START_TEST (test_init_setdates_nofmt_both)
142 142
 }
143 143
 END_TEST
144 144
 
145
-Suite * ttail_init_suite(void)
146
-{
147
-	Suite *s;
148
-	TCase	*tc_init_set_dates;
149
-
150
-	s = suite_create("ttail init checks");
151
-
152
-	tc_init_set_dates = tcase_create("dates min/max init checks");
153
-	tcase_add_checked_fixture(tc_init_set_dates,
154
-		setup_ttail_empty, teardown_ttail);
155
-	tcase_add_test(tc_init_set_dates, test_init_setdates_nothing);
156
-	tcase_add_test(tc_init_set_dates, test_init_setdates_nofmt_min);
157
-	tcase_add_test(tc_init_set_dates, test_init_setdates_nofmt_max);
158
-	tcase_add_test(tc_init_set_dates, test_init_setdates_nofmt_both);
159
-
160
-	suite_add_tcase(s, tc_init_set_dates);
161
-	return s;
162
-}
145
+TTAIL_CHECK_START("ttail init checks", "dates min/max init checks")
146
+	TTAIL_SET_FIXTURE(setup_ttail_empty, teardown_ttail);
147
+	TTAIL_ADD_TEST(test_init_setdates_nothing);
148
+	TTAIL_ADD_TEST(test_init_setdates_nofmt_min);
149
+	TTAIL_ADD_TEST(test_init_setdates_nofmt_max);
150
+	TTAIL_ADD_TEST(test_init_setdates_nofmt_both);
151
+TTAIL_CHECK_END
163 152
 
164
-TTAIL_CHECK_MAIN(ttail_init_suite)

+ 7
- 21
tests/ttail_search_closest_fileinit.c View File

@@ -49,25 +49,11 @@ START_TEST (test_search_closest_init_vfile)
49 49
 }
50 50
 END_TEST
51 51
 
52
-Suite * ttail_search_files_suite(void)
53
-{
54
-	Suite *s;
55
-	TCase *tc_search_closest_fileinit;
56
-
57
-	s = suite_create("ttail search_files checks");
58
-
59
-	tc_search_closest_fileinit = tcase_create("\
60
-ttail_logline_closest_files_init() checks");
61
-	tcase_add_checked_fixture(tc_search_closest_fileinit,
62
-		setup_closest_fileinit, teardown_closest_fileinit);
63
-	tcase_add_test(tc_search_closest_fileinit, test_search_closest_init);
64
-	tcase_add_test(tc_search_closest_fileinit,
65
-		test_search_closest_init_filesz);
66
-	tcase_add_test(tc_search_closest_fileinit,
67
-		test_search_closest_init_vfile);
68
-
69
-	suite_add_tcase(s, tc_search_closest_fileinit);
70
-	return s;
71
-}
52
+TTAIL_CHECK_START(	"ttail search_files checks",\
53
+			"ttail_logline_closest_files_init() checks")
54
+	TTAIL_SET_FIXTURE(setup_closest_fileinit, teardown_closest_fileinit);
55
+	TTAIL_ADD_TEST(test_search_closest_init);
56
+	TTAIL_ADD_TEST(test_search_closest_init_filesz);
57
+	TTAIL_ADD_TEST(test_search_closest_init_vfile);
58
+TTAIL_CHECK_END
72 59
 
73
-TTAIL_CHECK_MAIN(ttail_search_files_suite)

+ 5
- 17
tests/ttail_search_file_line.c View File

@@ -56,21 +56,9 @@ START_TEST (test_file_line_start)
56 56
 }
57 57
 END_TEST
58 58
 
59
-Suite * ttail_search_files_suite(void)
60
-{
61
-	Suite *s;
62
-	TCase *tc_file_line;
63
-
64
-	s = suite_create("ttail search_files checks");
65
-
66
-	tc_file_line = tcase_create("ttail_file_*line*() checks");
67
-	tcase_add_checked_fixture(tc_file_line,
68
-		setup_file_line, teardown_file_line);
69
-	tcase_add_test(tc_file_line, test_file_line_next);
70
-	tcase_add_test(tc_file_line, test_file_line_start);
71
-
72
-	suite_add_tcase(s, tc_file_line);
73
-	return s;
74
-}
59
+TTAIL_CHECK_START("ttail search_files checks", "ttail_file_*line*() checks")
60
+	TTAIL_SET_FIXTURE(setup_file_line, teardown_file_line);
61
+	TTAIL_ADD_TEST(test_file_line_next);
62
+	TTAIL_ADD_TEST(test_file_line_start);
63
+TTAIL_CHECK_END
75 64
 
76
-TTAIL_CHECK_MAIN(ttail_search_files_suite)

+ 6
- 18
tests/ttail_search_files.c View File

@@ -106,22 +106,10 @@ START_TEST (test_search_files3)
106 106
 }
107 107
 END_TEST
108 108
 
109
-Suite * ttail_search_files_suite(void)
110
-{
111
-	Suite *s;
112
-	TCase *tc_search_files;
113
-
114
-	s = suite_create("ttail search_files checks");
115
-
116
-	tc_search_files = tcase_create("ttail_logline2date() checks");
117
-	tcase_add_checked_fixture(tc_search_files,
118
-		setup_closest_fileinit, teardown_closest_fileinit);
119
-	tcase_add_test(tc_search_files, test_search_files1);
120
-	tcase_add_test(tc_search_files, test_search_files2);
121
-	tcase_add_test(tc_search_files, test_search_files3);
122
-	
123
-	suite_add_tcase(s, tc_search_files);
124
-	return s;
125
-}
109
+TTAIL_CHECK_START("ttail search_files checks", "ttail_logline2date() checks")
110
+	TTAIL_SET_FIXTURE(setup_closest_fileinit, teardown_closest_fileinit);
111
+	TTAIL_ADD_TEST(test_search_files1);
112
+	TTAIL_ADD_TEST(test_search_files2);
113
+	TTAIL_ADD_TEST(test_search_files3);
114
+TTAIL_CHECK_END
126 115
 
127
-TTAIL_CHECK_MAIN(ttail_search_files_suite)

+ 6
- 18
tests/ttail_search_logline2date.c View File

@@ -67,22 +67,10 @@ START_TEST (test_search_log2date_faildate)
67 67
 }
68 68
 END_TEST
69 69
 
70
-Suite * ttail_search_files_suite(void)
71
-{
72
-	Suite *s;
73
-	TCase *tc_search_logline2date;
74
-
75
-	s = suite_create("ttail search_files checks");
76
-
77
-	tc_search_logline2date = tcase_create("ttail_logline2date() checks");
78
-	tcase_add_checked_fixture(tc_search_logline2date,
79
-		setup_closest_fileinit, teardown_closest_fileinit);
80
-	tcase_add_test(tc_search_logline2date, test_search_log2date1);
81
-	tcase_add_test(tc_search_logline2date, test_search_log2date_failpref);
82
-	tcase_add_test(tc_search_logline2date, test_search_log2date_faildate);
83
-
84
-	suite_add_tcase(s, tc_search_logline2date);
85
-	return s;
86
-}
70
+TTAIL_CHECK_START("ttail search_files checks","ttail_logline2date() checks")
71
+	TTAIL_SET_FIXTURE(setup_closest_fileinit, teardown_closest_fileinit);
72
+	TTAIL_ADD_TEST(test_search_log2date1);
73
+	TTAIL_ADD_TEST(test_search_log2date_failpref);
74
+	TTAIL_ADD_TEST(test_search_log2date_faildate);
75
+TTAIL_CHECK_END
87 76
 
88
-TTAIL_CHECK_MAIN(ttail_search_files_suite)

+ 4
- 16
tests/ttail_search_minmax.c View File

@@ -33,20 +33,8 @@ START_TEST (test_file_minmax1)
33 33
 }
34 34
 END_TEST
35 35
 
36
-Suite * ttail_search_files_suite(void)
37
-{
38
-	Suite *s;
39
-	TCase *tc_file_minmax;
40
-
41
-	s = suite_create("ttail search_files checks");
42
-
43
-	tc_file_minmax = tcase_create("ttail_file_minmax() checks");
44
-	tcase_add_checked_fixture(tc_file_minmax,
45
-		setup_closest_fileinit, teardown_closest_fileinit);
46
-	tcase_add_test(tc_file_minmax, test_file_minmax1);
47
-
48
-	suite_add_tcase(s, tc_file_minmax);
49
-	return s;
50
-}
36
+TTAIL_CHECK_START("ttail search_files checks", "ttail_file_minmax() checks")
37
+	TTAIL_SET_FIXTURE(setup_closest_fileinit, teardown_closest_fileinit);
38
+	TTAIL_ADD_TEST(test_file_minmax1);
39
+TTAIL_CHECK_END
51 40
 
52
-TTAIL_CHECK_MAIN(ttail_search_files_suite)

+ 8
- 20
tests/ttail_search_subst.c View File

@@ -76,24 +76,12 @@ START_TEST (test_search_subst_re_nomatch)
76 76
 }
77 77
 END_TEST
78 78
 
79
-Suite * ttail_search_files_suite(void)
80
-{
81
-	Suite *s;
82
-	TCase *tc_search_subst;
83
-
84
-	s = suite_create("ttail search_files checks");
85
-
86
-	tc_search_subst = tcase_create("ttail_logline_subst() checks");
87
-	tcase_add_checked_fixture(tc_search_subst,
88
-		setup_closest_fileinit, teardown_closest_fileinit);
89
-	tcase_add_test(tc_search_subst, test_search_subst_const1);
90
-	tcase_add_test(tc_search_subst, test_search_subst_const2);
91
-	tcase_add_test(tc_search_subst, test_search_subst_re1);
92
-	tcase_add_test(tc_search_subst, test_search_subst_re2);
93
-	tcase_add_test(tc_search_subst, test_search_subst_re_nomatch);
94
-
95
-	suite_add_tcase(s, tc_search_subst);
96
-	return s;
97
-}
79
+TTAIL_CHECK_START("ttail search_files checks", "ttail_logline_subst() checks")
80
+	TTAIL_SET_FIXTURE(setup_closest_fileinit, teardown_closest_fileinit);
81
+	TTAIL_ADD_TEST(test_search_subst_const1);
82
+	TTAIL_ADD_TEST(test_search_subst_const2);
83
+	TTAIL_ADD_TEST(test_search_subst_re1);
84
+	TTAIL_ADD_TEST(test_search_subst_re2);
85
+	TTAIL_ADD_TEST(test_search_subst_re_nomatch);
86
+TTAIL_CHECK_END
98 87
 
99
-TTAIL_CHECK_MAIN(ttail_search_files_suite)

Loading…
Cancel
Save