From 5f5e216a4abae6860f40c6bedd37db275dbb92d0 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 21 Oct 2018 15:38:00 +0200 Subject: Add rawmemcasechr and memrcasechr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- memrchr.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'memrchr.c') diff --git a/memrchr.c b/memrchr.c index 30c818e..36385ec 100644 --- a/memrchr.c +++ b/memrchr.c @@ -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; } -- cgit v1.2.3-70-g09d2