diff options
author | Tim Schumacher <timschumi@gmx.de> | 2021-09-22 10:21:06 +0000 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-10-03 05:28:51 +0000 |
commit | 485c0ef691822873df8a6961ec099779ff19412c (patch) | |
tree | 088fd91b6af2ddf5559bd0824a71b4a7598eef00 /Tests | |
parent | 0ca1df4dc64abab33b1b26eac81691f56ad81683 (diff) | |
download | serenity-485c0ef691822873df8a6961ec099779ff19412c.zip |
LibC: Implement wmemcpy
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/LibC/TestWchar.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Tests/LibC/TestWchar.cpp b/Tests/LibC/TestWchar.cpp index 82e658366a..776f776386 100644 --- a/Tests/LibC/TestWchar.cpp +++ b/Tests/LibC/TestWchar.cpp @@ -6,6 +6,7 @@ #include <LibTest/TestCase.h> +#include <string.h> #include <wchar.h> TEST_CASE(wcspbrk) @@ -97,6 +98,22 @@ TEST_CASE(wmemchr) EXPECT_EQ(ret, input + 6); } +TEST_CASE(wmemcpy) +{ + const wchar_t* input = L"abc\0def"; + auto buf = static_cast<wchar_t*>(malloc(8 * sizeof(wchar_t))); + + if (!buf) { + FAIL("Could not allocate space for copy target"); + return; + } + + wchar_t* ret = wmemcpy(buf, input, 8); + + EXPECT_EQ(ret, buf); + EXPECT_EQ(memcmp(buf, input, 8 * sizeof(wchar_t)), 0); +} + TEST_CASE(wcscoll) { // Check if wcscoll is sorting correctly. At the moment we are doing raw char comparisons, |