summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/LibC/TestWchar.cpp17
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,