xaizek / stic (License: MIT) (since 2018-12-07)
Simple Tests In C with optional automatic test registration in C.
Commit a067d9ec88ae412004b99d3cab9c8c4eb5dfd63d

Display test suite name in the banner when present
Author: xaizek
Author date (UTC): 2015-06-23 16:42
Committer name: xaizek
Committer date (UTC): 2015-06-23 17:02
Parent(s): 2b90954488fe9531561c04dca018e5e644fa65c2
Signing key:
Tree: 8d3ddaf0d82a7dc47760600e22bcfa871ac578ff
File Lines added Lines deleted
src/stic.c 14 2
src/stic.h 9 0
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 }; \
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/stic

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/stic

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master