aboutsummaryrefslogtreecommitdiff
path: root/libc/test/run-memops.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/test/run-memops.c')
-rw-r--r--libc/test/run-memops.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libc/test/run-memops.c b/libc/test/run-memops.c
index 80822df..cc107f7 100644
--- a/libc/test/run-memops.c
+++ b/libc/test/run-memops.c
@@ -22,6 +22,7 @@
#include <stdio.h>
int test_memset(char* buf, int c, size_t s);
+int test_memchr(const void *ptr, int c, size_t n, void* expected);
int main(void)
{
@@ -40,5 +41,11 @@ int main(void)
assert(test_memset(buf, 0, 1024) == 0);
free(buf);
+ buf = malloc(20);
+ strncpy(buf, "Hello World!", 20);
+ assert(test_memchr(buf, 'o', strlen(buf), buf+4));
+ assert(test_memchr(buf, 'a', strlen(buf), NULL));
+ free(buf);
+
return 0;
}