brintos

brintos / llvm-project-archived public Read only

0
0
Text · 816 B · 977224b Raw
23 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "hdr/stdio_macros.h" //for EOF10#include "src/wchar/wctob.h"11#include "test/UnitTest/Test.h"12 13TEST(LlvmLibcWctob, DefaultLocale) {14  // Loops through a subset of the wide characters, verifying that ascii returns15  // itself and everything else returns EOF.16  for (wint_t c = 0; c < 32767; ++c) {17    if (c < 128)18      EXPECT_EQ(LIBC_NAMESPACE::wctob(c), static_cast<int>(c));19    else20      EXPECT_EQ(LIBC_NAMESPACE::wctob(c), EOF);21  }22}23