6static_assert(std::is_signed_v<char>);
10 REQUIRE(
map.begin() ==
map.end());
11 REQUIRE((
map.size()) == 0);
13 REQUIRE_FALSE(
map.contains(
'a'));
15 REQUIRE(
map.contains(
'a'));
16 REQUIRE_FALSE(
map.contains(
'b'));
17 REQUIRE(
map.find(
'a') ==
map.begin());
18 REQUIRE_FALSE(
map.begin() ==
map.end());
19 REQUIRE(
map.at(
'a') ==
"42");
20 REQUIRE(
map.size() == 1);
24 auto n = std::next(
map.begin());
25 REQUIRE_FALSE(b == n);
27 CHECK(b->first ==
'a');
28 CHECK(b->second ==
"42");
30 REQUIRE(++
map.begin() ==
map.end());
31 REQUIRE(
map.begin() == --
map.end());
32 REQUIRE(
map.lower_bound(
'a') ==
map.find(
'a'));
33 REQUIRE(
map.upper_bound(
'a') ==
map.end());
34 for (
const auto& el :
map) {
35 REQUIRE(el.first ==
'a');
36 REQUIRE(el.second ==
"42");
39 const auto ZERO_V =
"4567854";
41 REQUIRE(
map.contains(
'\0'));
42 REQUIRE(
map.at(
'a') ==
"42");
43 REQUIRE(
map.at(
'\0') == ZERO_V);
44 REQUIRE(
map.size() == 2);
47 auto f =
map.find(
'\0');
49 auto n = std::next(
map.begin());
51 REQUIRE_FALSE(b == n);
52 REQUIRE(b->second == ZERO_V);
53 REQUIRE_FALSE(n ==
e);
55 REQUIRE_FALSE(++
map.begin() ==
map.end());
56 REQUIRE(std::next(
map.begin(), 2) ==
map.end());
57 REQUIRE(std::prev(
map.end(), 2) ==
map.begin());
58 REQUIRE(std::distance(
map.begin(),
map.end()) == 2);
59 REQUIRE(
map.upper_bound(
'\t') ==
map.find(
'a'));
62 REQUIRE(
map.contains(
'a'));
63 REQUIRE(
map.at(
'a') ==
"42");
64 REQUIRE(
map.contains(
map.min()));
65 REQUIRE(
map.at(
map.min()) ==
"2");
70 auto n = std::next(
map.begin());
72 REQUIRE(f->second ==
"2");
73 REQUIRE_FALSE(b == n);
74 REQUIRE_FALSE(b ==
e);
75 REQUIRE_FALSE(n ==
e);
77 REQUIRE(
map.size() == 3);
78 REQUIRE_FALSE(++
map.begin() ==
map.end());
81 REQUIRE_FALSE(b ==
map.end());
82 CHECK(b->first ==
decltype(
map)
::min());
84 REQUIRE_FALSE(b ==
map.end());
87 REQUIRE_FALSE(b ==
map.end());
88 CHECK(b->first ==
'a');
90 REQUIRE(b ==
map.end());
92 REQUIRE(std::distance(
map.begin(),
map.end()) == 3);
93 REQUIRE(std::next(
map.begin(), 3) ==
map.end());
94 REQUIRE(std::prev(
map.end(), 3) ==
map.begin());
98 auto map3 = std::move(
map);
99 REQUIRE(map2 == map3);
101 REQUIRE(
map == map3);
111 static_cast<void>(
map.contains(
'a'));
112 static_cast<void>(not
map.contains(
'b'));
113 static_cast<void>(
map.find(
'a') ==
map.begin());
114 static_cast<void>(
map.begin() !=
map.end());
115 static_cast<void>(
map.at(
'a') == 42);
116 static_cast<void>(
map.size() == 1);
118 auto b =
map.begin();
122 static_cast<void>(b != n);
123 static_cast<void>(b->second == 42);
124 static_cast<void>(n ==
e);
126 static_cast<void>(
map.begin() == --
map.end());
127 static_cast<void>(
map.lower_bound(
'a') ==
map.find(
'a'));
128 static_cast<void>(
map.upper_bound(
'a') ==
map.end());
129 for (
auto el :
map) {
130 static_cast<void>(el.first ==
'a');
131 static_cast<void>(el.second == 42);
134 const auto ZERO_V = 4567854;
136 static_cast<void>(
map.contains(
'\0'));
137 static_cast<void>(
map.at(
'a') == 42);
138 static_cast<void>(
map.at(
'\0') == ZERO_V);
139 static_cast<void>(
map.size() == 2);
141 auto b =
map.begin();
142 auto f =
map.find(
'\0');
144 auto n = std::next(
map.begin());
145 static_cast<void>(b == f);
146 static_cast<void>(b != n);
147 static_cast<void>(b->second == ZERO_V);
148 static_cast<void>(n !=
e);
150 static_cast<void>(++
map.begin() !=
map.end());
151 static_cast<void>(std::next(
map.begin(), 2) ==
map.end());
152 static_cast<void>(std::prev(
map.end(), 2) ==
map.begin());
153 static_cast<void>(std::distance(
map.begin(),
map.end()) == 2);
154 static_cast<void>(
map.upper_bound(
'\t') ==
map.find(
'a'));
157 static_cast<void>(
map.at(
'a') == 42);
160 auto b =
map.begin();
163 auto n = std::next(
map.begin());
164 static_cast<void>(f->second == 2);
165 static_cast<void>(b != n);
166 static_cast<void>(b !=
e);
167 static_cast<void>(n !=
e);
169 static_cast<void>(++
map.begin() !=
map.end());
170 static_cast<void>(std::next(
map.begin(), 3) ==
map.end());
171 static_cast<void>(std::prev(
map.end(), 3) ==
map.begin());
172 static_cast<void>(std::distance(
map.begin(),
map.end()) == 3);
175 static_cast<void>(
map == map2);
176 map3 = std::move(
map);
177 static_cast<void>(map2 == map3);
179 static_cast<void>(
map == map3);
186 REQUIRE(
map.begin() ==
map.end());
187 REQUIRE((
map.size()) == 0);
188 REQUIRE(
map.empty());
189 REQUIRE_FALSE(
map.contains(
'a'));
191 REQUIRE(
map.contains(
'a'));
192 REQUIRE_FALSE(
map.contains(
'b'));
193 REQUIRE(
map.find(
'a') ==
map.begin());
194 REQUIRE_FALSE(
map.begin() ==
map.end());
195 REQUIRE(
map.at(
'a') == 42);
196 REQUIRE(
map.size() == 1);
198 auto b =
map.begin();
200 auto n = std::next(
map.begin());
201 REQUIRE_FALSE(b == n);
203 CHECK(b->first ==
'a');
204 CHECK(b->second == 42);
206 REQUIRE(++
map.begin() ==
map.end());
207 REQUIRE(
map.begin() == --
map.end());
208 REQUIRE(
map.lower_bound(
'a') ==
map.find(
'a'));
209 REQUIRE(
map.upper_bound(
'a') ==
map.end());
210 for (
auto el :
map) {
211 REQUIRE(el.first ==
'a');
212 REQUIRE(el.second == 42);
215 const auto ZERO_V = 4567854;
217 REQUIRE(
map.contains(
'\0'));
218 REQUIRE(
map.at(
'a') == 42);
219 REQUIRE(
map.at(
'\0') == ZERO_V);
220 REQUIRE(
map.size() == 2);
222 auto b =
map.begin();
223 auto f =
map.find(
'\0');
225 auto n = std::next(
map.begin());
227 REQUIRE_FALSE(b == n);
228 REQUIRE(b->second == ZERO_V);
229 REQUIRE_FALSE(n ==
e);
231 REQUIRE_FALSE(++
map.begin() ==
map.end());
232 REQUIRE(std::next(
map.begin(), 2) ==
map.end());
233 REQUIRE(std::prev(
map.end(), 2) ==
map.begin());
234 REQUIRE(std::distance(
map.begin(),
map.end()) == 2);
235 REQUIRE(
map.upper_bound(
'\t') ==
map.find(
'a'));
238 REQUIRE(
map.contains(
'a'));
239 REQUIRE(
map.at(
'a') == 42);
240 REQUIRE(
map.contains(
map.min()));
241 REQUIRE(
map.at(
map.min()) == 2);
243 auto b =
map.begin();
246 auto n = std::next(
map.begin());
248 REQUIRE(f->second == 2);
249 REQUIRE_FALSE(b == n);
250 REQUIRE_FALSE(b ==
e);
251 REQUIRE_FALSE(n ==
e);
253 REQUIRE(
map.size() == 3);
254 REQUIRE_FALSE(++
map.begin() ==
map.end());
256 auto b =
map.begin();
257 REQUIRE_FALSE(b ==
map.end());
258 CHECK(b->first ==
decltype(
map)
::min());
260 REQUIRE_FALSE(b ==
map.end());
261 CHECK(b->first == 0);
263 REQUIRE_FALSE(b ==
map.end());
264 CHECK(b->first ==
'a');
266 REQUIRE(b ==
map.end());
268 REQUIRE(std::next(
map.begin(), 3) ==
map.end());
269 REQUIRE(std::prev(
map.end(), 3) ==
map.begin());
270 REQUIRE(std::distance(
map.begin(),
map.end()) == 3);
273 REQUIRE(
map == map2);
274 auto map3 = std::move(
map);
275 REQUIRE(map2 == map3);
277 REQUIRE(
map == map3);
283 std::allocator<std::pair<const char, std::string>>>
285 REQUIRE(
map.begin() ==
map.end());
286 REQUIRE((
map.size()) == 0);
287 REQUIRE(
map.empty());
288 REQUIRE_FALSE(
map.contains(
'a'));
290 REQUIRE(
map.contains(
'a'));
291 REQUIRE_FALSE(
map.contains(
'b'));
292 REQUIRE(
map.find(
'a') ==
map.begin());
293 REQUIRE_FALSE(
map.begin() ==
map.end());
294 REQUIRE(
map.at(
'a') ==
"42");
295 REQUIRE(
map.size() == 1);
297 auto b =
map.begin();
299 auto n = std::next(
map.begin());
300 REQUIRE_FALSE(b == n);
302 CHECK(b->first ==
'a');
303 CHECK(b->second ==
"42");
305 REQUIRE(++
map.begin() ==
map.end());
306 REQUIRE(
map.begin() == --
map.end());
307 REQUIRE(
map.lower_bound(
'a') ==
map.find(
'a'));
308 REQUIRE(
map.upper_bound(
'a') ==
map.end());
309 for (
const auto& el :
map) {
310 REQUIRE(el.first ==
'a');
311 REQUIRE(el.second ==
"42");
314 const auto ZERO_V =
"4567854";
316 REQUIRE(
map.contains(
'\0'));
317 REQUIRE(
map.at(
'a') ==
"42");
318 REQUIRE(
map.at(
'\0') == ZERO_V);
319 REQUIRE(
map.size() == 2);
321 auto b =
map.begin();
322 auto f =
map.find(
'\0');
324 auto n = std::next(
map.begin());
326 REQUIRE_FALSE(b == n);
327 REQUIRE(b->second == ZERO_V);
328 REQUIRE_FALSE(n ==
e);
330 REQUIRE_FALSE(++
map.begin() ==
map.end());
331 REQUIRE(std::next(
map.begin(), 2) ==
map.end());
332 REQUIRE(std::prev(
map.end(), 2) ==
map.begin());
333 REQUIRE(std::distance(
map.begin(),
map.end()) == 2);
334 REQUIRE(
map.upper_bound(
'\t') ==
map.find(
'a'));
337 REQUIRE(
map.contains(
'a'));
338 REQUIRE(
map.at(
'a') ==
"42");
339 REQUIRE(
map.contains(
map.min()));
340 REQUIRE(
map.at(
map.min()) ==
"2");
342 auto b =
map.begin();
345 auto n = std::next(
map.begin());
347 REQUIRE(f->second ==
"2");
348 REQUIRE_FALSE(b == n);
349 REQUIRE_FALSE(b ==
e);
350 REQUIRE_FALSE(n ==
e);
352 REQUIRE(
map.size() == 3);
353 REQUIRE_FALSE(++
map.begin() ==
map.end());
355 auto b =
map.begin();
356 REQUIRE_FALSE(b ==
map.end());
357 CHECK(b->first ==
decltype(
map)
::min());
359 REQUIRE_FALSE(b ==
map.end());
360 CHECK(b->first == 0);
362 REQUIRE_FALSE(b ==
map.end());
363 CHECK(b->first ==
'a');
365 REQUIRE(b ==
map.end());
367 REQUIRE(std::next(
map.begin(), 3) ==
map.end());
368 REQUIRE(std::prev(
map.end(), 3) ==
map.begin());
369 REQUIRE(std::distance(
map.begin(),
map.end()) == 3);
372 REQUIRE(
map == map2);
373 auto map3 = std::move(
map);
374 REQUIRE(map2 == map3);
376 REQUIRE(
map == map3);
382 std::allocator<std::pair<const char, std::string>>>
384 REQUIRE(
map.begin() ==
map.end());
385 REQUIRE((
map.size()) == 0);
386 REQUIRE(
map.empty());
387 REQUIRE_FALSE(
map.contains(
'a'));
389 REQUIRE(
map.contains(
'a'));
390 REQUIRE_FALSE(
map.contains(
'b'));
391 REQUIRE(
map.find(
'a') ==
map.begin());
392 REQUIRE_FALSE(
map.begin() ==
map.end());
393 REQUIRE(
map.at(
'a') == 42);
394 REQUIRE(
map.size() == 1);
396 auto b =
map.begin();
398 auto n = std::next(
map.begin());
399 REQUIRE_FALSE(b == n);
401 CHECK(b->first ==
'a');
402 CHECK(b->second == 42);
404 REQUIRE(++
map.begin() ==
map.end());
405 REQUIRE(
map.begin() == --
map.end());
406 REQUIRE(
map.lower_bound(
'a') ==
map.find(
'a'));
407 REQUIRE(
map.upper_bound(
'a') ==
map.end());
408 for (
auto el :
map) {
409 REQUIRE(el.first ==
'a');
410 REQUIRE(el.second == 42);
413 const auto ZERO_V = 4567854;
415 REQUIRE(
map.contains(
'\0'));
416 REQUIRE(
map.at(
'a') == 42);
417 REQUIRE(
map.at(
'\0') == ZERO_V);
418 REQUIRE(
map.size() == 2);
420 auto b =
map.begin();
421 auto f =
map.find(
'\0');
423 auto n = std::next(
map.begin());
425 REQUIRE_FALSE(b == n);
426 REQUIRE(b->second == ZERO_V);
427 REQUIRE_FALSE(n ==
e);
429 REQUIRE_FALSE(++
map.begin() ==
map.end());
430 REQUIRE(std::next(
map.begin(), 2) ==
map.end());
431 REQUIRE(std::prev(
map.end(), 2) ==
map.begin());
432 REQUIRE(std::distance(
map.begin(),
map.end()) == 2);
433 REQUIRE(
map.upper_bound(
'\t') ==
map.find(
'a'));
436 REQUIRE(
map.contains(
'a'));
437 REQUIRE(
map.at(
'a') == 42);
438 REQUIRE(
map.contains(
map.min()));
439 REQUIRE(
map.at(
map.min()) == 2);
441 auto b =
map.begin();
444 auto n = std::next(
map.begin());
446 REQUIRE(f->second == 2);
447 REQUIRE_FALSE(b == n);
448 REQUIRE_FALSE(b ==
e);
449 REQUIRE_FALSE(n ==
e);
451 REQUIRE(
map.size() == 3);
452 REQUIRE_FALSE(++
map.begin() ==
map.end());
454 auto b =
map.begin();
455 REQUIRE_FALSE(b ==
map.end());
456 CHECK(b->first ==
decltype(
map)
::min());
458 REQUIRE_FALSE(b ==
map.end());
459 CHECK(b->first == 0);
461 REQUIRE_FALSE(b ==
map.end());
462 CHECK(b->first ==
'a');
464 REQUIRE(b ==
map.end());
466 REQUIRE(std::next(
map.begin(), 3) ==
map.end());
467 REQUIRE(std::prev(
map.end(), 3) ==
map.begin());
468 REQUIRE(std::distance(
map.begin(),
map.end()) == 3);
471 REQUIRE(
map == map2);
472 auto map3 = std::move(
map);
473 REQUIRE(map2 == map3);
475 REQUIRE(
map == map3);
constexpr struct kblib::nums::min_t min
auto map(F f, T &&... t) noexcept(noexcept(std::tuple{ kblib::apply(f, std::forward< T >(t))...})) -> enable_if_t< not any_void< decltype(kblib::apply(f, std::forward< T >(t)))... >, decltype(std::tuple{kblib::apply(f, std::forward< T >(t))...})>
#define KBLIB_UNUSED
This internal macro is used to provide a fallback for [[maybe_unused]] in C++14.