Sequoia
Loading...
Searching...
No Matches
OrderableRegularTestDiagnosticsUtilities.hpp
Go to the documentation of this file.
1
2// Copyright Oliver J. Rosten 2020. //
3// Distributed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. //
4// (See accompanying file LICENSE.md or copy at //
5// https://www.gnu.org/licenses/gpl-3.0.en.html) //
7
8#pragma once
9
13
15
16#include <vector>
17
18namespace sequoia::testing
19{
20 template<class T=int, class Allocator=std::allocator<int>>
22 {
23 using allocator_type = Allocator;
24
25 orderable_regular_beast(std::initializer_list<T> list) : x{list} {}
26
27 orderable_regular_beast(std::initializer_list<T> list, const allocator_type& a) : x{list, a} {}
28
29 orderable_regular_beast(const allocator_type& a) : x(a) {}
30
32
33 orderable_regular_beast(const orderable_regular_beast& other, const allocator_type& a) : x(other.x, a) {}
34
36
37 orderable_regular_beast(orderable_regular_beast&& other, const allocator_type& a) : x(std::move(other.x), a) {}
38
39 orderable_regular_beast& operator=(const orderable_regular_beast&) = default;
40
42
43 void swap(orderable_regular_beast& other) noexcept(noexcept(std::ranges::swap(this->x, other.x)))
44 {
45 std::ranges::swap(x, other.x);
46 }
47
48 friend void swap(orderable_regular_beast& lhs, orderable_regular_beast& rhs)
49 noexcept(noexcept(lhs.swap(rhs)))
50 {
51 lhs.swap(rhs);
52 }
53
54 std::vector<T, Allocator> x{};
55
56 [[nodiscard]]
57 friend bool operator==(const orderable_regular_beast&, const orderable_regular_beast&) noexcept = default;
58
59 [[nodiscard]]
60 friend bool operator<(const orderable_regular_beast& lhs, const orderable_regular_beast& rhs) noexcept
61 {
62 return lhs.x < rhs.x;
63 }
64
65 [[nodiscard]]
66 friend bool operator<=(const orderable_regular_beast& lhs, const orderable_regular_beast& rhs) noexcept
67 {
68 return lhs.x <= rhs.x;
69 }
70
71 [[nodiscard]]
72 friend bool operator>(const orderable_regular_beast& lhs, const orderable_regular_beast& rhs) noexcept
73 {
74 return lhs.x > rhs.x;
75 }
76
77 [[nodiscard]]
78 friend bool operator>=(const orderable_regular_beast& lhs, const orderable_regular_beast& rhs) noexcept
79 {
80 return lhs.x >= rhs.x;
81 }
82
83 // TO DO: default this and remove most of the above when libc++ rolls out <=> to std
84 friend std::weak_ordering operator<=>(const orderable_regular_beast& lhs, const orderable_regular_beast& rhs) noexcept
85 {
86 if(lhs < rhs) return std::weak_ordering::less;
87
88 if(rhs > lhs) return std::weak_ordering::greater;
89
90 return std::weak_ordering::equivalent;
91 }
92
93 template<class Stream>
94 friend Stream& operator<<(Stream& s, const orderable_regular_beast& b)
95 {
96 for(auto i : b.x) s << i << ' ';
97 return s;
98 }
99 };
100
101 template<class T, class Allocator>
103 {
104 template<class Logger>
105 static void test(weak_equivalence_check_t, Logger& logger, const orderable_regular_beast<T, Allocator>& beast, std::initializer_list<T> prediction)
106 {
107 check(weak_equivalence, "", logger, std::begin(beast.x), std::end(beast.x), std::begin(prediction), std::end(prediction));
108 }
109 };
110
111 template<class T = int, class Allocator = std::allocator<int>>
113 {
114 using value_type = T;
115 using allocator_type = Allocator;
116
117 orderable_specified_moved_from_beast(std::initializer_list<T> list) : x{list} {}
118
119 orderable_specified_moved_from_beast(std::initializer_list<T> list, const allocator_type& a) : x(list, a) {}
120
121 orderable_specified_moved_from_beast(const allocator_type& a) : x(a) {}
122
124
125 orderable_specified_moved_from_beast(const orderable_specified_moved_from_beast& other, const allocator_type& a) : x(other.x, a) {}
126
128 : x{std::move(other.x)}
129 {
130 other.x.clear();
131 }
132
133 orderable_specified_moved_from_beast(orderable_specified_moved_from_beast&& other, const allocator_type& a) : x(std::move(other.x), a) {}
134
136
138 {
139 x = std::move(other.x);
140 other.x.clear();
141
142 return *this;
143 }
144
145 void swap(orderable_specified_moved_from_beast& other) noexcept(noexcept(std::ranges::swap(this->x, other.x)))
146 {
147 std::ranges::swap(x, other.x);
148 }
149
151 noexcept(noexcept(lhs.swap(rhs)))
152 {
153 lhs.swap(rhs);
154 }
155
156 std::vector<T, Allocator> x{};
157
158 [[nodiscard]]
159 friend auto operator<=>(const orderable_specified_moved_from_beast&, const orderable_specified_moved_from_beast&) noexcept = default;
160
161 template<class Stream>
162 friend Stream& operator<<(Stream& s, const orderable_specified_moved_from_beast& b)
163 {
164 for(const auto& i : b.x) s << i << '\n';
165 return s;
166 }
167 };
168
169 template<class T, class Allocator>
170 struct value_tester<orderable_specified_moved_from_beast<T, Allocator>> : beast_equivalence_tester<orderable_specified_moved_from_beast<T, Allocator>> {};
171
172 template<class T=int, class Allocator=std::allocator<int>>
174 {
175 using allocator_type = Allocator;
176
177 regular_broken_less(std::initializer_list<T> list) : x{list} {}
178
179 regular_broken_less(std::initializer_list<T> list, const allocator_type& a) : x{list, a} {}
180
181 regular_broken_less(const allocator_type& a) : x(a) {}
182
184
185 regular_broken_less(regular_broken_less&&) noexcept = default;
186
187 regular_broken_less(regular_broken_less&& other, const allocator_type& a) : x(std::move(other.x), a) {}
188
189 regular_broken_less& operator=(const regular_broken_less&) = default;
190
191 regular_broken_less& operator=(regular_broken_less&&) = default;
192
193 void swap(regular_broken_less& other) noexcept(noexcept(std::ranges::swap(this->x, other.x)))
194 {
195 std::ranges::swap(x, other.x);
196 }
197
198 friend void swap(regular_broken_less& lhs, regular_broken_less& rhs)
199 noexcept(noexcept(lhs.swap(rhs)))
200 {
201 lhs.swap(rhs);
202 }
203
204 std::vector<T, Allocator> x{};
205
206 [[nodiscard]]
207 friend bool operator==(const regular_broken_less&, const regular_broken_less&) noexcept = default;
208
209 [[nodiscard]]
210 friend bool operator<(const regular_broken_less& lhs, const regular_broken_less& rhs) noexcept
211 {
212 return lhs.x > rhs.x;
213 }
214
215 [[nodiscard]]
216 friend bool operator<=(const regular_broken_less& lhs, const regular_broken_less& rhs) noexcept
217 {
218 return lhs.x <= rhs.x;
219 }
220
221 [[nodiscard]]
222 friend bool operator>(const regular_broken_less& lhs, const regular_broken_less& rhs) noexcept
223 {
224 return lhs.x > rhs.x;
225 }
226
227 [[nodiscard]]
228 friend bool operator>=(const regular_broken_less& lhs, const regular_broken_less& rhs) noexcept
229 {
230 return lhs.x >= rhs.x;
231 }
232
233 // TO DO: default this and remove most of the above when libc++ rolls out <=> to std
234 friend std::weak_ordering operator<=>(const regular_broken_less& lhs, const regular_broken_less& rhs) noexcept
235 {
236 if(lhs < rhs) return std::weak_ordering::less;
237
238 if(rhs > lhs) return std::weak_ordering::greater;
239
240 return std::weak_ordering::equivalent;
241 }
242
243 template<class Stream>
244 friend Stream& operator<<(Stream& s, const regular_broken_less& b)
245 {
246 for(auto i : b.x) s << i << ' ';
247 return s;
248 }
249 };
250
251 template<class T=int, class Allocator=std::allocator<int>>
253 {
254 using allocator_type = Allocator;
255
256 regular_broken_lesseq(std::initializer_list<T> list) : x{list} {}
257
258 regular_broken_lesseq(std::initializer_list<T> list, const allocator_type& a) : x{list, a} {}
259
260 regular_broken_lesseq(const allocator_type& a) : x(a) {}
261
263
264 regular_broken_lesseq(regular_broken_lesseq&&) noexcept = default;
265
266 regular_broken_lesseq(regular_broken_lesseq&& other, const allocator_type& a) : x(std::move(other.x), a) {}
267
268 regular_broken_lesseq& operator=(const regular_broken_lesseq&) = default;
269
270 regular_broken_lesseq& operator=(regular_broken_lesseq&&) = default;
271
272 void swap(regular_broken_lesseq& other) noexcept(noexcept(std::ranges::swap(this->x, other.x)))
273 {
274 std::ranges::swap(x, other.x);
275 }
276
277 friend void swap(regular_broken_lesseq& lhs, regular_broken_lesseq& rhs)
278 noexcept(noexcept(lhs.swap(rhs)))
279 {
280 lhs.swap(rhs);
281 }
282
283 std::vector<T, Allocator> x{};
284
285 [[nodiscard]]
286 friend bool operator==(const regular_broken_lesseq&, const regular_broken_lesseq&) noexcept = default;
287
288 [[nodiscard]]
289 friend bool operator<(const regular_broken_lesseq& lhs, const regular_broken_lesseq& rhs) noexcept
290 {
291 return lhs.x < rhs.x;
292 }
293
294 [[nodiscard]]
295 friend bool operator<=(const regular_broken_lesseq& lhs, const regular_broken_lesseq& rhs) noexcept
296 {
297 return lhs.x >= rhs.x;
298 }
299
300 [[nodiscard]]
301 friend bool operator>(const regular_broken_lesseq& lhs, const regular_broken_lesseq& rhs) noexcept
302 {
303 return lhs.x > rhs.x;
304 }
305
306 [[nodiscard]]
307 friend bool operator>=(const regular_broken_lesseq& lhs, const regular_broken_lesseq& rhs) noexcept
308 {
309 return lhs.x >= rhs.x;
310 }
311
312 // TO DO: default this and remove most of the above when libc++ rolls out <=> to std
313 friend std::weak_ordering operator<=>(const regular_broken_lesseq& lhs, const regular_broken_lesseq& rhs) noexcept
314 {
315 if(lhs < rhs) return std::weak_ordering::less;
316
317 if(rhs > lhs) return std::weak_ordering::greater;
318
319 return std::weak_ordering::equivalent;
320 }
321
322 template<class Stream>
323 friend Stream& operator<<(Stream& s, const regular_broken_lesseq& b)
324 {
325 for(auto i : b.x) s << i << ' ';
326 return s;
327 }
328 };
329
330 template<class T=int, class Allocator=std::allocator<int>>
332 {
333 using allocator_type = Allocator;
334
335 regular_broken_greater(std::initializer_list<T> list) : x{list} {}
336
337 regular_broken_greater(std::initializer_list<T> list, const allocator_type& a) : x{list, a} {}
338
339 regular_broken_greater(const allocator_type& a) : x(a) {}
340
342
344
345 regular_broken_greater(regular_broken_greater&& other, const allocator_type& a) : x(std::move(other.x), a) {}
346
347 regular_broken_greater& operator=(const regular_broken_greater&) = default;
348
349 regular_broken_greater& operator=(regular_broken_greater&&) = default;
350
351 void swap(regular_broken_greater& other) noexcept(noexcept(std::ranges::swap(this->x, other.x)))
352 {
353 std::ranges::swap(x, other.x);
354 }
355
356 friend void swap(regular_broken_greater& lhs, regular_broken_greater& rhs)
357 noexcept(noexcept(lhs.swap(rhs)))
358 {
359 lhs.swap(rhs);
360 }
361
362 std::vector<T, Allocator> x{};
363
364 [[nodiscard]]
365 friend bool operator==(const regular_broken_greater&, const regular_broken_greater&) noexcept = default;
366
367 [[nodiscard]]
368 friend bool operator!=(const regular_broken_greater&, const regular_broken_greater&) noexcept = default;
369
370 [[nodiscard]]
371 friend bool operator<(const regular_broken_greater& lhs, const regular_broken_greater& rhs) noexcept
372 {
373 return lhs.x < rhs.x;
374 }
375
376 [[nodiscard]]
377 friend bool operator<=(const regular_broken_greater& lhs, const regular_broken_greater& rhs) noexcept
378 {
379 return lhs.x <= rhs.x;
380 }
381
382 [[nodiscard]]
383 friend bool operator>(const regular_broken_greater& lhs, const regular_broken_greater& rhs) noexcept
384 {
385 return lhs.x < rhs.x;
386 }
387
388 [[nodiscard]]
389 friend bool operator>=(const regular_broken_greater& lhs, const regular_broken_greater& rhs) noexcept
390 {
391 return lhs.x >= rhs.x;
392 }
393
394 // TO DO: default this and remove most of the above when libc++ rolls out <=> to std
395 friend std::weak_ordering operator<=>(const regular_broken_greater& lhs, const regular_broken_greater& rhs) noexcept
396 {
397 if(lhs < rhs) return std::weak_ordering::less;
398
399 if(rhs > lhs) return std::weak_ordering::greater;
400
401 return std::weak_ordering::equivalent;
402 }
403
404 template<class Stream>
405 friend Stream& operator<<(Stream& s, const regular_broken_greater& b)
406 {
407 for(auto i : b.x) s << i << ' ';
408 return s;
409 }
410 };
411
412 template<class T=int, class Allocator=std::allocator<int>>
414 {
415 using allocator_type = Allocator;
416
417 regular_broken_greatereq(std::initializer_list<T> list) : x{list} {}
418
419 regular_broken_greatereq(std::initializer_list<T> list, const allocator_type& a) : x{list, a} {}
420
421 regular_broken_greatereq(const allocator_type& a) : x(a) {}
422
424
426
427 regular_broken_greatereq(regular_broken_greatereq&& other, const allocator_type& a) : x(std::move(other.x), a) {}
428
429 regular_broken_greatereq& operator=(const regular_broken_greatereq&) = default;
430
432
433 void swap(regular_broken_greatereq& other) noexcept(noexcept(std::ranges::swap(this->x, other.x)))
434 {
435 std::ranges::swap(x, other.x);
436 }
437
438 friend void swap(regular_broken_greatereq& lhs, regular_broken_greatereq& rhs)
439 noexcept(noexcept(lhs.swap(rhs)))
440 {
441 lhs.swap(rhs);
442 }
443
444 std::vector<T, Allocator> x{};
445
446 [[nodiscard]]
447 friend bool operator==(const regular_broken_greatereq&, const regular_broken_greatereq&) noexcept = default;
448
449 [[nodiscard]]
450 friend bool operator!=(const regular_broken_greatereq&, const regular_broken_greatereq&) noexcept = default;
451
452 [[nodiscard]]
453 friend bool operator<(const regular_broken_greatereq& lhs, const regular_broken_greatereq& rhs) noexcept
454 {
455 return lhs.x < rhs.x;
456 }
457
458 [[nodiscard]]
459 friend bool operator<=(const regular_broken_greatereq& lhs, const regular_broken_greatereq& rhs) noexcept
460 {
461 return lhs.x >= rhs.x;
462 }
463
464 [[nodiscard]]
465 friend bool operator>(const regular_broken_greatereq& lhs, const regular_broken_greatereq& rhs) noexcept
466 {
467 return lhs.x > rhs.x;
468 }
469
470 [[nodiscard]]
471 friend bool operator>=(const regular_broken_greatereq& lhs, const regular_broken_greatereq& rhs) noexcept
472 {
473 return lhs.x >= rhs.x;
474 }
475
476 // TO DO: default this and remove most of the above when libc++ rolls out <=> to std
477 friend std::weak_ordering operator<=>(const regular_broken_greatereq& lhs, const regular_broken_greatereq& rhs) noexcept
478 {
479 if(lhs < rhs) return std::weak_ordering::less;
480
481 if(rhs > lhs) return std::weak_ordering::greater;
482
483 return std::weak_ordering::equivalent;
484 }
485
486 template<class Stream>
487 friend Stream& operator<<(Stream& s, const regular_broken_greatereq& b)
488 {
489 for(auto i : b.x) s << i << ' ';
490 return s;
491 }
492 };
493
494 template<class T=int, class Allocator=std::allocator<int>>
496 {
497 using allocator_type = Allocator;
498
499 regular_inverted_comparisons(std::initializer_list<T> list) : x{list} {}
500
501 regular_inverted_comparisons(std::initializer_list<T> list, const allocator_type& a) : x{list, a} {}
502
503 regular_inverted_comparisons(const allocator_type& a) : x(a) {}
504
506
508
509 regular_inverted_comparisons(regular_inverted_comparisons&& other, const allocator_type& a) : x(std::move(other.x), a) {}
510
512
514
515 void swap(regular_inverted_comparisons& other) noexcept(noexcept(std::ranges::swap(this->x, other.x)))
516 {
517 std::ranges::swap(x, other.x);
518 }
519
521 noexcept(noexcept(lhs.swap(rhs)))
522 {
523 lhs.swap(rhs);
524 }
525
526 std::vector<T, Allocator> x{};
527
528 [[nodiscard]]
529 friend bool operator==(const regular_inverted_comparisons&, const regular_inverted_comparisons&) noexcept = default;
530
531 [[nodiscard]]
532 friend bool operator!=(const regular_inverted_comparisons&, const regular_inverted_comparisons&) noexcept = default;
533
534 [[nodiscard]]
535 friend bool operator<(const regular_inverted_comparisons& lhs, const regular_inverted_comparisons& rhs) noexcept
536 {
537 return lhs.x > rhs.x;
538 }
539
540 [[nodiscard]]
541 friend bool operator<=(const regular_inverted_comparisons& lhs, const regular_inverted_comparisons& rhs) noexcept
542 {
543 return lhs.x >= rhs.x;
544 }
545
546 [[nodiscard]]
547 friend bool operator>(const regular_inverted_comparisons& lhs, const regular_inverted_comparisons& rhs) noexcept
548 {
549 return lhs.x < rhs.x;
550 }
551
552 [[nodiscard]]
553 friend bool operator>=(const regular_inverted_comparisons& lhs, const regular_inverted_comparisons& rhs) noexcept
554 {
555 return lhs.x <= rhs.x;
556 }
557
558 // TO DO: default this and remove most of the above when libc++ rolls out <=> to std
559 friend std::weak_ordering operator<=>(const regular_inverted_comparisons& lhs, const regular_inverted_comparisons& rhs) noexcept
560 {
561 if(lhs < rhs) return std::weak_ordering::less;
562
563 if(rhs > lhs) return std::weak_ordering::greater;
564
565 return std::weak_ordering::equivalent;
566 }
567
568 template<class Stream>
569 friend Stream& operator<<(Stream& s, const regular_inverted_comparisons& b)
570 {
571 for(auto i : b.x) s << i << ' ';
572 return s;
573 }
574 };
575
576 template<class T=int, class Allocator=std::allocator<int>>
578 {
579 using allocator_type = Allocator;
580
581 regular_broken_spaceship(std::initializer_list<T> list) : x{list} {}
582
583 regular_broken_spaceship(std::initializer_list<T> list, const allocator_type& a) : x{list, a} {}
584
585 regular_broken_spaceship(const allocator_type& a) : x(a) {}
586
588
590
591 regular_broken_spaceship(regular_broken_spaceship&& other, const allocator_type& a) : x(std::move(other.x), a) {}
592
593 regular_broken_spaceship& operator=(const regular_broken_spaceship&) = default;
594
596
597 void swap(regular_broken_spaceship& other) noexcept(noexcept(std::ranges::swap(this->x, other.x)))
598 {
599 std::ranges::swap(x, other.x);
600 }
601
602 friend void swap(regular_broken_spaceship& lhs, regular_broken_spaceship& rhs)
603 noexcept(noexcept(lhs.swap(rhs)))
604 {
605 lhs.swap(rhs);
606 }
607
608 std::vector<T, Allocator> x{};
609
610 [[nodiscard]]
611 friend bool operator==(const regular_broken_spaceship&, const regular_broken_spaceship&) noexcept = default;
612
613 [[nodiscard]]
614 friend bool operator!=(const regular_broken_spaceship&, const regular_broken_spaceship&) noexcept = default;
615
616 [[nodiscard]]
617 friend bool operator<(const regular_broken_spaceship& lhs, const regular_broken_spaceship& rhs) noexcept
618 {
619 return lhs.x < rhs.x;
620 }
621
622 [[nodiscard]]
623 friend bool operator<=(const regular_broken_spaceship& lhs, const regular_broken_spaceship& rhs) noexcept
624 {
625 return lhs.x <= rhs.x;
626 }
627
628 [[nodiscard]]
629 friend bool operator>(const regular_broken_spaceship& lhs, const regular_broken_spaceship& rhs) noexcept
630 {
631 return lhs.x > rhs.x;
632 }
633
634 [[nodiscard]]
635 friend bool operator>=(const regular_broken_spaceship& lhs, const regular_broken_spaceship& rhs) noexcept
636 {
637 return lhs.x >= rhs.x;
638 }
639
640 // TO DO: default this and remove most of the above when libc++ rolls out <=> to std
641 friend std::weak_ordering operator<=>(const regular_broken_spaceship& lhs, const regular_broken_spaceship& rhs) noexcept
642 {
643 if(lhs < rhs) return std::weak_ordering::greater;
644
645 if(rhs > lhs) return std::weak_ordering::less;
646
647 return std::weak_ordering::equivalent;
648 }
649
650 template<class Stream>
651 friend Stream& operator<<(Stream& s, const regular_broken_spaceship& b)
652 {
653 for(auto i : b.x) s << i << ' ';
654 return s;
655 }
656 };
657
658 template<class T=int, class Allocator=std::allocator<int>>
660 {
661 using allocator_type = Allocator;
662
663 orderable_regular_inefficient_comparisons(std::initializer_list<T> list) : x{list} {}
664
665 orderable_regular_inefficient_comparisons(std::initializer_list<T> list, const allocator_type& a) : x{list, a} {}
666
667 orderable_regular_inefficient_comparisons(const allocator_type& a) : x(a) {}
668
670
671 orderable_regular_inefficient_comparisons(const orderable_regular_inefficient_comparisons& other, const allocator_type& a) : x(other.x, a) {}
672
674
675 orderable_regular_inefficient_comparisons(orderable_regular_inefficient_comparisons&& other, const allocator_type& a) : x(std::move(other.x), a) {}
676
678
680
681 void swap(orderable_regular_inefficient_comparisons& other) noexcept(noexcept(std::ranges::swap(this->x, other.x)))
682 {
683 std::ranges::swap(x, other.x);
684 }
685
687 noexcept(noexcept(lhs.swap(rhs)))
688 {
689 lhs.swap(rhs);
690 }
691
692 std::vector<T, Allocator> x{};
693
694 [[nodiscard]]
695 friend bool operator==(const orderable_regular_inefficient_comparisons&, const orderable_regular_inefficient_comparisons&) noexcept = default;
696
697 [[nodiscard]]
698 friend bool operator!=(const orderable_regular_inefficient_comparisons& lhs, const orderable_regular_inefficient_comparisons& rhs) noexcept = default;
699
700 [[nodiscard]]
701 friend bool operator<(const orderable_regular_inefficient_comparisons lhs, const orderable_regular_inefficient_comparisons rhs) noexcept
702 {
703 return lhs.x < rhs.x;
704 }
705
706 [[nodiscard]]
707 friend bool operator<=(const orderable_regular_inefficient_comparisons lhs, const orderable_regular_inefficient_comparisons rhs) noexcept
708 {
709 return lhs.x <= rhs.x;
710 }
711
712 [[nodiscard]]
713 friend bool operator>(const orderable_regular_inefficient_comparisons lhs, const orderable_regular_inefficient_comparisons rhs) noexcept
714 {
715 return lhs.x > rhs.x;
716 }
717
718 [[nodiscard]]
719 friend bool operator>=(const orderable_regular_inefficient_comparisons lhs, const orderable_regular_inefficient_comparisons rhs) noexcept
720 {
721 return lhs.x >= rhs.x;
722 }
723
724 // TO DO: default this and remove most of the above when libc++ rolls out <=> to std
725 friend std::weak_ordering operator<=>(const orderable_regular_inefficient_comparisons lhs, const orderable_regular_inefficient_comparisons rhs) noexcept
726 {
727 if(lhs < rhs) return std::weak_ordering::less;
728
729 if(rhs > lhs) return std::weak_ordering::greater;
730
731 return std::weak_ordering::equivalent;
732 }
733
734 template<class Stream>
735 friend Stream& operator<<(Stream& s, const orderable_regular_inefficient_comparisons& b)
736 {
737 for(auto i : b.x) s << i << ' ';
738 return s;
739 }
740 };
741
742
743 template<class T, class Allocator>
745 {
746 using allocation_count_shifter<int>::shift;
747
748 static int shift(int count, const alloc_prediction<comparison_flavour::greater_than>&) noexcept
749 {
750 return shift_comparison(count);
751 }
752
753 static int shift(int count, const alloc_prediction<comparison_flavour::geq>) noexcept
754 {
755 return shift_comparison(count);
756 }
757
758 static int shift(int count, const alloc_prediction<comparison_flavour::less_than>&) noexcept
759 {
760 return shift_comparison(count);
761 }
762
763 static int shift(int count, const alloc_prediction<comparison_flavour::leq>&) noexcept
764 {
765 return shift_comparison(count);
766 }
767
768 static int shift(int count, const alloc_prediction<comparison_flavour::threeway>&) noexcept
769 {
770 return shift_comparison(count, 6);
771 }
772 private:
773 static int shift_comparison(int count, [[maybe_unused]] int shift = 2) noexcept
774 {
775 if constexpr (with_msvc_v && (iterator_debug_level() > 0))
776 {
777 return count + shift;
778 }
779 else
780 {
781 return count;
782 }
783 }
784 };
785}
Client-facing utilities for performing allocation checks.
bool check(CheckType flavour, std::string description, test_logger< Mode > &logger, Iter first, Sentinel last, PredictionIter predictionFirst, PredictionSentinel predictionLast, tutor< Advisor > advisor={})
The workhorse for comparing the contents of ranges.
Definition: FreeCheckers.hpp:377
Definition: AllocationCheckersCore.hpp:73
Definition: AllocationCheckers.hpp:200
Definition: SemanticsTestDiagnosticsUtilities.hpp:20
Definition: OrderableRegularTestDiagnosticsUtilities.hpp:22
Definition: OrderableRegularTestDiagnosticsUtilities.hpp:660
Definition: OrderableRegularTestDiagnosticsUtilities.hpp:113
Definition: OrderableRegularTestDiagnosticsUtilities.hpp:332
Definition: OrderableRegularTestDiagnosticsUtilities.hpp:414
Definition: OrderableRegularTestDiagnosticsUtilities.hpp:174
Definition: OrderableRegularTestDiagnosticsUtilities.hpp:253
Definition: OrderableRegularTestDiagnosticsUtilities.hpp:578
Definition: OrderableRegularTestDiagnosticsUtilities.hpp:496
class template, specializations of which implement various comparisons for the specified type.
Definition: FreeCheckers.hpp:78