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); |