From 3d6482b0949159c33d6ac2972a69868bdda766f2 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 12 Jun 2022 20:13:23 +0200 Subject: Move some test code to newline created .c files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- strncasecmpnul.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'strncasecmpnul.c') diff --git a/strncasecmpnul.c b/strncasecmpnul.c index e15bcfd..5df9e7d 100644 --- a/strncasecmpnul.c +++ b/strncasecmpnul.c @@ -12,6 +12,46 @@ extern inline int libsimple_strncasecmpnul(const char *, const char *, size_t); 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; } -- cgit v1.2.3-70-g09d2