diff options
-rw-r--r-- | test.c | 15 | ||||
-rw-r--r-- | test.h | 4 |
2 files changed, 19 insertions, 0 deletions
@@ -66,3 +66,18 @@ void test_bool_imp(const char *expression, int result, int expected) int success = (result && expected) || (!result && !expected); print_result(success, "%s%s", expected ? "" : "!", expression); } + +void test_string_imp(const char *expression, const char *totest, const char *tocompare) +{ + int success = 1; + int i; + for (i = 0; totest[i] != '\0'; i++) { + if (totest[i] != tocompare[i]) { + success = 0; + } + } + if (tocompare[i] != '\0') { + success = 0; + } + print_result(success, "%s == \"%s\"", expression, tocompare); +} @@ -11,5 +11,9 @@ void test_bool_imp(const char *, int, int); #define test_false(expression) test_bool_imp(#expression, expression, 0) #define test_true(expression) test_bool_imp(#expression, expression, 1) +void test_string_imp(const char*, const char*, const char*); +#define test_string(expression, string) test_string_imp(#expression, expression, string) + void test_assert(void); void test_ctype(void); +void test_locale(void); |