| 1 | //===-- Unittests for isspace----------------------------------------------===// |
| 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/isspace.h" |
| 10 | #include "test/UnitTest/Test.h" |
| 11 | |
| 12 | TEST(LlvmLibcIsSpace, DefaultLocale) { |
| 13 | // Loops through all characters, verifying that space characters |
| 14 | // return true and everything else returns false. |
| 15 | // Hexadecimal | Symbol |
| 16 | // --------------------------- |
| 17 | // 0x09 | horizontal tab |
| 18 | // 0x0a | line feed |
| 19 | // 0x0b | vertical tab |
| 20 | // 0x0d | carriage return |
| 21 | // 0x20 | space |
| 22 | for (int ch = -255; ch < 255; ++ch) { |
| 23 | if (ch == 0x20 || (0x09 <= ch && ch <= 0x0d)) |
| 24 | EXPECT_NE(LIBC_NAMESPACE::isspace(ch), 0); |
| 25 | else |
| 26 | EXPECT_EQ(LIBC_NAMESPACE::isspace(ch), 0); |
| 27 | } |
| 28 | } |
| 29 | |