aboutsummaryrefslogtreecommitdiffstats
path: root/strcmpnul.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-06-12 20:13:23 +0200
committerMattias Andrée <maandree@kth.se>2022-06-12 20:13:23 +0200
commit3d6482b0949159c33d6ac2972a69868bdda766f2 (patch)
tree722cf9ab069d75af63664eeae0c35c63aa73c51c /strcmpnul.c
parentFix warnings (diff)
downloadlibsimple-3d6482b0949159c33d6ac2972a69868bdda766f2.tar.gz
libsimple-3d6482b0949159c33d6ac2972a69868bdda766f2.tar.bz2
libsimple-3d6482b0949159c33d6ac2972a69868bdda766f2.tar.xz
Move some test code to newline created .c files
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--strcmpnul.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/strcmpnul.c b/strcmpnul.c
index 0a70610..d3d57fa 100644
--- a/strcmpnul.c
+++ b/strcmpnul.c
@@ -12,6 +12,23 @@ extern inline int libsimple_strcmpnul(const char *, const char *);
int
main(void)
{
+ assert(libsimple_strcmpnul(NULL, NULL) == 0);
+ assert(libsimple_strcmpnul(NULL, "") < 0);
+ assert(libsimple_strcmpnul("", NULL) > 0);
+ assert(libsimple_strcmpnul("", "") == 0);
+ assert(libsimple_strcmpnul(NULL, "x") < 0);
+ assert(libsimple_strcmpnul("x", NULL) > 0);
+ assert(libsimple_strcmpnul("x", "x") == 0);
+ assert(libsimple_strcmpnul("a", "b") < 0);
+ assert(libsimple_strcmpnul("b", "a") > 0);
+ assert(libsimple_strcmpnul("aa", "ab") < 0);
+ assert(libsimple_strcmpnul("ab", "aa") > 0);
+ assert(libsimple_strcmpnul("aa", "aa") == 0);
+ assert(libsimple_strcmpnul("A", "a") < 0);
+ assert(libsimple_strcmpnul("a", "A") > 0);
+ assert(libsimple_strcmpnul("AA", "Aa") < 0);
+ assert(libsimple_strcmpnul("Aa", "AA") > 0);
+ assert(libsimple_strcmpnul("AA", "AA") == 0);
return 0;
}