18namespace sequoia::testing
23 : copy{copyPrediction}
24 , mutation{mutationPrediction}
25 , para_copy{convert<construction_allocation_event::para_copy>(copyPrediction)}
26 , para_move{convert<construction_allocation_event::para_move>(copyPrediction)}
32 : copy{copyPrediction}
33 , mutation{mutationPrediction}
34 , para_copy{paraCopyPrediction}
35 , para_move{convert<construction_allocation_event::para_move>(copyPrediction)}
43 : copy{copyPrediction}
44 , mutation{mutationPrediction}
45 , para_copy{paraCopyPrediction}
46 , para_move{paraMovePrediction}
60 : without_propagation{withoutPropagation}
61 , with_propagation{withPropagation}
62 , move_without_propagation{convert<assignment_allocation_event::move_assign_no_prop>(without_propagation)}
69 : without_propagation{withoutPropagation}
70 , with_propagation{withPropagation}
71 , move_without_propagation{moveWithoutPropagation}
87 return {shifter.shift(predictions.copy, container_tag::y),
88 shifter.shift(predictions.mutation),
89 shifter.shift(predictions.para_copy),
90 shifter.shift(predictions.para_move, container_tag::y),
91 shifter.shift(predictions.move)};
96 constexpr assignment_allocation_predictions shift(
const assignment_allocation_predictions& predictions,
97 const alloc_prediction_shifter<T>& shifter)
99 return {shifter.shift(predictions.without_propagation),
100 shifter.shift(predictions.with_propagation),
101 shifter.shift(predictions.move_without_propagation),
102 shifter.shift(predictions.move)};
105 template<top_level TopLevel>
112 requires (TopLevel == top_level::yes)
115 , m_Assign_y_to_x{assignYtoX}
123 requires (TopLevel == top_level::no)
127 , m_Assign_y_to_x{assignYtoX}
136 return m_Assign_y_to_x.move_without_propagation;
142 return m_Assign_y_to_x.move;
149 constexpr move_prediction move_allocs()
const noexcept {
return m_y.move; }
166 shifted.m_x = shifter.shift(m_x, container_tag::x);
167 shifted.m_y = testing::shift(m_y, shifter);
168 shifted.m_Assign_y_to_x = testing::shift(m_Assign_y_to_x, shifter);
182 return {predictions.x(), predictions.y(), predictions.assign_y_to_x()};
185 using allocation_predictions = basic_allocation_predictions<top_level::yes>;
186 using inner_allocation_predictions = basic_allocation_predictions<top_level::no>;
190 constexpr allocation_predictions shift(
const allocation_predictions& predictions)
192 const alloc_prediction_shifter<T> shifter{{1_containers, 1_containers, 0_postmutation}, top_level::yes};
193 return predictions.shift(shifter);
198 constexpr inner_allocation_predictions shift(
const inner_allocation_predictions& predictions)
200 const alloc_prediction_shifter<T> shifter{predictions.containers(), top_level::no};
201 return predictions.shift(shifter);
204 template<pseudoregular T>
205 struct type_to_allocation_predictions<T>
207 using predictions_type = allocation_predictions;
208 using inner_predictions_type = inner_allocation_predictions;
211 template<test_mode Mode, pseudoregular T, std::invocable<T&> Mutator, alloc_getter<T>... Getters>
212 requires (!std::totally_ordered<T> && (
sizeof...(Getters) > 0))
213 void check_semantics(std::string description, test_logger<Mode>& logger,
const T& x,
const T& y, Mutator yMutator,
const allocation_info<T, Getters>&... info)
215 impl::check_semantics(std::move(description), logger, impl::regular_allocation_actions<T>{}, x, y, std::move(yMutator), info...);
218 template<test_mode Mode, pseudoregular T, std::invocable<T&> Mutator, alloc_getter<T>... Getters>
219 requires (std::totally_ordered<T> && (
sizeof...(Getters) > 0))
220 void check_semantics(std::string description, test_logger<Mode>& logger,
const T& x,
const T& y, std::weak_ordering order, Mutator yMutator,
const allocation_info<T, Getters>&... info)
222 impl::check_semantics(std::move(description), logger, impl::regular_allocation_actions<T>{order}, x, y, std::move(yMutator), info...);
229 invocable_r<T> xMaker,
230 invocable_r<T> yMaker,
231 std::invocable<T&> Mutator,
232 alloc_getter<T>... Getters
234 requires (!std::totally_ordered<T> &&
sizeof...(Getters) > 0)
235 std::pair<T, T> check_semantics(std::string description, test_logger<Mode>& logger, xMaker xFn, yMaker yFn, Mutator yMutator,
const allocation_info<T, Getters>&... info)
237 return impl::check_semantics(std::move(description), logger, impl::regular_allocation_actions<T>{}, std::move(xFn), std::move(yFn), std::move(yMutator), info...);
244 invocable_r<T> xMaker,
245 invocable_r<T> yMaker,
246 std::invocable<T&> Mutator,
247 alloc_getter<T>... Getters
249 requires (std::totally_ordered<T> &&
sizeof...(Getters) > 0)
250 std::pair<T, T> check_semantics(std::string description, test_logger<Mode>& logger, xMaker xFn, yMaker yFn, std::weak_ordering order, Mutator yMutator,
const allocation_info<T, Getters>&... info)
252 return impl::check_semantics(std::move(description), logger, impl::regular_allocation_actions<T>{order}, std::move(xFn), std::move(yFn), std::move(yMutator), info...);
Client-facing utilities for performing allocation checks.
Implementation details for allocation checks of regular types.
class template for shifting allocation predictions, especially for MSVC debug builds.
Definition: AllocationCheckers.hpp:217
Definition: RegularAllocationCheckers.hpp:107
Definition: AllocationCheckers.hpp:575
Definition: RegularAllocationCheckers.hpp:58
Definition: AllocationCheckers.hpp:152
Definition: RegularAllocationCheckers.hpp:21