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 "utils/UnitTest/Test.h" 10 11 #include "src/ctype/isascii.h" 12 TEST(LlvmLibcIsAscii,DefaultLocale)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 = 0; ch < 255; ++ch) { 18 if (ch <= 0x7f) 19 EXPECT_NE(__llvm_libc::isascii(ch), 0); 20 else 21 EXPECT_EQ(__llvm_libc::isascii(ch), 0); 22 } 23 } 24