1//===-- Unittests for isascii----------------------------------------------===//
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 "test/UnitTest/Test.h"
10
11#include "src/ctype/isascii.h"
12
13TEST(LlvmLibcIsAscii, DefaultLocale) {
14 // Loops through all characters, verifying that ascii characters
15 // (which are all 7 bit unsigned integers)
16 // return a non-zero integer and everything else returns zero.
17 for (int ch = -255; ch < 255; ++ch) {
18 if (0 <= ch && ch <= 0x7f)
19 EXPECT_NE(LIBC_NAMESPACE::isascii(ch), 0);
20 else
21 EXPECT_EQ(LIBC_NAMESPACE::isascii(ch), 0);
22 }
23}
24

source code of libc/test/src/ctype/isascii_test.cpp