1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:57:35 +00:00

LibC: Implement wctype

This commit is contained in:
Tim Schumacher 2021-09-17 18:12:27 +02:00 committed by Brian Gianforcaro
parent ac406c8d0e
commit 7b17230d7a
3 changed files with 86 additions and 3 deletions

30
Tests/LibC/TestWctype.cpp Normal file
View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2021, the SerenityOS developers
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibTest/TestCase.h>
#include <wctype.h>
TEST_CASE(wctype)
{
// Test that existing properties return non-zero wctypes.
EXPECT(wctype("alnum") != 0);
EXPECT(wctype("alpha") != 0);
EXPECT(wctype("blank") != 0);
EXPECT(wctype("cntrl") != 0);
EXPECT(wctype("digit") != 0);
EXPECT(wctype("graph") != 0);
EXPECT(wctype("lower") != 0);
EXPECT(wctype("print") != 0);
EXPECT(wctype("punct") != 0);
EXPECT(wctype("space") != 0);
EXPECT(wctype("upper") != 0);
EXPECT(wctype("xdigit") != 0);
// Test that invalid properties return the "invalid" wctype (0).
EXPECT(wctype("") == 0);
EXPECT(wctype("abc") == 0);
}