Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libc / test / src / wchar / btowc_test.cpp
blobb5fcb451bd07b0315f243f29e27eeeed9b92de8d
1 //===-- Unittests for btowc ---------------------------------------------===//
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 //===----------------------------------------------------------------------===//
9 #include <wchar.h> //for WEOF
11 #include "src/wchar/btowc.h"
13 #include "test/UnitTest/Test.h"
15 TEST(LlvmLibcBtowc, DefaultLocale) {
16 // Loops through all characters, verifying that ascii returns itself and
17 // everything else returns WEOF.
18 for (int c = 0; c < 255; ++c) {
19 if (c < 128)
20 EXPECT_EQ(LIBC_NAMESPACE::btowc(c), static_cast<wint_t>(c));
21 else
22 EXPECT_EQ(LIBC_NAMESPACE::btowc(c), WEOF);