aboutsummaryrefslogtreecommitdiffstats
path: root/strncasecmpnul.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-08-18 09:58:23 +0200
committerMattias Andrée <maandree@kth.se>2024-08-18 09:58:23 +0200
commita69f0f613687edf6c1f1ee83b462f77e8ea3c9a9 (patch)
treed976683461a0f427d2f1ef79a8732a048dd0c67b /strncasecmpnul.c
parentMerge tag '1.3' into since (diff)
parentUpdate VERSION_MINOR (diff)
downloadlibsimple-a69f0f613687edf6c1f1ee83b462f77e8ea3c9a9.tar.gz
libsimple-a69f0f613687edf6c1f1ee83b462f77e8ea3c9a9.tar.bz2
libsimple-a69f0f613687edf6c1f1ee83b462f77e8ea3c9a9.tar.xz
Merge tag '1.4' into since
Version 1.4
Diffstat (limited to 'strncasecmpnul.c')
-rw-r--r--strncasecmpnul.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/strncasecmpnul.c b/strncasecmpnul.c
new file mode 100644
index 0000000..5df9e7d
--- /dev/null
+++ b/strncasecmpnul.c
@@ -0,0 +1,58 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+#ifndef TEST
+
+
+extern inline int libsimple_strncasecmpnul(const char *, const char *, size_t);
+
+
+#else
+#include "test.h"
+
+int
+main(void)
+{
+ assert(libsimple_strncasecmpnul(NULL, NULL, 5) == 0);
+ assert(libsimple_strncasecmpnul(NULL, "", 5) < 0);
+ assert(libsimple_strncasecmpnul("", NULL, 5) > 0);
+ assert(libsimple_strncasecmpnul("", "", 5) == 0);
+ assert(libsimple_strncasecmpnul(NULL, "x", 5) < 0);
+ assert(libsimple_strncasecmpnul("x", NULL, 5) > 0);
+ assert(libsimple_strncasecmpnul("x", "x", 5) == 0);
+ assert(libsimple_strncasecmpnul("a", "b", 5) < 0);
+ assert(libsimple_strncasecmpnul("b", "a", 5) > 0);
+ assert(libsimple_strncasecmpnul("aa", "ab", 5) < 0);
+ assert(libsimple_strncasecmpnul("ab", "aa", 5) > 0);
+ assert(libsimple_strncasecmpnul("aa", "aa", 5) == 0);
+ assert(libsimple_strncasecmpnul("A", "a", 5) == 0);
+ assert(libsimple_strncasecmpnul("a", "A", 5) == 0);
+ assert(libsimple_strncasecmpnul("AA", "Aa", 5) == 0);
+ assert(libsimple_strncasecmpnul("Aa", "AA", 5) == 0);
+ assert(libsimple_strncasecmpnul("AA", "AA", 5) == 0);
+ assert(libsimple_strncasecmpnul("aa", "ab", 1) == 0);
+ assert(libsimple_strncasecmpnul("ab", "aa", 1) == 0);
+ assert(libsimple_strncasecmpnul("aa", "aa", 1) == 0);
+ assert(libsimple_strncasecmpnul("AA", "Aa", 1) == 0);
+ assert(libsimple_strncasecmpnul("Aa", "AA", 1) == 0);
+ assert(libsimple_strncasecmpnul("AA", "AA", 1) == 0);
+ assert(libsimple_strncasecmpnul(NULL, NULL, 0) == 0);
+ assert(libsimple_strncasecmpnul(NULL, "", 0) < 0);
+ assert(libsimple_strncasecmpnul("", NULL, 0) > 0);
+ assert(libsimple_strncasecmpnul("", "", 0) == 0);
+ assert(libsimple_strncasecmpnul(NULL, "x", 0) < 0);
+ assert(libsimple_strncasecmpnul("x", NULL, 0) > 0);
+ assert(libsimple_strncasecmpnul("x", "x", 0) == 0);
+ assert(libsimple_strncasecmpnul("a", "b", 0) == 0);
+ assert(libsimple_strncasecmpnul("b", "a", 0) == 0);
+ assert(libsimple_strncasecmpnul("aa", "ab", 0) == 0);
+ assert(libsimple_strncasecmpnul("ab", "aa", 0) == 0);
+ assert(libsimple_strncasecmpnul("aa", "aa", 0) == 0);
+ assert(libsimple_strncasecmpnul("A", "a", 0) == 0);
+ assert(libsimple_strncasecmpnul("a", "A", 0) == 0);
+ assert(libsimple_strncasecmpnul("AA", "Aa", 0) == 0);
+ assert(libsimple_strncasecmpnul("Aa", "AA", 0) == 0);
+ assert(libsimple_strncasecmpnul("AA", "AA", 0) == 0);
+ return 0;
+}
+
+#endif