File src/stic.h changed (mode: 100644) (index 61f18f1..6f6a1f8) |
... |
... |
static void stic_fixture(void) |
306 |
306 |
extern stic_void_void stic_current_test; |
extern stic_void_void stic_current_test; |
307 |
307 |
|
|
308 |
308 |
size_t i; |
size_t i; |
|
309 |
|
int has_any_tests = 0; |
309 |
310 |
|
|
310 |
311 |
const char *fixture_name = stic_get_fixture_name(); |
const char *fixture_name = stic_get_fixture_name(); |
311 |
312 |
if(fixture_name == NULL || !stic_should_run(fixture_name, NULL)) |
if(fixture_name == NULL || !stic_should_run(fixture_name, NULL)) |
|
... |
... |
static void stic_fixture(void) |
318 |
319 |
fixture_setup(stic_setup_func); |
fixture_setup(stic_setup_func); |
319 |
320 |
fixture_teardown(stic_teardown_func); |
fixture_teardown(stic_teardown_func); |
320 |
321 |
|
|
321 |
|
if(stic_setup_once_func != NULL) |
|
322 |
|
{ |
|
323 |
|
stic_current_test_name = "<setup once>"; |
|
324 |
|
stic_current_test = stic_setup_once_func; |
|
325 |
|
stic_setup_once_func(); |
|
326 |
|
} |
|
327 |
|
|
|
328 |
322 |
for(i = 0; i < STIC_ARRAY_LEN(stic_test_data); ++i) |
for(i = 0; i < STIC_ARRAY_LEN(stic_test_data); ++i) |
329 |
323 |
{ |
{ |
330 |
324 |
struct stic_test_data *td = *stic_test_data[i]; |
struct stic_test_data *td = *stic_test_data[i]; |
331 |
325 |
if(td == NULL) continue; |
if(td == NULL) continue; |
|
326 |
|
if(!stic_should_run(fixture_name, td->n)) continue; |
|
327 |
|
|
|
328 |
|
/* Since predicates can rely on setup once, check predicates after |
|
329 |
|
* invoking setup once. */ |
|
330 |
|
if(!has_any_tests) |
|
331 |
|
{ |
|
332 |
|
has_any_tests = 1; |
|
333 |
|
if(stic_setup_once_func != NULL) |
|
334 |
|
{ |
|
335 |
|
stic_current_test_name = "<setup once>"; |
|
336 |
|
stic_current_test = stic_setup_once_func; |
|
337 |
|
stic_setup_once_func(); |
|
338 |
|
} |
|
339 |
|
} |
|
340 |
|
|
332 |
341 |
if(td->p != NULL && !td->p()) |
if(td->p != NULL && !td->p()) |
333 |
342 |
{ |
{ |
334 |
343 |
stic_skip_test(fixture_name, td->n); |
stic_skip_test(fixture_name, td->n); |
335 |
344 |
continue; |
continue; |
336 |
345 |
} |
} |
337 |
|
if(!stic_should_run(fixture_name, td->n)) continue; |
|
338 |
346 |
|
|
339 |
347 |
stic_current_test_name = td->n; |
stic_current_test_name = td->n; |
340 |
348 |
stic_current_test = td->t; |
stic_current_test = td->t; |
|
... |
... |
static void stic_fixture(void) |
346 |
354 |
stic_run_test(fixture_name, td->n); |
stic_run_test(fixture_name, td->n); |
347 |
355 |
} |
} |
348 |
356 |
|
|
349 |
|
if(stic_teardown_once_func != NULL) |
|
|
357 |
|
if(has_any_tests && stic_teardown_once_func != NULL) |
350 |
358 |
{ |
{ |
351 |
359 |
stic_current_test_name = "<teardown once>"; |
stic_current_test_name = "<teardown once>"; |
352 |
360 |
stic_current_test = stic_teardown_once_func; |
stic_current_test = stic_teardown_once_func; |