mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 16:47:44 +00:00
LibC: Implement towctrans
This commit is contained in:
parent
8c7b566629
commit
42031f026a
2 changed files with 28 additions and 3 deletions
|
@ -66,3 +66,20 @@ TEST_CASE(iswctype)
|
|||
EXPECT(iswctype(test_chars[i], -1) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(towctrans)
|
||||
{
|
||||
const wint_t test_chars[] = { L'A', L'a', L'F', L'f', L'Z', L'z', L'0', L'\n', L'.', L'\x00' };
|
||||
|
||||
// Test that valid mappings are wired to the correct implementation.
|
||||
for (unsigned int i = 0; i < sizeof(test_chars) / sizeof(test_chars[0]); i++) {
|
||||
EXPECT(towctrans(test_chars[i], wctrans("tolower")) == towlower(test_chars[i]));
|
||||
EXPECT(towctrans(test_chars[i], wctrans("toupper")) == towupper(test_chars[i]));
|
||||
}
|
||||
|
||||
// Test that invalid mappings always return the character unchanged.
|
||||
for (unsigned int i = 0; i < sizeof(test_chars) / sizeof(test_chars[0]); i++) {
|
||||
EXPECT(towctrans(test_chars[i], 0) == test_chars[i]);
|
||||
EXPECT(towctrans(test_chars[i], -1) == test_chars[i]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue