diff options
author | Tim Schumacher <timschumi@gmx.de> | 2021-09-22 08:52:27 +0000 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-10-03 05:28:51 +0000 |
commit | 1b078f87b77e65afac3a998af8223bbebe729df0 (patch) | |
tree | ce0c6d5d77e8a4ef5885736f6a430f3ea7ca995b /Tests | |
parent | c80b65b8276dd3f2edc21ec0e3e304b45522e24b (diff) | |
download | serenity-1b078f87b77e65afac3a998af8223bbebe729df0.zip |
LibC: Implement wcspbrk
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/LibC/TestWchar.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Tests/LibC/TestWchar.cpp b/Tests/LibC/TestWchar.cpp index d4e84725d3..ed248531a3 100644 --- a/Tests/LibC/TestWchar.cpp +++ b/Tests/LibC/TestWchar.cpp @@ -8,6 +8,33 @@ #include <wchar.h> +TEST_CASE(wcspbrk) +{ + const wchar_t* input; + wchar_t* ret; + + // Test empty haystack. + ret = wcspbrk(L"", L"ab"); + EXPECT_EQ(ret, nullptr); + + // Test empty needle. + ret = wcspbrk(L"ab", L""); + EXPECT_EQ(ret, nullptr); + + // Test search for a single character. + input = L"abcd"; + ret = wcspbrk(input, L"a"); + EXPECT_EQ(ret, input); + + // Test search for multiple characters, none matches. + ret = wcspbrk(input, L"zxy"); + EXPECT_EQ(ret, nullptr); + + // Test search for multiple characters, last matches. + ret = wcspbrk(input, L"zxyc"); + EXPECT_EQ(ret, input + 2); +} + TEST_CASE(wcscoll) { // Check if wcscoll is sorting correctly. At the moment we are doing raw char comparisons, |