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