File src/stic.c changed (mode: 100644) (index 2fa70a1..1940128) |
... |
... |
static stic_void_void stic_suite_teardown_func = 0; |
83 |
83 |
static stic_void_void stic_fixture_setup = 0; |
static stic_void_void stic_fixture_setup = 0; |
84 |
84 |
static stic_void_void stic_fixture_teardown = 0; |
static stic_void_void stic_fixture_teardown = 0; |
85 |
85 |
|
|
|
86 |
|
const char *stic_current_test; |
|
87 |
|
|
86 |
88 |
void (*stic_simple_test_result)(int passed, char* reason, const char* function, unsigned int line) = stic_simple_test_result_log; |
void (*stic_simple_test_result)(int passed, char* reason, const char* function, unsigned int line) = stic_simple_test_result_log; |
87 |
89 |
|
|
88 |
90 |
void suite_setup(stic_void_void setup) |
void suite_setup(stic_void_void setup) |
|
... |
... |
static int stic_fixture_tests_failed; |
154 |
156 |
|
|
155 |
157 |
void stic_simple_test_result_log(int passed, char* reason, const char* function, unsigned int line) |
void stic_simple_test_result_log(int passed, char* reason, const char* function, unsigned int line) |
156 |
158 |
{ |
{ |
|
159 |
|
/* TODO: do use function if it differs from test. */ |
|
160 |
|
(void)function; |
|
161 |
|
|
157 |
162 |
if (!passed) |
if (!passed) |
158 |
163 |
{ |
{ |
159 |
164 |
if(stic_machine_readable) |
if(stic_machine_readable) |
160 |
165 |
{ |
{ |
161 |
|
printf("%s%s,%s,%u,%s\n", stic_magic_marker, stic_current_fixture_path, function, line, reason ); |
|
|
166 |
|
printf("%s%s,%s,%u,%s\n", stic_magic_marker, stic_current_fixture_path, stic_current_test, line, reason ); |
162 |
167 |
} |
} |
163 |
168 |
else |
else |
164 |
169 |
{ |
{ |
165 |
|
printf("%-30s Line %-5d %s\n", function, line, reason ); |
|
|
170 |
|
printf("%-30s Line %-5d %s\n", stic_current_test, line, reason ); |
166 |
171 |
} |
} |
167 |
172 |
sea_tests_failed++; |
sea_tests_failed++; |
168 |
173 |
} |
} |
|
... |
... |
void stic_simple_test_result_log(int passed, char* reason, const char* function, |
172 |
177 |
{ |
{ |
173 |
178 |
if(stic_machine_readable) |
if(stic_machine_readable) |
174 |
179 |
{ |
{ |
175 |
|
printf("%s%s,%s,%u,Passed\n", stic_magic_marker, stic_current_fixture_path, function, line ); |
|
|
180 |
|
printf("%s%s,%s,%u,Passed\n", stic_magic_marker, stic_current_fixture_path, stic_current_test, line ); |
176 |
181 |
} |
} |
177 |
182 |
else |
else |
178 |
183 |
{ |
{ |
179 |
|
printf("%-30s Line %-5d Passed\n", function, line); |
|
|
184 |
|
printf("%-30s Line %-5d Passed\n", stic_current_test, line); |
180 |
185 |
} |
} |
181 |
186 |
} |
} |
182 |
187 |
sea_tests_passed++; |
sea_tests_passed++; |
File src/stic.h changed (mode: 100644) (index 6ee327d..2a1b2b8) |
... |
... |
static void stic_fixture(void) |
305 |
305 |
|
|
306 |
306 |
for(i = 0; i < STIC_ARRAY_LEN(test_data); ++i) |
for(i = 0; i < STIC_ARRAY_LEN(test_data); ++i) |
307 |
307 |
{ |
{ |
|
308 |
|
extern const char *stic_current_test; |
|
309 |
|
|
308 |
310 |
struct stic_test_data *td = *test_data[i]; |
struct stic_test_data *td = *test_data[i]; |
309 |
311 |
if(td == NULL) continue; |
if(td == NULL) continue; |
310 |
312 |
if(td->p != NULL && !td->p()) continue; |
if(td->p != NULL && !td->p()) continue; |
311 |
313 |
if(!stic_should_run(fixture_name, td->n)) continue; |
if(!stic_should_run(fixture_name, td->n)) continue; |
312 |
314 |
|
|
|
315 |
|
stic_current_test = td->n; |
313 |
316 |
stic_suite_setup(); |
stic_suite_setup(); |
314 |
317 |
stic_setup(); |
stic_setup(); |
315 |
318 |
td->t(); |
td->t(); |