|
17 | 17 | #include "test_comparisons.h" |
18 | 18 |
|
19 | 19 | // Implementation detail of `test_sequence_container_spaceship` |
20 | | -template <template <typename...> typename Container, typename Elem, typename Allocator, typename Order> |
| 20 | +template <template <typename...> typename Container, typename Elem, typename Allocator, typename Order> |
21 | 21 | constexpr void test_sequence_container_spaceship_with_type() { |
22 | 22 | // Empty containers |
23 | 23 | { |
@@ -71,12 +71,21 @@ constexpr bool test_sequence_container_spaceship() { |
71 | 71 |
|
72 | 72 | // Test different comparison categories |
73 | 73 | test_sequence_container_spaceship_with_type<Container, int, std::allocator<int>, std::strong_ordering>(); |
74 | | - test_sequence_container_spaceship_with_type<Container, StrongOrder, test_allocator<StrongOrder>, std::strong_ordering>(); |
| 74 | + test_sequence_container_spaceship_with_type<Container, |
| 75 | + StrongOrder, |
| 76 | + test_allocator<StrongOrder>, |
| 77 | + std::strong_ordering>(); |
75 | 78 | test_sequence_container_spaceship_with_type<Container, WeakOrder, std::allocator<WeakOrder>, std::weak_ordering>(); |
76 | | - test_sequence_container_spaceship_with_type<Container, PartialOrder, test_allocator<PartialOrder>, std::partial_ordering>(); |
| 79 | + test_sequence_container_spaceship_with_type<Container, |
| 80 | + PartialOrder, |
| 81 | + test_allocator<PartialOrder>, |
| 82 | + std::partial_ordering>(); |
77 | 83 |
|
78 | 84 | // `LessAndEqComp` does not have `operator<=>`. Ordering is synthesized based on `operator<` |
79 | | - test_sequence_container_spaceship_with_type<Container, LessAndEqComp, std::allocator<LessAndEqComp>, std::weak_ordering>(); |
| 85 | + test_sequence_container_spaceship_with_type<Container, |
| 86 | + LessAndEqComp, |
| 87 | + std::allocator<LessAndEqComp>, |
| 88 | + std::weak_ordering>(); |
80 | 89 |
|
81 | 90 | // Thanks to SFINAE, the following is not a compiler error but returns `false` |
82 | 91 | struct NonComparable {}; |
@@ -176,7 +185,12 @@ constexpr bool test_sequence_container_adaptor_spaceship() { |
176 | 185 | } |
177 | 186 |
|
178 | 187 | // Implementation detail of `test_ordered_map_container_spaceship` |
179 | | -template <template <typename...> typename Container, typename Key, typename Val, typename Allocator, typename Order, typename Compare> |
| 188 | +template <template <typename...> typename Container, |
| 189 | + typename Key, |
| 190 | + typename Val, |
| 191 | + typename Allocator, |
| 192 | + typename Order, |
| 193 | + typename Compare> |
180 | 194 | constexpr void test_ordered_map_container_spaceship_with_type(Compare comp) { |
181 | 195 | // Empty containers |
182 | 196 | { |
@@ -294,23 +308,63 @@ constexpr bool test_ordered_map_container_spaceship() { |
294 | 308 | static_assert(std::three_way_comparable<Container<int, int>>); |
295 | 309 |
|
296 | 310 | // Test different comparison categories |
297 | | - test_ordered_map_container_spaceship_with_type<Container, int, int, std::allocator<std::pair<const int, int>>, std::strong_ordering>(std::less{}); |
298 | | - test_ordered_map_container_spaceship_with_type<Container, int, int, test_allocator<std::pair<const int, int>>, std::strong_ordering>(std::greater{}); |
299 | | - test_ordered_map_container_spaceship_with_type<Container, int, StrongOrder, std::allocator<std::pair<const int, StrongOrder>>, std::strong_ordering>(std::less{}); |
300 | | - test_ordered_map_container_spaceship_with_type<Container, int, StrongOrder, test_allocator<std::pair<const int, StrongOrder>>, std::strong_ordering>(std::greater{}); |
301 | | - test_ordered_map_container_spaceship_with_type<Container, int, WeakOrder, std::allocator<std::pair<const int, WeakOrder>>, std::weak_ordering>(std::less{}); |
302 | | - test_ordered_map_container_spaceship_with_type<Container, int, WeakOrder, test_allocator<std::pair<const int, WeakOrder>>, std::weak_ordering>(std::greater{}); |
303 | | - test_ordered_map_container_spaceship_with_type<Container, int, PartialOrder, std::allocator<std::pair<const int, PartialOrder>>, std::partial_ordering>(std ::less{}); |
304 | | - test_ordered_map_container_spaceship_with_type<Container, int, PartialOrder, test_allocator<std::pair<const int, PartialOrder>>, std::partial_ordering>(std ::greater{}); |
| 311 | + test_ordered_map_container_spaceship_with_type<Container, |
| 312 | + int, |
| 313 | + int, |
| 314 | + std::allocator<std::pair<const int, int>>, |
| 315 | + std::strong_ordering>(std::less{}); |
| 316 | + test_ordered_map_container_spaceship_with_type<Container, |
| 317 | + int, |
| 318 | + int, |
| 319 | + test_allocator<std::pair<const int, int>>, |
| 320 | + std::strong_ordering>(std::greater{}); |
| 321 | + test_ordered_map_container_spaceship_with_type<Container, |
| 322 | + int, |
| 323 | + StrongOrder, |
| 324 | + std::allocator<std::pair<const int, StrongOrder>>, |
| 325 | + std::strong_ordering>(std::less{}); |
| 326 | + test_ordered_map_container_spaceship_with_type<Container, |
| 327 | + int, |
| 328 | + StrongOrder, |
| 329 | + test_allocator<std::pair<const int, StrongOrder>>, |
| 330 | + std::strong_ordering>(std::greater{}); |
| 331 | + test_ordered_map_container_spaceship_with_type<Container, |
| 332 | + int, |
| 333 | + WeakOrder, |
| 334 | + std::allocator<std::pair<const int, WeakOrder>>, |
| 335 | + std::weak_ordering>(std::less{}); |
| 336 | + test_ordered_map_container_spaceship_with_type<Container, |
| 337 | + int, |
| 338 | + WeakOrder, |
| 339 | + test_allocator<std::pair<const int, WeakOrder>>, |
| 340 | + std::weak_ordering>(std::greater{}); |
| 341 | + test_ordered_map_container_spaceship_with_type<Container, |
| 342 | + int, |
| 343 | + PartialOrder, |
| 344 | + std::allocator<std::pair<const int, PartialOrder>>, |
| 345 | + std::partial_ordering>(std ::less{}); |
| 346 | + test_ordered_map_container_spaceship_with_type<Container, |
| 347 | + int, |
| 348 | + PartialOrder, |
| 349 | + test_allocator<std::pair<const int, PartialOrder>>, |
| 350 | + std::partial_ordering>(std ::greater{}); |
305 | 351 |
|
306 | 352 | // `LessAndEqComp` does not have `operator<=>`. Ordering is synthesized based on `operator<` |
307 | | - test_ordered_map_container_spaceship_with_type<Container, int, LessAndEqComp, std::allocator<std::pair<const int, LessAndEqComp>>, std::weak_ordering>(std::less{}); |
| 353 | + test_ordered_map_container_spaceship_with_type<Container, |
| 354 | + int, |
| 355 | + LessAndEqComp, |
| 356 | + std::allocator<std::pair<const int, LessAndEqComp>>, |
| 357 | + std::weak_ordering>(std::less{}); |
308 | 358 |
|
309 | 359 | return true; |
310 | 360 | } |
311 | 361 |
|
312 | 362 | // Implementation detail of `test_ordered_set_container_spaceship` |
313 | | -template <template <typename...> typename Container, typename Elem, typename Allocator, typename Order, typename Compare> |
| 363 | +template <template <typename...> typename Container, |
| 364 | + typename Elem, |
| 365 | + typename Allocator, |
| 366 | + typename Order, |
| 367 | + typename Compare> |
314 | 368 | constexpr void test_ordered_set_spaceship_with_type(Compare comp) { |
315 | 369 | // Empty containers |
316 | 370 | { |
@@ -399,15 +453,22 @@ constexpr bool test_ordered_set_container_spaceship() { |
399 | 453 | // Test different comparison categories |
400 | 454 | test_ordered_set_spaceship_with_type<Container, int, std::allocator<int>, std::strong_ordering>(std::less{}); |
401 | 455 | test_ordered_set_spaceship_with_type<Container, int, test_allocator<int>, std::strong_ordering>(std::greater{}); |
402 | | - test_ordered_set_spaceship_with_type<Container, StrongOrder, std::allocator<StrongOrder>, std::strong_ordering>(std::less{}); |
403 | | - test_ordered_set_spaceship_with_type<Container, StrongOrder, test_allocator<StrongOrder>, std::strong_ordering>(std::greater{}); |
404 | | - test_ordered_set_spaceship_with_type<Container, WeakOrder, std::allocator<WeakOrder>, std::weak_ordering>(std::less{}); |
405 | | - test_ordered_set_spaceship_with_type<Container, WeakOrder, test_allocator<WeakOrder>, std::weak_ordering>(std::greater{}); |
406 | | - test_ordered_set_spaceship_with_type<Container, PartialOrder, std::allocator<PartialOrder>, std::partial_ordering>(std::less{}); |
407 | | - test_ordered_set_spaceship_with_type<Container, PartialOrder, test_allocator<PartialOrder>, std::partial_ordering>(std::greater{}); |
| 456 | + test_ordered_set_spaceship_with_type<Container, StrongOrder, std::allocator<StrongOrder>, std::strong_ordering>( |
| 457 | + std::less{}); |
| 458 | + test_ordered_set_spaceship_with_type<Container, StrongOrder, test_allocator<StrongOrder>, std::strong_ordering>( |
| 459 | + std::greater{}); |
| 460 | + test_ordered_set_spaceship_with_type<Container, WeakOrder, std::allocator<WeakOrder>, std::weak_ordering>( |
| 461 | + std::less{}); |
| 462 | + test_ordered_set_spaceship_with_type<Container, WeakOrder, test_allocator<WeakOrder>, std::weak_ordering>( |
| 463 | + std::greater{}); |
| 464 | + test_ordered_set_spaceship_with_type<Container, PartialOrder, std::allocator<PartialOrder>, std::partial_ordering>( |
| 465 | + std::less{}); |
| 466 | + test_ordered_set_spaceship_with_type<Container, PartialOrder, test_allocator<PartialOrder>, std::partial_ordering>( |
| 467 | + std::greater{}); |
408 | 468 |
|
409 | 469 | // `LessAndEqComp` does not have `operator<=>`. Ordering is synthesized based on `operator<` |
410 | | - test_ordered_set_spaceship_with_type<Container, LessAndEqComp, std::allocator<LessAndEqComp>, std::weak_ordering>(std::less{}); |
| 470 | + test_ordered_set_spaceship_with_type<Container, LessAndEqComp, std::allocator<LessAndEqComp>, std::weak_ordering>( |
| 471 | + std::less{}); |
411 | 472 |
|
412 | 473 | return true; |
413 | 474 | } |
|
0 commit comments