diff options
author | Mattias Andrée <maandree@kth.se> | 2018-08-19 13:23:21 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2018-08-19 13:23:21 +0200 |
commit | a405c151df74d4d3b4d06c38feff6458bef375a9 (patch) | |
tree | 7a06fe944e440134ab278623b909e73e9f83d3a7 /memmem.c | |
parent | Add str[r]n[case]str and str[n][case]cmpnul (diff) | |
download | libsimple-a405c151df74d4d3b4d06c38feff6458bef375a9.tar.gz libsimple-a405c151df74d4d3b4d06c38feff6458bef375a9.tar.bz2 libsimple-a405c151df74d4d3b4d06c38feff6458bef375a9.tar.xz |
Add str[n]caseeq[null] and some tests
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | memmem.c | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -30,25 +30,25 @@ libsimple_memmem(const void *hay_, size_t hayn, const void *sub_, size_t subn) int main(void) { - assert(!strcmp(libsimple_memmem("test", 4, "test", 4), "test")); - assert(!strcmp(libsimple_memmem("", 0, "", 0), "")); - assert(!strcmp(libsimple_memmem("test", 4, "", 0), "test")); + assert(!strcmpnul(libsimple_memmem("test", 4, "test", 4), "test")); + assert(!strcmpnul(libsimple_memmem("", 0, "", 0), "")); + assert(!strcmpnul(libsimple_memmem("test", 4, "", 0), "test")); assert(!libsimple_memmem("", 0, "test", 4)); assert(!libsimple_memmem("t", 1, "test", 4)); - assert(!strcmp(libsimple_memmem("test", 4, "t", 1), "test")); - assert(!strcmp(libsimple_memmem("test", 4, "e", 1), "est")); - assert(!strcmp(libsimple_memmem("test", 4, "s", 1), "st")); + assert(!strcmpnul(libsimple_memmem("test", 4, "t", 1), "test")); + assert(!strcmpnul(libsimple_memmem("test", 4, "e", 1), "est")); + assert(!strcmpnul(libsimple_memmem("test", 4, "s", 1), "st")); assert(!libsimple_memmem("test", 4, "x", 1)); - assert(!strcmp(libsimple_memmem("test", 4, "te", 2), "test")); - assert(!strcmp(libsimple_memmem("test", 4, "es", 2), "est")); - assert(!strcmp(libsimple_memmem("test", 4, "st", 2), "st")); - assert(!strcmp(libsimple_memmem("test", 5, "t", 2), "t")); + assert(!strcmpnul(libsimple_memmem("test", 4, "te", 2), "test")); + assert(!strcmpnul(libsimple_memmem("test", 4, "es", 2), "est")); + assert(!strcmpnul(libsimple_memmem("test", 4, "st", 2), "st")); + assert(!strcmpnul(libsimple_memmem("test", 5, "t", 2), "t")); assert(!libsimple_memmem("test", 4, "xx", 2)); - assert(!strcmp(libsimple_memmem("abc", 3, "c", 1), "c")); - assert(!strcmp(libsimple_memmem("abc", 3, "bc", 2), "bc")); - assert(!strcmp(libsimple_memmem("abc", 3, "abc", 3), "abc")); + assert(!strcmpnul(libsimple_memmem("abc", 3, "c", 1), "c")); + assert(!strcmpnul(libsimple_memmem("abc", 3, "bc", 2), "bc")); + assert(!strcmpnul(libsimple_memmem("abc", 3, "abc", 3), "abc")); assert(!libsimple_memmem("abc", 3, "abc", 4)); - assert(!strcmp(libsimple_memmem("abcabc", 6, "bc", 2), "bcabc")); + assert(!strcmpnul(libsimple_memmem("abcabc", 6, "bc", 2), "bcabc")); return 0; } |