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 "test/UnitTest/Test.h"
12
13TEST(LlvmLibcIsAlNum, 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 = -255; c < 255; ++c) {
17 if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') ||
18 ('0' <= c && c <= '9'))
19 EXPECT_NE(LIBC_NAMESPACE::isalnum(c), 0);
20 else
21 EXPECT_EQ(LIBC_NAMESPACE::isalnum(c), 0);
22 }
23}
24

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