diff options
author | Mattias Andrée <maandree@kth.se> | 2018-10-21 15:38:00 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2018-10-21 18:15:34 +0200 |
commit | 5f5e216a4abae6860f40c6bedd37db275dbb92d0 (patch) | |
tree | 3f22ab92c57fbac30c14d548cd545ed1ec77f395 /memrchr.c | |
parent | m (diff) | |
download | libsimple-5f5e216a4abae6860f40c6bedd37db275dbb92d0.tar.gz libsimple-5f5e216a4abae6860f40c6bedd37db275dbb92d0.tar.bz2 libsimple-5f5e216a4abae6860f40c6bedd37db275dbb92d0.tar.xz |
Add rawmemcasechr and memrcasechr
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'memrchr.c')
-rw-r--r-- | memrchr.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -19,9 +19,15 @@ libsimple_memrchr(const void *s_, int c_, size_t n_) int main(void) { - assert(!strcmpnul(libsimple_memrchr("1234512345", '3', sizeof("1234512345") - 1), "345")); - assert(!strcmpnul(libsimple_memrchr("1234512345", '5', sizeof("1234512345") - 1), "5")); - assert(!libsimple_memrchr("1234512345", 'x', sizeof("1234512345") - 1)); + assert(!strcmpnul(libsimple_memrchr("abcABCabcABC", 'a', sizeof("abcABCabcABC") - 1), "abcABC")); + assert(!strcmpnul(libsimple_memrchr("abcABCabcABC", 'c', sizeof("abcABCabcABC") - 1), "cABC")); + assert(!strcmpnul(libsimple_memrchr("abcABCabcABC", 'A', sizeof("abcABCabcABC") - 1), "ABC")); + assert(!strcmpnul(libsimple_memrchr("abcABCabcABC", 'C', sizeof("abcABCabcABC") - 1), "C")); + assert(!strcmpnul(libsimple_memrchr("ABCabcABCabc", 'a', sizeof("ABCabcABCabc") - 1), "abc")); + assert(!strcmpnul(libsimple_memrchr("ABCabcABCabc", 'c', sizeof("ABCabcABCabc") - 1), "c")); + assert(!strcmpnul(libsimple_memrchr("ABCabcABCabc", 'A', sizeof("ABCabcABCabc") - 1), "ABCabc")); + assert(!strcmpnul(libsimple_memrchr("ABCabcABCabc", 'C', sizeof("ABCabcABCabc") - 1), "Cabc")); + assert(!libsimple_memrchr("abcABCabcABC", 'x', sizeof("abcABCabcABC") - 1)); return 0; } |