1//===-- Unittests for wctob ---------------------------------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#include <stdio.h> //for EOF
10
11#include "src/wchar/wctob.h"
12
13#include "test/UnitTest/Test.h"
14
15TEST(LlvmLibcWctob, DefaultLocale) {
16 // Loops through a subset of the wide characters, verifying that ascii returns
17 // itself and everything else returns EOF.
18 for (wint_t c = 0; c < 32767; ++c) {
19 if (c < 128)
20 EXPECT_EQ(LIBC_NAMESPACE::wctob(c), static_cast<int>(c));
21 else
22 EXPECT_EQ(LIBC_NAMESPACE::wctob(c), EOF);
23 }
24}
25

source code of libc/test/src/wchar/wctob_test.cpp