1 //===-- Unittests for wctob ---------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "hdr/stdio_macros.h" //for EOF
10 #include "src/wchar/wctob.h"
11 #include "test/UnitTest/Test.h"
13 TEST(LlvmLibcWctob
, DefaultLocale
) {
14 // Loops through a subset of the wide characters, verifying that ascii returns
15 // itself and everything else returns EOF.
16 for (wint_t c
= 0; c
< 32767; ++c
) {
18 EXPECT_EQ(LIBC_NAMESPACE::wctob(c
), static_cast<int>(c
));
20 EXPECT_EQ(LIBC_NAMESPACE::wctob(c
), EOF
);