[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / re / re.traits / lookup_collatename.pass.cpp
blobaeb7c50bb8177cbc8da00c0c0764243bad52c1d4
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 // NetBSD does not support LC_COLLATE at the moment
10 // XFAIL: netbsd
12 // REQUIRES: locale.cs_CZ.ISO8859-2
14 // <regex>
16 // template <class charT> struct regex_traits;
18 // template <class ForwardIterator>
19 // string_type
20 // lookup_collatename(ForwardIterator first, ForwardIterator last) const;
22 // TODO: investigation needed
23 // XFAIL: linux-gnu
25 #include <regex>
26 #include <iterator>
27 #include <cassert>
29 #include "test_macros.h"
30 #include "test_iterators.h"
31 #include "platform_support.h" // locale name macros
33 template <class char_type>
34 void
35 test(const char_type* A, const std::basic_string<char_type>& expected)
37 std::regex_traits<char_type> t;
38 typedef forward_iterator<const char_type*> F;
39 assert(t.lookup_collatename(F(A), F(A + t.length(A))) == expected);
42 int main(int, char**)
44 test("NUL", std::string("\x00", 1));
45 test("alert", std::string("\x07"));
46 test("backspace", std::string("\x08"));
47 test("tab", std::string("\x09"));
48 test("carriage-return", std::string("\x0D"));
49 test("newline", std::string("\x0A"));
50 test("vertical-tab", std::string("\x0B"));
51 test("form-feed", std::string("\x0C"));
52 test("space", std::string(" "));
53 test("exclamation-mark", std::string("!"));
54 test("quotation-mark", std::string("\""));
55 test("number-sign", std::string("#"));
56 test("dollar-sign", std::string("$"));
57 test("percent-sign", std::string("%"));
58 test("ampersand", std::string("&"));
59 test("apostrophe", std::string("\'"));
60 test("left-parenthesis", std::string("("));
61 test("right-parenthesis", std::string(")"));
62 test("asterisk", std::string("*"));
63 test("plus-sign", std::string("+"));
64 test("comma", std::string(","));
65 test("hyphen-minus", std::string("-"));
66 test("hyphen", std::string("-"));
67 test("full-stop", std::string("."));
68 test("period", std::string("."));
69 test("slash", std::string("/"));
70 test("solidus", std::string("/"));
71 test("zero", std::string("0"));
72 test("one", std::string("1"));
73 test("two", std::string("2"));
74 test("three", std::string("3"));
75 test("four", std::string("4"));
76 test("five", std::string("5"));
77 test("six", std::string("6"));
78 test("seven", std::string("7"));
79 test("eight", std::string("8"));
80 test("nine", std::string("9"));
81 test("colon", std::string(":"));
82 test("semicolon", std::string(";"));
83 test("less-than-sign", std::string("<"));
84 test("equals-sign", std::string("="));
85 test("greater-than-sign", std::string(">"));
86 test("question-mark", std::string("?"));
87 test("commercial-at", std::string("@"));
88 for (char c = 'A'; c <= 'Z'; ++c)
90 const char a[2] = {c};
91 test(a, std::string(a));
93 test("left-square-bracket", std::string("["));
94 test("backslash", std::string("\\"));
95 test("reverse-solidus", std::string("\\"));
96 test("right-square-bracket", std::string("]"));
97 test("circumflex-accent", std::string("^"));
98 test("circumflex", std::string("^"));
99 test("low-line", std::string("_"));
100 test("underscore", std::string("_"));
101 test("grave-accent", std::string("`"));
102 for (char c = 'a'; c <= 'z'; ++c)
104 const char a[2] = {c};
105 test(a, std::string(a));
107 test("left-brace", std::string("{"));
108 test("left-curly-bracket", std::string("{"));
109 test("vertical-line", std::string("|"));
110 test("right-brace", std::string("}"));
111 test("right-curly-bracket", std::string("}"));
112 test("tilde", std::string("~"));
114 test("tild", std::string(""));
115 test("ch", std::string(""));
116 std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2));
117 test("ch", std::string("ch"));
118 std::locale::global(std::locale("C"));
120 test(L"NUL", std::wstring(L"\x00", 1));
121 test(L"alert", std::wstring(L"\x07"));
122 test(L"backspace", std::wstring(L"\x08"));
123 test(L"tab", std::wstring(L"\x09"));
124 test(L"carriage-return", std::wstring(L"\x0D"));
125 test(L"newline", std::wstring(L"\x0A"));
126 test(L"vertical-tab", std::wstring(L"\x0B"));
127 test(L"form-feed", std::wstring(L"\x0C"));
128 test(L"space", std::wstring(L" "));
129 test(L"exclamation-mark", std::wstring(L"!"));
130 test(L"quotation-mark", std::wstring(L"\""));
131 test(L"number-sign", std::wstring(L"#"));
132 test(L"dollar-sign", std::wstring(L"$"));
133 test(L"percent-sign", std::wstring(L"%"));
134 test(L"ampersand", std::wstring(L"&"));
135 test(L"apostrophe", std::wstring(L"\'"));
136 test(L"left-parenthesis", std::wstring(L"("));
137 test(L"right-parenthesis", std::wstring(L")"));
138 test(L"asterisk", std::wstring(L"*"));
139 test(L"plus-sign", std::wstring(L"+"));
140 test(L"comma", std::wstring(L","));
141 test(L"hyphen-minus", std::wstring(L"-"));
142 test(L"hyphen", std::wstring(L"-"));
143 test(L"full-stop", std::wstring(L"."));
144 test(L"period", std::wstring(L"."));
145 test(L"slash", std::wstring(L"/"));
146 test(L"solidus", std::wstring(L"/"));
147 test(L"zero", std::wstring(L"0"));
148 test(L"one", std::wstring(L"1"));
149 test(L"two", std::wstring(L"2"));
150 test(L"three", std::wstring(L"3"));
151 test(L"four", std::wstring(L"4"));
152 test(L"five", std::wstring(L"5"));
153 test(L"six", std::wstring(L"6"));
154 test(L"seven", std::wstring(L"7"));
155 test(L"eight", std::wstring(L"8"));
156 test(L"nine", std::wstring(L"9"));
157 test(L"colon", std::wstring(L":"));
158 test(L"semicolon", std::wstring(L";"));
159 test(L"less-than-sign", std::wstring(L"<"));
160 test(L"equals-sign", std::wstring(L"="));
161 test(L"greater-than-sign", std::wstring(L">"));
162 test(L"question-mark", std::wstring(L"?"));
163 test(L"commercial-at", std::wstring(L"@"));
164 for (wchar_t c = L'A'; c <= L'Z'; ++c)
166 const wchar_t a[2] = {c};
167 test(a, std::wstring(a));
169 test(L"left-square-bracket", std::wstring(L"["));
170 test(L"backslash", std::wstring(L"\\"));
171 test(L"reverse-solidus", std::wstring(L"\\"));
172 test(L"right-square-bracket", std::wstring(L"]"));
173 test(L"circumflex-accent", std::wstring(L"^"));
174 test(L"circumflex", std::wstring(L"^"));
175 test(L"low-line", std::wstring(L"_"));
176 test(L"underscore", std::wstring(L"_"));
177 test(L"grave-accent", std::wstring(L"`"));
178 for (wchar_t c = L'a'; c <= L'z'; ++c)
180 const wchar_t a[2] = {c};
181 test(a, std::wstring(a));
183 test(L"left-brace", std::wstring(L"{"));
184 test(L"left-curly-bracket", std::wstring(L"{"));
185 test(L"vertical-line", std::wstring(L"|"));
186 test(L"right-brace", std::wstring(L"}"));
187 test(L"right-curly-bracket", std::wstring(L"}"));
188 test(L"tilde", std::wstring(L"~"));
190 test(L"tild", std::wstring(L""));
191 test(L"ch", std::wstring(L""));
192 std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2));
193 test(L"ch", std::wstring(L"ch"));
194 std::locale::global(std::locale("C"));
196 return 0;