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

Don't display name of the same test twice
This is helpful to group them visually.
Author: xaizek
Author date (UTC): 2015-06-23 15:13
Committer name: xaizek
Committer date (UTC): 2015-06-23 17:02
Parent(s): f7c357c3a41cce07b96827fb20144f4ae6e008b9
Signing key:
Tree: 220fa466680b3daaa12e9a2bcb7b2fe0aadc0644
File Lines added Lines deleted
src/stic.c 14 2
File src/stic.c changed (mode: 100644) (index 3eb199d..431e992)
... ... static int stic_fixture_tests_failed;
158 158
159 159 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)
160 160 { {
161 static const char *last_test;
162
163 const char *test_name = (stic_current_test == last_test) ? "" : stic_current_test;
164
161 165 if (stic_current_test != NULL && strcmp(function, stic_current_test) == 0) if (stic_current_test != NULL && strcmp(function, stic_current_test) == 0)
162 166 { {
163 167 function = "test body"; function = "test body";
 
... ... void stic_simple_test_result_log(int passed, char* reason, const char* function,
176 180 } }
177 181 else else
178 182 { {
179 printf("\n%s:\n", stic_current_test);
183 if(stic_current_test != last_test)
184 {
185 printf("\n%s:\n", test_name);
186 }
180 187 printf(" (-) %s:%u\n in %s\n %s\n", printf(" (-) %s:%u\n in %s\n %s\n",
181 188 file, line, function, reason ); file, line, function, reason );
182 189 } }
183 190 sea_tests_failed++; sea_tests_failed++;
191 last_test = stic_current_test;
184 192 } }
185 193 else else
186 194 { {
 
... ... void stic_simple_test_result_log(int passed, char* reason, const char* function,
192 200 } }
193 201 else else
194 202 { {
195 printf("\n%s\n", stic_current_test);
203 if(stic_current_test != last_test)
204 {
205 printf("\n%s\n", test_name);
206 }
196 207 printf(" (+) %s:%u\n in %s\n", file, line, function); printf(" (+) %s:%u\n in %s\n", file, line, function);
197 208 } }
209 last_test = stic_current_test;
198 210 } }
199 211 sea_tests_passed++; sea_tests_passed++;
200 212 } }
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