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