aboutsummaryrefslogtreecommitdiffstats
path: root/strchrnul.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2018-08-12 21:35:12 +0200
committerMattias Andrée <maandree@kth.se>2018-08-12 21:35:12 +0200
commit93b8428b5812191177c790ea9ffb9158d5a296b4 (patch)
tree8e43220208a7e3b4780a49b8278e731f3b5fcbbf /strchrnul.c
parentAdd DONT_DEFINE_CLOCK_MONOTONIC_RAW (diff)
downloadlibsimple-93b8428b5812191177c790ea9ffb9158d5a296b4.tar.gz
libsimple-93b8428b5812191177c790ea9ffb9158d5a296b4.tar.bz2
libsimple-93b8428b5812191177c790ea9ffb9158d5a296b4.tar.xz
Add tests
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--strchrnul.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/strchrnul.c b/strchrnul.c
index e76978f..893ff34 100644
--- a/strchrnul.c
+++ b/strchrnul.c
@@ -9,3 +9,18 @@ libsimple_strchrnul(const char *s_, int c)
for (; *s && (int)*s != c; s++);
return s;
}
+
+
+#ifdef TEST
+#include <assert.h>
+
+int
+main(void)
+{
+ assert(!strcmp(libsimple_strchrnul("1234512345", '3'), "34512345"));
+ assert(!strcmp(libsimple_strchrnul("1234512345", '1'), "1234512345"));
+ assert(!strcmp(libsimple_strchrnul("1234512345", 'x'), ""));
+ return 0;
+}
+
+#endif