File src/stic.c changed (mode: 100644) (index 431e992..ccfd5e4) |
... |
... |
static stic_void_void stic_fixture_setup = 0; |
86 |
86 |
static stic_void_void stic_fixture_teardown = 0; |
static stic_void_void stic_fixture_teardown = 0; |
87 |
87 |
|
|
88 |
88 |
const char *stic_current_test; |
const char *stic_current_test; |
|
89 |
|
const char *stic_suite_name; |
89 |
90 |
|
|
90 |
91 |
void (*stic_simple_test_result)(int passed, char* reason, const char* function, const char file[], unsigned int line) = stic_simple_test_result_log; |
void (*stic_simple_test_result)(int passed, char* reason, const char* function, const char file[], unsigned int line) = stic_simple_test_result_log; |
91 |
92 |
|
|
|
... |
... |
int run_tests(stic_void_void tests) |
479 |
480 |
if (sea_tests_failed > 0) { |
if (sea_tests_failed > 0) { |
480 |
481 |
stic_header_printer("Failed", stic_screen_width, ' '); |
stic_header_printer("Failed", stic_screen_width, ' '); |
481 |
482 |
} |
} |
482 |
|
else { |
|
483 |
|
stic_header_printer("ALL TESTS PASSED", stic_screen_width, ' '); |
|
|
483 |
|
else |
|
484 |
|
{ |
|
485 |
|
extern const char *stic_suite_name; |
|
486 |
|
char s[100]; |
|
487 |
|
|
|
488 |
|
if(stic_suite_name == NULL || stic_suite_name[0] == '\0') |
|
489 |
|
{ |
|
490 |
|
stic_suite_name = ""; |
|
491 |
|
} |
|
492 |
|
|
|
493 |
|
snprintf(s, sizeof(s), "ALL%s%s TESTS PASSED", |
|
494 |
|
(stic_suite_name[0] != '\0') ? " " : "", stic_suite_name); |
|
495 |
|
stic_header_printer(s, stic_screen_width, ' '); |
484 |
496 |
} |
} |
485 |
497 |
sprintf(s,"%d tests run", sea_tests_run); |
sprintf(s,"%d tests run", sea_tests_run); |
486 |
498 |
stic_header_printer(s, stic_screen_width, ' '); |
stic_header_printer(s, stic_screen_width, ' '); |
File src/stic.h changed (mode: 100644) (index db37e09..143bc5e) |
... |
... |
struct stic_test_data |
162 |
162 |
#define STIC_CAT(X, Y) STIC_CAT_(X, Y) |
#define STIC_CAT(X, Y) STIC_CAT_(X, Y) |
163 |
163 |
#define STIC_CAT_(X, Y) X##Y |
#define STIC_CAT_(X, Y) X##Y |
164 |
164 |
|
|
|
165 |
|
#define STIC_STR(X) STIC_STR_(X) |
|
166 |
|
#define STIC_STR_(X) #X |
|
167 |
|
|
165 |
168 |
/* Test declaration macros. */ |
/* Test declaration macros. */ |
166 |
169 |
|
|
167 |
170 |
#ifdef TEST |
#ifdef TEST |
|
... |
... |
struct stic_test_data |
229 |
232 |
|
|
230 |
233 |
/* Test suite entry point macro. */ |
/* Test suite entry point macro. */ |
231 |
234 |
|
|
|
235 |
|
#ifndef SUITE_NAME |
|
236 |
|
#define SUITE_NAME |
|
237 |
|
#endif |
|
238 |
|
|
232 |
239 |
#define DEFINE_SUITE() \ |
#define DEFINE_SUITE() \ |
233 |
240 |
typedef void (*stic_ft)(void); \ |
typedef void (*stic_ft)(void); \ |
234 |
241 |
stic_ft FIXTURES_VARIABLES; \ |
stic_ft FIXTURES_VARIABLES; \ |
235 |
242 |
\ |
\ |
|
243 |
|
const char *stic_suite_name = STIC_STR(SUITE_NAME); \ |
|
244 |
|
\ |
236 |
245 |
void stic_suite(void) \ |
void stic_suite(void) \ |
237 |
246 |
{ \ |
{ \ |
238 |
247 |
stic_ft fixtures[] = { FIXTURES_VARIABLES }; \ |
stic_ft fixtures[] = { FIXTURES_VARIABLES }; \ |