aboutsummaryrefslogtreecommitdiffstats
path: root/strncmpnul.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 /strncmpnul.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 'strncmpnul.c')
-rw-r--r--strncmpnul.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/strncmpnul.c b/strncmpnul.c
index a5c9d7a..25fd49b 100644
--- a/strncmpnul.c
+++ b/strncmpnul.c
@@ -12,6 +12,46 @@ extern inline int libsimple_strncmpnul(const char *, const char *, size_t);
int
main(void)
{
+ assert(libsimple_strncmpnul(NULL, NULL, 5) == 0);
+ assert(libsimple_strncmpnul(NULL, "", 5) < 0);
+ assert(libsimple_strncmpnul("", NULL, 5) > 0);
+ assert(libsimple_strncmpnul("", "", 5) == 0);
+ assert(libsimple_strncmpnul(NULL, "x", 5) < 0);
+ assert(libsimple_strncmpnul("x", NULL, 5) > 0);
+ assert(libsimple_strncmpnul("x", "x", 5) == 0);
+ assert(libsimple_strncmpnul("a", "b", 5) < 0);
+ assert(libsimple_strncmpnul("b", "a", 5) > 0);
+ assert(libsimple_strncmpnul("aa", "ab", 5) < 0);
+ assert(libsimple_strncmpnul("ab", "aa", 5) > 0);
+ assert(libsimple_strncmpnul("aa", "aa", 5) == 0);
+ assert(libsimple_strncmpnul("A", "a", 5) < 0);
+ assert(libsimple_strncmpnul("a", "A", 5) > 0);
+ assert(libsimple_strncmpnul("AA", "Aa", 5) < 0);
+ assert(libsimple_strncmpnul("Aa", "AA", 5) > 0);
+ assert(libsimple_strncmpnul("AA", "AA", 5) == 0);
+ assert(libsimple_strncmpnul("aa", "ab", 1) == 0);
+ assert(libsimple_strncmpnul("ab", "aa", 1) == 0);
+ assert(libsimple_strncmpnul("aa", "aa", 1) == 0);
+ assert(libsimple_strncmpnul("AA", "Aa", 1) == 0);
+ assert(libsimple_strncmpnul("Aa", "AA", 1) == 0);
+ assert(libsimple_strncmpnul("AA", "AA", 1) == 0);
+ assert(libsimple_strncmpnul(NULL, NULL, 0) == 0);
+ assert(libsimple_strncmpnul(NULL, "", 0) < 0);
+ assert(libsimple_strncmpnul("", NULL, 0) > 0);
+ assert(libsimple_strncmpnul("", "", 0) == 0);
+ assert(libsimple_strncmpnul(NULL, "x", 0) < 0);
+ assert(libsimple_strncmpnul("x", NULL, 0) > 0);
+ assert(libsimple_strncmpnul("x", "x", 0) == 0);
+ assert(libsimple_strncmpnul("a", "b", 0) == 0);
+ assert(libsimple_strncmpnul("b", "a", 0) == 0);
+ assert(libsimple_strncmpnul("aa", "ab", 0) == 0);
+ assert(libsimple_strncmpnul("ab", "aa", 0) == 0);
+ assert(libsimple_strncmpnul("aa", "aa", 0) == 0);
+ assert(libsimple_strncmpnul("A", "a", 0) == 0);
+ assert(libsimple_strncmpnul("a", "A", 0) == 0);
+ assert(libsimple_strncmpnul("AA", "Aa", 0) == 0);
+ assert(libsimple_strncmpnul("Aa", "AA", 0) == 0);
+ assert(libsimple_strncmpnul("AA", "AA", 0) == 0);
return 0;
}