diff options
author | Tim Schumacher <timschumi@gmx.de> | 2021-09-22 10:22:24 +0000 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-10-03 05:28:51 +0000 |
commit | fa1208edfd3eff6fac3571a052b6169ef0c27ebf (patch) | |
tree | 11fca05898696e316ee1dcf59e5e457c40314f64 /Tests | |
parent | 485c0ef691822873df8a6961ec099779ff19412c (diff) | |
download | serenity-fa1208edfd3eff6fac3571a052b6169ef0c27ebf.zip |
LibC: Implement wmemset
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/LibC/TestWchar.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Tests/LibC/TestWchar.cpp b/Tests/LibC/TestWchar.cpp index 776f776386..770a4da82c 100644 --- a/Tests/LibC/TestWchar.cpp +++ b/Tests/LibC/TestWchar.cpp @@ -114,6 +114,29 @@ TEST_CASE(wmemcpy) EXPECT_EQ(memcmp(buf, input, 8 * sizeof(wchar_t)), 0); } +TEST_CASE(wmemset) +{ + auto buf_length = 8; + auto buf = static_cast<wchar_t*>(calloc(buf_length, sizeof(wchar_t))); + + if (!buf) { + FAIL("Could not allocate memory for target buffer"); + return; + } + + wchar_t* ret = wmemset(buf, L'\U0001f41e', buf_length - 1); + + EXPECT_EQ(ret, buf); + + for (int i = 0; i < buf_length - 1; i++) { + EXPECT_EQ(buf[i], L'\U0001f41e'); + } + + EXPECT_EQ(buf[buf_length - 1], L'\0'); + + free(buf); +} + TEST_CASE(wcscoll) { // Check if wcscoll is sorting correctly. At the moment we are doing raw char comparisons, |