File src/stic.c changed (mode: 100644) (index 0342ad9..7c6a900) |
... |
... |
void stic_assert_string_ends_with(const char* expected, const char* actual, cons |
415 |
415 |
stic_simple_test_result(strcmp(expected, actual+(strlen(actual)-strlen(expected)))==0, s, function, file, line); |
stic_simple_test_result(strcmp(expected, actual+(strlen(actual)-strlen(expected)))==0, s, function, file, line); |
416 |
416 |
} |
} |
417 |
417 |
|
|
|
418 |
|
void stic_assert_wstring_ends_with(const wchar_t expected[], const wchar_t actual[], const char function[], const char file[], unsigned int line) |
|
419 |
|
{ |
|
420 |
|
char s[STIC_PRINT_BUFFER_SIZE]; |
|
421 |
|
#ifdef STIC_C99 |
|
422 |
|
snprintf(s, sizeof(s), "Expected \"%ls\" to end with \"%ls\"", actual, expected); |
|
423 |
|
#else |
|
424 |
|
snprintf(s, sizeof(s), "Wide string doesn't end with the expected suffix"); |
|
425 |
|
#endif |
|
426 |
|
stic_simple_test_result(wcscmp(expected, actual+(wcslen(actual)-wcslen(expected)))==0, s, function, file, line); |
|
427 |
|
} |
|
428 |
|
|
418 |
429 |
void stic_assert_string_starts_with(const char* expected, const char* actual, const char* function, const char file[], unsigned int line) |
void stic_assert_string_starts_with(const char* expected, const char* actual, const char* function, const char file[], unsigned int line) |
419 |
430 |
{ |
{ |
420 |
431 |
char s[STIC_PRINT_BUFFER_SIZE]; |
char s[STIC_PRINT_BUFFER_SIZE]; |
File src/stic.h changed (mode: 100644) (index 087ec43..12ba03c) |
... |
... |
void stic_assert_double_equal(double expected, double actual, double delta, cons |
41 |
41 |
void stic_assert_string_equal(const char* expected, const char* actual, const char* function, const char file[], unsigned int line); |
void stic_assert_string_equal(const char* expected, const char* actual, const char* function, const char file[], unsigned int line); |
42 |
42 |
void stic_assert_wstring_equal(const wchar_t expected[], const wchar_t actual[], const char function[], const char file[], unsigned int line); |
void stic_assert_wstring_equal(const wchar_t expected[], const wchar_t actual[], const char function[], const char file[], unsigned int line); |
43 |
43 |
void stic_assert_string_ends_with(const char* expected, const char* actual, const char* function, const char file[], unsigned int line); |
void stic_assert_string_ends_with(const char* expected, const char* actual, const char* function, const char file[], unsigned int line); |
|
44 |
|
void stic_assert_wstring_ends_with(const wchar_t expected[], const wchar_t actual[], const char function[], const char file[], unsigned int line); |
44 |
45 |
void stic_assert_string_starts_with(const char* expected, const char* actual, const char* function, const char file[], unsigned int line); |
void stic_assert_string_starts_with(const char* expected, const char* actual, const char* function, const char file[], unsigned int line); |
45 |
46 |
void stic_assert_string_contains(const char* expected, const char* actual, const char* function, const char file[], unsigned int line); |
void stic_assert_string_contains(const char* expected, const char* actual, const char* function, const char file[], unsigned int line); |
46 |
47 |
void stic_assert_string_doesnt_contain(const char* expected, const char* actual, const char* function, const char file[], unsigned int line); |
void stic_assert_string_doesnt_contain(const char* expected, const char* actual, const char* function, const char file[], unsigned int line); |
|
... |
... |
void stic_printf(char buf[], const char format[], ...); |
67 |
68 |
#define assert_ulong_equal(expected, actual) do { stic_assert_ulong_equal(expected, actual, __FUNCTION__, __FILE__, __LINE__); } while (0) |
#define assert_ulong_equal(expected, actual) do { stic_assert_ulong_equal(expected, actual, __FUNCTION__, __FILE__, __LINE__); } while (0) |
68 |
69 |
#define assert_string_equal(expected, actual) do { stic_assert_string_equal(expected, actual, __FUNCTION__, __FILE__, __LINE__); } while (0) |
#define assert_string_equal(expected, actual) do { stic_assert_string_equal(expected, actual, __FUNCTION__, __FILE__, __LINE__); } while (0) |
69 |
70 |
#define assert_wstring_equal(expected, actual) do { stic_assert_wstring_equal(expected, actual, __FUNCTION__, __FILE__, __LINE__); } while (0) |
#define assert_wstring_equal(expected, actual) do { stic_assert_wstring_equal(expected, actual, __FUNCTION__, __FILE__, __LINE__); } while (0) |
|
71 |
|
#define assert_wstring_ends_with(expected, actual) do { stic_assert_wstring_ends_with(expected, actual, __FUNCTION__, __FILE__, __LINE__); } while (0) |
70 |
72 |
#define assert_n_array_equal(expected, actual, n) do { int stic_count; for(stic_count=0; stic_count<n; stic_count++) { char s_seatest[STIC_PRINT_BUFFER_SIZE]; stic_printf(s_seatest,"Expected %d to be %d at position %d", actual[stic_count], expected[stic_count], stic_count); stic_simple_test_result((expected[stic_count] == actual[stic_count]), s_seatest, __FUNCTION__, __FILE__, __LINE__);} } while (0) |
#define assert_n_array_equal(expected, actual, n) do { int stic_count; for(stic_count=0; stic_count<n; stic_count++) { char s_seatest[STIC_PRINT_BUFFER_SIZE]; stic_printf(s_seatest,"Expected %d to be %d at position %d", actual[stic_count], expected[stic_count], stic_count); stic_simple_test_result((expected[stic_count] == actual[stic_count]), s_seatest, __FUNCTION__, __FILE__, __LINE__);} } while (0) |
71 |
73 |
#define assert_bit_set(bit_number, value) { stic_simple_test_result(((1 << bit_number) & value), " Expected bit to be set" , __FUNCTION__, __FILE__, __LINE__); } while (0) |
#define assert_bit_set(bit_number, value) { stic_simple_test_result(((1 << bit_number) & value), " Expected bit to be set" , __FUNCTION__, __FILE__, __LINE__); } while (0) |
72 |
74 |
#define assert_bit_not_set(bit_number, value) { stic_simple_test_result(!((1 << bit_number) & value), " Expected bit not to to be set" , __FUNCTION__, __FILE__, __LINE__); } while (0) |
#define assert_bit_not_set(bit_number, value) { stic_simple_test_result(!((1 << bit_number) & value), " Expected bit not to to be set" , __FUNCTION__, __FILE__, __LINE__); } while (0) |