summaryrefslogtreecommitdiff
path: root/src/user/app/tests/libc/string.c
diff options
context:
space:
mode:
authordzwdz2022-08-26 12:19:13 +0200
committerdzwdz2022-08-26 12:19:13 +0200
commiteba8e12e8f0d113056264f71b8cbcda730e93506 (patch)
treeb9d5efa10cfa2d308a7df23a91cf3ea2199950be /src/user/app/tests/libc/string.c
parentdc351c97829ef8d15219d90e32101768bd0481be (diff)
shared: memmove
Diffstat (limited to 'src/user/app/tests/libc/string.c')
-rw-r--r--src/user/app/tests/libc/string.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/user/app/tests/libc/string.c b/src/user/app/tests/libc/string.c
index f865d72..2e00049 100644
--- a/src/user/app/tests/libc/string.c
+++ b/src/user/app/tests/libc/string.c
@@ -38,6 +38,17 @@ static void test_memset(void) {
free(buf);
}
+static void test_memmove(void) {
+ const int partsize = 64;
+ char buf[partsize * 3];
+ for (int i = 0; i < partsize * 2; i++) {
+ memset(buf, 0, sizeof buf);
+ for (int j = 0; j < partsize; j++) buf[i + j] = j;
+ memmove(buf + partsize, buf + i, partsize);
+ for (int j = 0; j < partsize; j++) test(buf[partsize + j] == j);
+ }
+}
+
static void test_strcmp(void) {
test(0 == strcmp("string", "string"));
test(0 > strcmp("str", "string"));
@@ -102,6 +113,7 @@ static void test_strtok(void) {
void r_libc_string(void) {
run_test(test_memcmp);
run_test(test_memset);
+ run_test(test_memmove);
run_test(test_strcmp);
run_test(test_strtol);
run_test(test_strspn);