| 1 | //===-- Unittests for isprint----------------------------------------------===// |
| 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/isprint.h" |
| 10 | #include "test/UnitTest/Test.h" |
| 11 | |
| 12 | TEST(LlvmLibcIsPrint, DefaultLocale) { |
| 13 | for (int ch = -255; ch < 255; ++ch) { |
| 14 | if (' ' <= ch && ch <= '~') { // A-Z, a-z, 0-9, punctuation, space. |
| 15 | EXPECT_NE(LIBC_NAMESPACE::isprint(ch), 0); |
| 16 | } else { |
| 17 | EXPECT_EQ(LIBC_NAMESPACE::isprint(ch), 0); |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | |