From 93b8428b5812191177c790ea9ffb9158d5a296b4 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 12 Aug 2018 21:35:12 +0200 Subject: Add tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- strchrnul.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'strchrnul.c') 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 + +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 -- cgit v1.2.3-70-g09d2