diff options
| author | jvoisin | 2026-04-30 17:50:27 +0200 |
|---|---|---|
| committer | jvoisin | 2026-04-30 17:50:27 +0200 |
| commit | dfdf53df99c8f59e5e3a4296c455041bee96a88d (patch) | |
| tree | 32b8a50c11c708b69874444c4d0969d40d0d7434 /tests | |
| parent | f9239e2c0f0be9856322727887a45333683940a6 (diff) | |
Improve coverage for wmemcpy and wmemmove
Like it's already done for memcpy and memmove. Add tests as well,
to prove that nothing broke.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Makefile | 4 | ||||
| -rw-r--r-- | tests/test_wmemcpy_dynamic_read.c | 16 | ||||
| -rw-r--r-- | tests/test_wmemcpy_static_read.c | 16 | ||||
| -rw-r--r-- | tests/test_wmemmove_dynamic_read.c | 16 | ||||
| -rw-r--r-- | tests/test_wmemmove_static_read.c | 16 |
5 files changed, 68 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile index adea381..fbfd178 100644 --- a/tests/Makefile +++ b/tests/Makefile | |||
| @@ -100,9 +100,13 @@ RUNTIME_TARGETS= \ | |||
| 100 | test_wcscpy_static_write \ | 100 | test_wcscpy_static_write \ |
| 101 | test_wcsncat_static_write \ | 101 | test_wcsncat_static_write \ |
| 102 | test_wcsncpy_static_write \ | 102 | test_wcsncpy_static_write \ |
| 103 | test_wmemcpy_dynamic_read \ | ||
| 103 | test_wmemcpy_dynamic_write \ | 104 | test_wmemcpy_dynamic_write \ |
| 105 | test_wmemcpy_static_read \ | ||
| 104 | test_wmemcpy_static_write \ | 106 | test_wmemcpy_static_write \ |
| 107 | test_wmemmove_dynamic_read \ | ||
| 105 | test_wmemmove_dynamic_write \ | 108 | test_wmemmove_dynamic_write \ |
| 109 | test_wmemmove_static_read \ | ||
| 106 | test_wmemmove_static_write \ | 110 | test_wmemmove_static_write \ |
| 107 | test_wmemset_dynamic \ | 111 | test_wmemset_dynamic \ |
| 108 | test_wmemset_static \ | 112 | test_wmemset_static \ |
diff --git a/tests/test_wmemcpy_dynamic_read.c b/tests/test_wmemcpy_dynamic_read.c new file mode 100644 index 0000000..20ba0ad --- /dev/null +++ b/tests/test_wmemcpy_dynamic_read.c | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <wchar.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | wchar_t buffer[12] = {0}; | ||
| 7 | wmemcpy(buffer, L"αβγδεζηθικ", sizeof(buffer) / sizeof(wchar_t) - 1); | ||
| 8 | printf("%ls\n", buffer); | ||
| 9 | |||
| 10 | CHK_FAIL_START | ||
| 11 | wmemcpy(buffer, L"αβγδεζ", argc); | ||
| 12 | CHK_FAIL_END | ||
| 13 | |||
| 14 | printf("%ls\n", buffer); | ||
| 15 | return ret; | ||
| 16 | } | ||
diff --git a/tests/test_wmemcpy_static_read.c b/tests/test_wmemcpy_static_read.c new file mode 100644 index 0000000..c87d378 --- /dev/null +++ b/tests/test_wmemcpy_static_read.c | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <wchar.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | wchar_t buffer[8] = {0}; | ||
| 7 | wmemcpy(buffer, L"αβγδεζ", 4); | ||
| 8 | printf("%ls\n", buffer); | ||
| 9 | |||
| 10 | CHK_FAIL_START | ||
| 11 | wmemcpy(buffer, L"αβγδεζ", sizeof(buffer) / sizeof(wchar_t)); | ||
| 12 | CHK_FAIL_END | ||
| 13 | |||
| 14 | printf("%ls\n", buffer); | ||
| 15 | return ret; | ||
| 16 | } | ||
diff --git a/tests/test_wmemmove_dynamic_read.c b/tests/test_wmemmove_dynamic_read.c new file mode 100644 index 0000000..05e315b --- /dev/null +++ b/tests/test_wmemmove_dynamic_read.c | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <wchar.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | wchar_t buffer[12] = {0}; | ||
| 7 | wmemmove(buffer, L"αβγδεζηθικ", sizeof(buffer) / sizeof(wchar_t) - 1); | ||
| 8 | printf("%ls\n", buffer); | ||
| 9 | |||
| 10 | CHK_FAIL_START | ||
| 11 | wmemmove(buffer, L"αβγδεζ", argc); | ||
| 12 | CHK_FAIL_END | ||
| 13 | |||
| 14 | printf("%ls\n", buffer); | ||
| 15 | return ret; | ||
| 16 | } | ||
diff --git a/tests/test_wmemmove_static_read.c b/tests/test_wmemmove_static_read.c new file mode 100644 index 0000000..6e4a929 --- /dev/null +++ b/tests/test_wmemmove_static_read.c | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <wchar.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | wchar_t buffer[8] = {0}; | ||
| 7 | wmemmove(buffer, L"αβγδεζ", 4); | ||
| 8 | printf("%ls\n", buffer); | ||
| 9 | |||
| 10 | CHK_FAIL_START | ||
| 11 | wmemmove(buffer, L"αβγδεζ", sizeof(buffer) / sizeof(wchar_t)); | ||
| 12 | CHK_FAIL_END | ||
| 13 | |||
| 14 | printf("%ls\n", buffer); | ||
| 15 | return ret; | ||
| 16 | } | ||
