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

Change assert message to more verbose and readable
Include file and function, also use multiple lines per report item.
Author: xaizek
Author date (UTC): 2015-06-23 15:10
Committer name: xaizek
Committer date (UTC): 2015-06-23 17:02
Parent(s): 098671d7253465848cfe0060ab944f16f7c1b16d
Signing key:
Tree: 723febfa7da61f75e5b863ce0832cc299a568546
File Lines added Lines deleted
src/stic.c 11 6
File src/stic.c changed (mode: 100644) (index 2433c83..3eb199d)
... ... 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 /* TODO: do use function if it differs from test. */
162 (void)function;
161 if (stic_current_test != NULL && strcmp(function, stic_current_test) == 0)
162 {
163 function = "test body";
164 }
163 165
164 166 if (stic_random_failures && random() % 8 == 0) if (stic_random_failures && random() % 8 == 0)
165 167 { {
 
... ... void stic_simple_test_result_log(int passed, char* reason, const char* function,
170 172 { {
171 173 if(stic_machine_readable) if(stic_machine_readable)
172 174 { {
173 printf("%s%s,%s,%u,%s\n", stic_magic_marker, stic_current_fixture_path, stic_current_test, line, reason );
175 printf("%s%s,%s,%u,%s\n", stic_magic_marker, stic_current_fixture_path, stic_current_test, line, reason);
174 176 } }
175 177 else else
176 178 { {
177 printf("%-30s Line %-5u %s\n", stic_current_test, line, reason );
179 printf("\n%s:\n", stic_current_test);
180 printf(" (-) %s:%u\n in %s\n %s\n",
181 file, line, function, reason );
178 182 } }
179 183 sea_tests_failed++; sea_tests_failed++;
180 184 } }
 
... ... void stic_simple_test_result_log(int passed, char* reason, const char* function,
184 188 { {
185 189 if(stic_machine_readable) if(stic_machine_readable)
186 190 { {
187 printf("%s%s,%s,%u,Passed\n", stic_magic_marker, stic_current_fixture_path, stic_current_test, line );
191 printf("%s%s,%s,%u,Passed\n", stic_magic_marker, stic_current_fixture_path, stic_current_test, line);
188 192 } }
189 193 else else
190 194 { {
191 printf("%-30s Line %-5u Passed\n", stic_current_test, line);
195 printf("\n%s\n", stic_current_test);
196 printf(" (+) %s:%u\n in %s\n", file, line, function);
192 197 } }
193 198 } }
194 199 sea_tests_passed++; sea_tests_passed++;
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