20 template<pseudoregular T>
25 template<test_mode Mode, alloc_getter<T>... Getters>
28 check_copy_x_allocation(logger, xCopy,
allocation_checker{checkers.info(), checkers.first_count()}...);
30 check_copy_y_allocation(logger, yCopy,
allocation_checker{checkers.info(), checkers.second_count()}...);
33 template<test_mode Mode, alloc_getter<T>... Getters>
36 check_copy_assign_allocation(logger, lhs, rhs, checkers...);
39 template<test_mode Mode, std::invocable<T&> Mutator, alloc_getter<T>... Getters>
43 check_mutation_after_swap(logger, x, y, yEquivalent, std::move(yMutator), checkers...);
50 template<test_mode Mode,
class Actions, pseudoregular T, alloc_getter<T>... Getters>
56 template<test_mode Mode, pseudoregular T, std::invocable<T&> Mutator, alloc_getter<T>... Getters>
60 [&logger, &y](
auto&... info){
61 T u{y, info.make_allocator()...};
62 if(check(equality,
"Inconsistent para-copy construction", logger, u, y))
64 check_para_copy_y_allocation(logger, u, std::tuple_cat(make_allocation_checkers(info)...));
65 return std::optional<T>{u};
67 return std::optional<T>{};
71 if(
auto c{make(info...)}; c)
73 T v{std::move(*c), info.make_allocator()...};
75 if(
check(equality,
"Inconsistent para-move construction", logger, v, y))
77 using ctag = container_tag_constant<container_tag::y>;
78 check_para_move_allocation(logger, ctag{}, v, std::tuple_cat(make_allocation_checkers(info)...));
79 check_mutation_after_move(
"para-move", logger, v, std::move(yMutator), std::tuple_cat(make_allocation_checkers(info, v)...));
89 std::invocable<T&> Mutator,
90 alloc_getter<T>... Getters
92 bool check_swap(test_logger<Mode>& logger,
const Actions& actions, T&& x, T&& y,
const T& xEquivalent,
const T& yEquivalent, Mutator yMutator,
const dual_allocation_checker<T, Getters>&... checkers)
94 return do_check_swap(logger, actions, std::move(x), std::move(y), xEquivalent, yEquivalent, std::move(yMutator), dual_allocation_checker{checkers.info(), x, y}...);
97 template<test_mode Mode,
class Actions, pseudoregular T, std::invocable<T&> Mutator, alloc_getter<T>... Getters>
98 requires (
sizeof...(Getters) > 0)
99 void check_semantics(std::string description, test_logger<Mode>& logger,
const Actions& actions,
const T& x,
const T& y, Mutator yMutator,
const allocation_info<T, Getters>&... info)
101 const auto message{!description.empty() ? add_type_info<T>(std::move(description)).append(
"\n") :
""};
102 sentinel<Mode> sentry{logger, message};
104 if(check_semantics(logger, actions, x, y, yMutator, std::tuple_cat(make_dual_allocation_checkers(info, x, y)...)))
106 check_para_constructor_allocations(logger, y, yMutator, info...);
115 invocable_r<T> xMaker,
116 invocable_r<T> yMaker,
117 std::invocable<T&> Mutator,
118 alloc_getter<T>... Getters
120 requires (
sizeof...(Getters) > 0)
121 std::pair<T, T> check_semantics(std::string description, test_logger<Mode>& logger,
const Actions& actions, xMaker xFn, yMaker yFn, Mutator yMutator,
const allocation_info<T, Getters>&... info)
123 sentinel<Mode> sentry{logger, add_type_info<T>(std::move(description)).append(
"\n")};
128 check_initialization_allocations(logger, x, y, info...);
129 check_semantics(
"", logger, actions, x, y, std::move(yMutator), info...);
131 return {std::move(x), std::move(y)};
140 std::invocable<T&> Mutator,
141 alloc_getter<T>... Getters
146 [&logger, &actions, &x, &y, m{std::move(yMutator)}](
auto&&... checkers){
147 return check_semantics(logger,
151 optional_ref<const T>{},
152 optional_ref<const T>{},
154 std::forward<decltype(checkers)>(checkers)...);
158 return std::apply(fn, checkers);
Implementation details for 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
Implementation details for checking regular semantics.
Class for use with a container possessing a (shared counting) allocator.
Definition: AllocationCheckers.hpp:425
Wraps allocation_info, together with the prior allocation count.
Definition: AllocationCheckersDetails.hpp:187
Wraps allocation_info, together with two prior allocation counts.
Definition: AllocationCheckersDetails.hpp:60
Definition: TestLogger.hpp:183
Condition for applying a container check.
Definition: AllocationCheckersDetails.cpp:15
bool check_copy_assign(test_logger< Mode > &logger, const Actions &actions, T &z, const T &y, const dual_allocation_checker< T, Getters > &... checkers)
Definition: RegularAllocationCheckersDetails.hpp:51
actions common to both move-only and regular types.
Definition: AllocationCheckersDetails.hpp:603
Extends allocation_actions for types with copy semantics.
Definition: RegularAllocationCheckersDetails.hpp:22