1 //===-- Unittests for isalnum----------------------------------------------===// 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 "src/ctype/isalnum.h" 10 11 #include "utils/UnitTest/Test.h" 12 TEST(IsAlNum,DefaultLocale)13TEST(IsAlNum, DefaultLocale) { 14 // Loops through all characters, verifying that numbers and letters 15 // return non-zero integer and everything else returns a zero. 16 for (int c = 0; c < 255; ++c) { 17 if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || 18 ('0' <= c && c <= '9')) 19 EXPECT_NE(__llvm_libc::isalnum(c), 0); 20 else 21 EXPECT_EQ(__llvm_libc::isalnum(c), 0); 22 } 23 } 24