diff options
author | Mattias Andrée <maandree@kth.se> | 2018-10-21 20:12:31 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2018-10-21 20:12:31 +0200 |
commit | 2215a474e340c3f8f58efe35fc96d62693eacef7 (patch) | |
tree | 87505305fb28e285b02082f07cdb2760b53ff01d /libsimple.c | |
parent | Add memcasechr (diff) | |
download | libsimple-2215a474e340c3f8f58efe35fc96d62693eacef7.tar.gz libsimple-2215a474e340c3f8f58efe35fc96d62693eacef7.tar.bz2 libsimple-2215a474e340c3f8f58efe35fc96d62693eacef7.tar.xz |
Add memcase{cmp,ends,starts,eq} and mem[r]casemem
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libsimple.c')
-rw-r--r-- | libsimple.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libsimple.c b/libsimple.c index aecd0a3..4aa2368 100644 --- a/libsimple.c +++ b/libsimple.c @@ -1207,6 +1207,18 @@ main(void) assert(libsimple_memeq("abcxyz", "abcx23", 4)); assert(libsimple_memeq("1", "2", 0)); assert(!libsimple_memeq("1", "2", 1)); + assert(!libsimple_memeq("abc", "ABC", 3)); + assert(!libsimple_memeq("ABC", "abc", 3)); + assert(libsimple_memeq("ABC", "ABC", 3)); + + assert(libsimple_memcaseeq("abcxyz", "abc123", 3)); + assert(!libsimple_memcaseeq("abcxyz", "abc123", 4)); + assert(libsimple_memcaseeq("abcxyz", "abcx23", 4)); + assert(libsimple_memcaseeq("1", "2", 0)); + assert(!libsimple_memcaseeq("1", "2", 1)); + assert(libsimple_memcaseeq("abc", "ABC", 3)); + assert(libsimple_memcaseeq("ABC", "abc", 3)); + assert(libsimple_memcaseeq("ABC", "ABC", 3)); stpcpy(buf, "abc123"); assert(!strcmpnul(libsimple_mempset(buf, '.', 3), "123")); |