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

Fix inconsistent indentation in stic.c
Author: xaizek
Author date (UTC): 2023-07-23 12:39
Committer name: xaizek
Committer date (UTC): 2023-07-23 13:42
Parent(s): 9bc9938e13859f09de3e7c7db6d98e3b7bed1299
Signing key: 99DC5E4DB05F6BE2
Tree: 6e7e547dde9c76fa9be0e71995ee6b19f704bc6d
File Lines added Lines deleted
src/stic.c 22 22
File src/stic.c changed (mode: 100644) (index 3555459..ad5abf2)
... ... int stic_is_string_equal_i(const char* s1, const char* s2)
32 32
33 33 static unsigned int GetTickCount() static unsigned int GetTickCount()
34 34 { {
35 enum {
36 MS_PER_SEC = 1000,
37 NS_PER_MS = 1000,
38 };
35 enum {
36 MS_PER_SEC = 1000,
37 NS_PER_MS = 1000,
38 };
39 39
40 struct timeval t;
41 gettimeofday(&t, 0);
42 return t.tv_sec*MS_PER_SEC + t.tv_usec/NS_PER_MS;
40 struct timeval t;
41 gettimeofday(&t, 0);
42 return t.tv_sec*MS_PER_SEC + t.tv_usec/NS_PER_MS;
43 43 } }
44 44
45 45 int stic_is_string_equal_i(const char* s1, const char* s2) int stic_is_string_equal_i(const char* s1, const char* s2)
 
... ... void stic_skip_test(const char fixture[], const char test[])
133 133
134 134 int stic_positive_predicate( void ) int stic_positive_predicate( void )
135 135 { {
136 return 1;
136 return 1;
137 137 } }
138 138
139 139 void stic_printf(char buf[], const char format[], ...) void stic_printf(char buf[], const char format[], ...)
140 140 { {
141 va_list ap;
142 va_start(ap, format);
143 vsprintf(buf, format, ap);
144 va_end(ap);
141 va_list ap;
142 va_start(ap, format);
143 vsprintf(buf, format, ap);
144 va_end(ap);
145 145 } }
146 146
147 147 void stic_suite_teardown( void ) void stic_suite_teardown( void )
 
... ... void stic_assert_string_equal(const char* expected, const char* actual, const ch
332 332
333 333 if ((expected == (char *)0) && (actual == (char *)0)) if ((expected == (char *)0) && (actual == (char *)0))
334 334 { {
335 sprintf(s, "Expected <NULL> but was <NULL>");
336 comparison = 1;
335 sprintf(s, "Expected <NULL> but was <NULL>");
336 comparison = 1;
337 337 } }
338 else if (expected == (char *)0)
338 else if (expected == (char *)0)
339 339 { {
340 sprintf(s, "Expected <NULL> but was \"%s\"", actual);
341 comparison = 0;
340 sprintf(s, "Expected <NULL> but was \"%s\"", actual);
341 comparison = 0;
342 342 } }
343 else if (actual == (char *)0)
343 else if (actual == (char *)0)
344 344 { {
345 sprintf(s, "Expected \"%s\" but was <NULL>", expected);
346 comparison = 0;
345 sprintf(s, "Expected \"%s\" but was <NULL>", expected);
346 comparison = 0;
347 347 } }
348 348 else else
349 349 { {
350 comparison = strcmp(expected, actual) == 0;
351 sprintf(s, "Expected \"%s\" but was \"%s\"", expected, actual);
350 comparison = strcmp(expected, actual) == 0;
351 sprintf(s, "Expected \"%s\" but was \"%s\"", expected, actual);
352 352 } }
353 353
354 354 stic_simple_test_result(comparison, s, function, file, line); stic_simple_test_result(comparison, s, function, file, line);
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