summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix von Leitner <felix-libowfat@fefe.de>2018-09-30 19:29:22 +0000
committerFelix von Leitner <felix-libowfat@fefe.de>2018-09-30 19:29:22 +0000
commit2c4e279f1efe411bcd9e7deb3b2194db2e902b87 (patch)
tree1a73205113d02094591fc2d8e24cad56fe571963
parente0ab8984bfdf4330dc4272dcb9a596af5a154adb (diff)
downloadlibowfat-2c4e279f1efe411bcd9e7deb3b2194db2e902b87.tar.gz
libowfat-2c4e279f1efe411bcd9e7deb3b2194db2e902b87.zip
add unit test
-rw-r--r--str/str_diff.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/str/str_diff.c b/str/str_diff.c
index 57ff0b3..3d28b01 100644
--- a/str/str_diff.c
+++ b/str/str_diff.c
@@ -21,3 +21,15 @@ int str_diff(const char* a, const char* b) {
}
return j;
}
+
+#ifdef UNITTEST
+#include <assert.h>
+#include <string.h>
+
+int main() {
+ assert(str_diff("foo","foo")==0);
+ assert(str_diff("foo","fob")==('o'-'b'));
+ assert(str_diff("foo","foox")==(-'x'));
+ assert(str_diff("foox","foo")=='x');
+}
+#endif