1 | //===----------------------------------------------------------------------===// |
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 | // <cctype> |
10 | |
11 | #include <cctype> |
12 | #include <type_traits> |
13 | #include <cassert> |
14 | |
15 | #include "test_macros.h" |
16 | |
17 | #ifdef isalnum |
18 | # error isalnum defined |
19 | #endif |
20 | |
21 | #ifdef isalpha |
22 | # error isalpha defined |
23 | #endif |
24 | |
25 | #ifdef isblank |
26 | # error isblank defined |
27 | #endif |
28 | |
29 | #ifdef iscntrl |
30 | # error iscntrl defined |
31 | #endif |
32 | |
33 | #ifdef isdigit |
34 | # error isdigit defined |
35 | #endif |
36 | |
37 | #ifdef isgraph |
38 | # error isgraph defined |
39 | #endif |
40 | |
41 | #ifdef islower |
42 | # error islower defined |
43 | #endif |
44 | |
45 | #ifdef isprint |
46 | # error isprint defined |
47 | #endif |
48 | |
49 | #ifdef ispunct |
50 | # error ispunct defined |
51 | #endif |
52 | |
53 | #ifdef isspace |
54 | # error isspace defined |
55 | #endif |
56 | |
57 | #ifdef isupper |
58 | # error isupper defined |
59 | #endif |
60 | |
61 | #ifdef isxdigit |
62 | # error isxdigit defined |
63 | #endif |
64 | |
65 | #ifdef tolower |
66 | # error tolower defined |
67 | #endif |
68 | |
69 | #ifdef toupper |
70 | # error toupper defined |
71 | #endif |
72 | |
73 | int main(int, char**) { |
74 | ASSERT_SAME_TYPE(int, decltype(std::isalnum(0))); |
75 | ASSERT_SAME_TYPE(int, decltype(std::isalpha(0))); |
76 | ASSERT_SAME_TYPE(int, decltype(std::isblank(0))); |
77 | ASSERT_SAME_TYPE(int, decltype(std::iscntrl(0))); |
78 | ASSERT_SAME_TYPE(int, decltype(std::isdigit(0))); |
79 | ASSERT_SAME_TYPE(int, decltype(std::isgraph(0))); |
80 | ASSERT_SAME_TYPE(int, decltype(std::islower(0))); |
81 | ASSERT_SAME_TYPE(int, decltype(std::isprint(0))); |
82 | ASSERT_SAME_TYPE(int, decltype(std::ispunct(0))); |
83 | ASSERT_SAME_TYPE(int, decltype(std::isspace(0))); |
84 | ASSERT_SAME_TYPE(int, decltype(std::isupper(0))); |
85 | ASSERT_SAME_TYPE(int, decltype(std::isxdigit(0))); |
86 | ASSERT_SAME_TYPE(int, decltype(std::tolower(0))); |
87 | ASSERT_SAME_TYPE(int, decltype(std::toupper(0))); |
88 | |
89 | assert(std::isalnum('a')); |
90 | assert(std::isalpha('a')); |
91 | assert(std::isblank(' ')); |
92 | assert(!std::iscntrl(' ')); |
93 | assert(!std::isdigit('a')); |
94 | assert(std::isgraph('a')); |
95 | assert(std::islower('a')); |
96 | assert(std::isprint('a')); |
97 | assert(!std::ispunct('a')); |
98 | assert(!std::isspace('a')); |
99 | assert(!std::isupper('a')); |
100 | assert(std::isxdigit('a')); |
101 | assert(std::tolower('A') == 'a'); |
102 | assert(std::toupper('a') == 'A'); |
103 | |
104 | return 0; |
105 | } |
106 | |