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 "test/UnitTest/Test.h"
12
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 = -255; ch < 255; ++ch) {
17 if ('0' <= ch && ch <= '9')
18 EXPECT_NE(LIBC_NAMESPACE::isdigit(ch), 0);
19 else
20 EXPECT_EQ(LIBC_NAMESPACE::isdigit(ch), 0);
21 }
22}
23

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