summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test.c15
-rw-r--r--test.h4
2 files changed, 19 insertions, 0 deletions
diff --git a/test.c b/test.c
index 43e9bf7..2d25648 100644
--- a/test.c
+++ b/test.c
@@ -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);
+}
diff --git a/test.h b/test.h
index 6eedc6f..7fa1efe 100644
--- a/test.h
+++ b/test.h
@@ -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);