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

Introduce stic_test typedef
And use it instead of stic_void_void which is also used for
non-test-like functions.
Author: xaizek
Author date (UTC): 2024-08-03 13:26
Committer name: xaizek
Committer date (UTC): 2024-08-06 15:52
Parent(s): 3164b5fa8cdfe58cc160d15757ad0f2ec6e3aab5
Signing key: 99DC5E4DB05F6BE2
Tree: 2b2cc25f71cc301955407f356843a2b85ab422ff
File Lines added Lines deleted
src/stic.c 3 3
src/stic.h 3 2
File src/stic.c changed (mode: 100644) (index 8d854d9..9da27d3)
... ... static stic_void_void stic_fixture_setup = 0;
89 89 static stic_void_void stic_fixture_teardown = 0; static stic_void_void stic_fixture_teardown = 0;
90 90
91 91 const char *stic_current_test_name; const char *stic_current_test_name;
92 stic_void_void stic_current_test;
92 stic_test stic_current_test;
93 93 const char *stic_suite_name; const char *stic_suite_name;
94 94
95 95 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;
 
... ... static int test_had_output(void)
191 191
192 192 void stic_simple_test_result_log(int passed, char* reason, const char* function, const char file[], unsigned int line) void stic_simple_test_result_log(int passed, char* reason, const char* function, const char file[], unsigned int line)
193 193 { {
194 static stic_void_void last_test;
195 static stic_void_void last_failed_test;
194 static stic_test last_test;
195 static stic_test last_failed_test;
196 196
197 197 const char *test_name = (stic_current_test == last_test) ? "" : stic_current_test_name; const char *test_name = (stic_current_test == last_test) ? "" : stic_current_test_name;
198 198
File src/stic.h changed (mode: 100644) (index b6e55fa..7a81cd9)
18 18
19 19 /* Widely used function types. */ /* Widely used function types. */
20 20
21 typedef void (*stic_test)(void);
21 22 typedef void (*stic_void_void)(void); typedef void (*stic_void_void)(void);
22 23 typedef void (*stic_void_string)(char[]); typedef void (*stic_void_string)(char[]);
23 24
 
... ... struct stic_test_data
147 148 { {
148 149 const char *const n; const char *const n;
149 150 const char *const f; const char *const f;
150 stic_void_void t;
151 stic_test t;
151 152 int (*const p)(void); int (*const p)(void);
152 153 }; };
153 154
 
... ... static const char * stic_get_fixture_name(void)
303 304 static void stic_fixture(void) static void stic_fixture(void)
304 305 { {
305 306 extern const char *stic_current_test_name; extern const char *stic_current_test_name;
306 extern stic_void_void stic_current_test;
307 extern stic_test stic_current_test;
307 308
308 309 size_t i; size_t i;
309 310 int has_any_tests = 0; int has_any_tests = 0;
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