19namespace sequoia::testing
21 template<
class T=
int,
class Allocator=std::allocator<
int>>
25 using allocator_type = Allocator;
47 std::ranges::swap(x, other.x);
51 noexcept(
noexcept(lhs.swap(rhs)))
56 using container_type = std::vector<T, Allocator>;
63 template<
class Stream>
67 for(
const auto& i : b.x) s << i <<
'\n';
72 template<
class Stream>
73 requires std::is_arithmetic_v<T>
88 template<
class T,
class Allocator>
91 template<test_mode Mode>
94 check(equality,
"", logger, obtained.x, prediction.x);
97 template<
class Logger>
100 check(weak_equivalence,
"", logger, std::begin(beast.x), std::end(beast.x), std::begin(prediction), std::end(prediction));
103 template<
class Logger,
class Advisor>
106 check(weak_equivalence,
"", logger, std::begin(beast.x), std::end(beast.x), std::begin(prediction), std::end(prediction), std::move(advisor));
110 template<
class CharT =
char,
class Allocator=std::allocator<CharT>>
113 using allocator_type = Allocator;
114 using string_type = std::basic_string<CharT, std::char_traits<CharT>, Allocator>;
138 std::ranges::swap(x, other.x);
142 noexcept(
noexcept(lhs.swap(rhs)))
152 template<
class Stream>
159 template<
class Stream>
167 b.x.append(word).append(
" ");
170 if(!b.x.empty()) b.x.pop_back();
176 template<
class T =
int,
class Allocator = std::allocator<
int>>
179 using value_type = T;
180 using allocator_type = Allocator;
193 : x{std::move(other.x)}
204 x = std::move(other.x);
212 std::ranges::swap(x, other.x);
216 noexcept(
noexcept(lhs.swap(rhs)))
221 std::vector<T, Allocator> x{};
226 template<
class Stream>
229 for(
const auto& i : b.x) s << i <<
'\n';
234 template<
class T,
class Allocator>
237 template<
class T=
int,
class Handle=std::shared_ptr<T>,
class Allocator=std::allocator<Handle>>
240 using product_type = Handle;
241 using allocator_type = Allocator;
242 using container_type = std::vector<product_type, allocator_type>;
251 return beast.x.get_allocator();
261 x.reserve(list.size());
263 x.emplace_back(std::make_shared<T>(e));
266 perfectly_sharing_beast(
const perfectly_sharing_beast& other)
267 : perfectly_sharing_beast(other, other.x.get_allocator())
270 perfectly_sharing_beast(
const perfectly_sharing_beast& other,
const allocator_type& a)
273 x.reserve(other.x.size());
274 for(
auto e : other.x)
276 x.emplace_back(std::make_shared<T>(*e));
280 perfectly_sharing_beast(perfectly_sharing_beast&&) noexcept = default;
282 perfectly_sharing_beast(perfectly_sharing_beast&& other, const allocator_type& a)
283 : x(std::move(other.x), a) {}
285 perfectly_sharing_beast& operator=(
const perfectly_sharing_beast& other)
292 perfectly_sharing_beast& operator=(perfectly_sharing_beast&&) =
default;
294 void swap(perfectly_sharing_beast& other)
noexcept(
noexcept(std::ranges::swap(this->x, other.x)))
296 std::ranges::swap(x, other.x);
299 friend void swap(perfectly_sharing_beast& lhs, perfectly_sharing_beast& rhs)
300 noexcept(
noexcept(lhs.swap(rhs)))
308 friend bool operator==(
const perfectly_sharing_beast& lhs,
const perfectly_sharing_beast& rhs)
noexcept
310 return std::equal(lhs.x.cbegin(), lhs.x.cend(), rhs.x.cbegin(), rhs.x.cend(), [](
auto& l,
auto& r){
316 friend bool operator!=(
const perfectly_sharing_beast& lhs,
const perfectly_sharing_beast& rhs)
noexcept
318 return !(lhs == rhs);
321 template<
class Stream>
322 friend Stream& operator<<(Stream& s,
const perfectly_sharing_beast& b)
324 for(
auto i : b.x) s << *i <<
' ';
328 void reset(
const allocator_type& a)
330 const std::vector<product_type, allocator_type> v(a);
335 template<
class T=
int,
class U=
double,
class xAllocator=std::allocator<T>,
class yAllocator=std::allocator<U>>
338 using x_allocator_type = xAllocator;
339 using y_allocator_type = yAllocator;
342 : x{xlist} , y{ylist}
345 doubly_normal_beast(std::initializer_list<T> xlist, std::initializer_list<U> ylist,
const x_allocator_type& a,
const y_allocator_type& b)
346 : x(xlist, a), y(ylist,b)
352 : x(other.x, a), y(other.y, b)
358 : x(std::move(other.x), a), y(std::move(other.y), b)
365 void swap(
doubly_normal_beast& other)
noexcept(
noexcept(std::ranges::swap(this->x, other.x)) &&
noexcept(std::ranges::swap(this->y, other.y)))
367 std::ranges::swap(x, other.x);
368 std::ranges::swap(y, other.y);
372 noexcept(
noexcept(lhs.swap(rhs)))
377 std::vector<T, xAllocator> x{};
378 std::vector<U, yAllocator> y{};
383 return (lhs.x == rhs.x) && (rhs.x == lhs.x);
389 return !(lhs == rhs);
392 template<
class Stream>
395 for(
auto i : b.x) s << i <<
' ';
396 for(
auto i : b.y) s << i <<
' ';
401 template<
class T=
int,
class Allocator=std::allocator<
int>>
404 using allocator_type = Allocator;
408 broken_equality(std::initializer_list<T> list,
const allocator_type& a) : x(list, a) {}
424 std::ranges::swap(lhs.x, rhs.x);
427 std::vector<T, Allocator> x{};
432 return lhs.x != rhs.x;
438 return lhs.x != rhs.x;
441 template<
class Stream>
444 for(
auto i : b.x) s << i <<
' ';
449 template<
class T=
int,
class Allocator=std::allocator<
int>>
452 using allocator_type = Allocator;
456 broken_inequality(std::initializer_list<T> list,
const allocator_type& a) : x(list, a) {}
472 std::ranges::swap(lhs.x, rhs.x);
475 std::vector<T, Allocator> x{};
483 return lhs.x == rhs.x;
486 template<
class Stream>
489 for(
auto i : b.x) s << i <<
' ';
494 template<
class T=
int,
class Allocator=std::allocator<
int>>
497 using allocator_type = Allocator;
499 broken_copy(std::initializer_list<T> list) : x{list} {}
501 broken_copy(std::initializer_list<T> list,
const allocator_type& a) : x{list, a} {}
521 std::ranges::swap(lhs.x, rhs.x);
524 std::vector<T, Allocator> x{};
529 return lhs.x == rhs.x;
535 return !(lhs == rhs);
538 template<
class Stream>
539 friend Stream& operator<<(Stream& s,
const broken_copy& b)
541 for(
auto i : b.x) s << i <<
' ';
546 template<
class T=
int,
class Allocator=std::allocator<
int>>
549 using allocator_type = Allocator;
553 broken_para_copy(std::initializer_list<T> list,
const allocator_type& a) : x(list, a) {}
572 std::ranges::swap(lhs.x, rhs.x);
575 std::vector<T, Allocator> x{};
580 return lhs.x == rhs.x;
586 return !(lhs == rhs);
589 template<
class Stream>
592 for(
auto i : b.x) s << i <<
' ';
597 template<
class T=
int,
class Allocator=std::allocator<
int>>
600 using allocator_type = Allocator;
602 broken_move(std::initializer_list<T> list) : x{list} {}
604 broken_move(std::initializer_list<T> list,
const allocator_type& a) : x(list, a) {}
624 std::ranges::swap(lhs.x, rhs.x);
627 std::vector<T, Allocator> x{};
632 return lhs.x == rhs.x;
638 return !(lhs == rhs);
641 template<
class Stream>
642 friend Stream& operator<<(Stream& s,
const broken_move& b)
644 for(
auto i : b.x) s << i <<
' ';
649 template<
class T=
int,
class Allocator=std::allocator<
int>>
652 using allocator_type = Allocator;
656 broken_para_move(std::initializer_list<T> list,
const allocator_type& a) : x(list, a) {}
675 std::ranges::swap(lhs.x, rhs.x);
678 std::vector<T, Allocator> x{};
683 return lhs.x == rhs.x;
689 return !(lhs == rhs);
692 template<
class Stream>
695 for(
auto i : b.x) s << i <<
' ';
700 template<
class T=
int,
class Allocator=std::allocator<
int>>
703 using allocator_type = Allocator;
726 std::ranges::swap(lhs.x, rhs.x);
729 std::vector<T, Allocator> x{};
734 return lhs.x == rhs.x;
740 return !(lhs == rhs);
743 template<
class Stream>
746 for(
auto i : b.x) s << i <<
' ';
751 template<
class T=
int,
class Allocator=std::allocator<
int>>
754 using allocator_type = Allocator;
786 std::ranges::swap(lhs.x, rhs.x);
789 std::vector<T, Allocator> x{};
794 template<
class Stream>
797 for(
auto i : b.x) s << i <<
' ';
802 template<
class T=
int,
class Allocator=std::allocator<
int>>
805 using allocator_type = Allocator;
828 std::ranges::swap(lhs.x, rhs.x);
831 std::vector<T, Allocator> x{};
836 return lhs.x == rhs.x;
842 return !(lhs == rhs);
845 template<
class Stream>
848 for(
auto i : b.x) s << i <<
' ';
853 template<
class T=
int,
class Allocator=std::allocator<
int>>
856 using allocator_type = Allocator;
858 broken_swap(std::initializer_list<T> list) : x{list} {}
860 broken_swap(std::initializer_list<T> list,
const allocator_type& a) : x{list, a} {}
879 std::vector<T, Allocator> x{};
884 template<
class Stream>
885 friend Stream& operator<<(Stream& s,
const broken_swap& b)
887 for(
auto i : b.x) s << i <<
' ';
892 template<
class T=
int,
class Allocator=std::allocator<
int>>
895 using allocator_type = Allocator;
899 broken_self_swap(std::initializer_list<T> list,
const allocator_type& a) : x{list, a} {}
913 void swap(
broken_self_swap& other)
noexcept(
noexcept(std::ranges::swap(this->x, other.x)))
921 std::ranges::swap(this->x, other.x);
926 noexcept(
noexcept(lhs.swap(rhs)))
931 std::vector<T, Allocator> x{};
936 template<
class Stream>
939 for(
auto i : b.x) s << i <<
' ';
944 template<
class T=
int,
class Handle=std::shared_ptr<T>,
class Allocator=std::allocator<Handle>>
947 using product_type = Handle;
948 using allocator_type = Allocator;
957 return beast.x.get_allocator();
964 x.reserve(list.size());
966 x.emplace_back(std::make_shared<T>(e));
969 broken_copy_value_semantics(
const broken_copy_value_semantics&) =
default;
971 broken_copy_value_semantics(
const broken_copy_value_semantics& other,
const allocator_type& a)
974 x.reserve(other.x.size());
975 for(
auto e : other.x)
977 x.emplace_back(std::make_shared<T>(*e));
981 broken_copy_value_semantics(broken_copy_value_semantics&&) noexcept = default;
983 broken_copy_value_semantics(broken_copy_value_semantics&& other, const allocator_type& a)
984 : x(std::move(other.x), a) {}
986 broken_copy_value_semantics& operator=(
const broken_copy_value_semantics& other)
989 [](
const broken_copy_value_semantics& psb) {
990 return psb.x.get_allocator();
999 broken_copy_value_semantics& operator=(broken_copy_value_semantics&&) =
default;
1001 void swap(broken_copy_value_semantics& other)
noexcept(
noexcept(std::ranges::swap(this->x, other.x)))
1003 std::ranges::swap(x, other.x);
1006 friend void swap(broken_copy_value_semantics& lhs, broken_copy_value_semantics& rhs)
1007 noexcept(
noexcept(lhs.swap(rhs)))
1012 void reset(
const allocator_type& a)
1014 const std::vector<product_type, allocator_type> v(a);
1018 std::vector<product_type, allocator_type> x{};
1021 friend bool operator==(
const broken_copy_value_semantics& lhs,
const broken_copy_value_semantics& rhs)
noexcept
1023 return std::equal(lhs.x.cbegin(), lhs.x.cend(), rhs.x.cbegin(), rhs.x.cend(), [](
auto& l,
auto& r) {
1029 friend bool operator!=(
const broken_copy_value_semantics& lhs,
const broken_copy_value_semantics& rhs)
noexcept
1031 return !(lhs == rhs);
1034 template<
class Stream>
1035 friend Stream& operator<<(Stream& s,
const broken_copy_value_semantics& b)
1037 for(
auto i : b.x) s << *i <<
' ';
1042 template<
class T=
int,
class Handle=std::shared_ptr<T>,
class Allocator=std::allocator<Handle>>
1045 using product_type = Handle;
1046 using allocator_type = Allocator;
1051 x.reserve(list.size());
1053 x.emplace_back(std::make_shared<T>(e));
1063 x.reserve(other.x.size());
1064 for(
auto e : other.x)
1066 x.emplace_back(std::make_shared<T>(*e));
1073 : x(std::move(other.x), a) {}
1081 std::ranges::swap(lhs.x, rhs.x);
1084 std::vector<product_type, allocator_type> x{};
1089 return std::equal(lhs.x.cbegin(), lhs.x.cend(), rhs.x.cbegin(), rhs.x.cend(), [](
auto& l,
auto& r){
1097 return !(lhs == rhs);
1100 template<
class Stream>
1103 for(
auto i : b.x) s << *i <<
' ';
1108 template<
class T=
int,
class Allocator=std::allocator<
int>>
1111 using allocator_type = Allocator;
1133 std::ranges::swap(x, other.x);
1137 noexcept(
noexcept(lhs.swap(rhs)))
1142 std::vector<T, Allocator> x{};
1147 template<
class Stream>
1153 template<
class Stream>
1168 template<
class T=
int,
class Allocator=std::allocator<
int>>
1171 using allocator_type = Allocator;
1193 std::ranges::swap(x, other.x);
1197 noexcept(
noexcept(lhs.swap(rhs)))
1202 std::vector<T, Allocator> x{};
1210 template<
class Stream>
1213 for(
auto i : b.x) s << i <<
' ';
1217 template<
class Stream>
Client-facing utilities for performing allocation checks.
Helper for dealing with allocator propagation during copy assignment.
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: TestLogger.hpp:183
class template used to wrap function objects which proffer advice.
Definition: Advice.hpp:127
Definition: CoreInfrastructure.hpp:54
static constexpr void assign(T &to, const T &from, AllocGetters... allocGetters)
Definition: AssignmentUtilities.hpp:70
Definition: AllocationCheckers.hpp:178
Definition: SemanticsTestDiagnosticsUtilities.hpp:20
Definition: RegularTestDiagnosticsUtilities.hpp:1044
Definition: RegularTestDiagnosticsUtilities.hpp:702
Definition: RegularTestDiagnosticsUtilities.hpp:951
Definition: RegularTestDiagnosticsUtilities.hpp:946
Definition: RegularTestDiagnosticsUtilities.hpp:496
Definition: RegularTestDiagnosticsUtilities.hpp:1170
Definition: RegularTestDiagnosticsUtilities.hpp:403
Definition: RegularTestDiagnosticsUtilities.hpp:451
Definition: RegularTestDiagnosticsUtilities.hpp:804
Definition: RegularTestDiagnosticsUtilities.hpp:599
Definition: RegularTestDiagnosticsUtilities.hpp:548
Definition: RegularTestDiagnosticsUtilities.hpp:651
Definition: RegularTestDiagnosticsUtilities.hpp:753
Definition: RegularTestDiagnosticsUtilities.hpp:894
Definition: RegularTestDiagnosticsUtilities.hpp:1110
Definition: RegularTestDiagnosticsUtilities.hpp:855
Definition: RegularTestDiagnosticsUtilities.hpp:337
Definition: FreeCheckers.hpp:82
Definition: FreeCheckers.hpp:107
Definition: RegularTestDiagnosticsUtilities.hpp:23
Definition: RegularTestDiagnosticsUtilities.hpp:245
Definition: RegularTestDiagnosticsUtilities.hpp:239
Definition: RegularTestDiagnosticsUtilities.hpp:112
Definition: RegularTestDiagnosticsUtilities.hpp:178
class template, specializations of which implement various comparisons for the specified type.
Definition: FreeCheckers.hpp:78