17namespace sequoia::testing
24 : para_move{paraMovePrediction}
25 , mutation{mutationPrediction}
38 : move_without_propagation{moveWithoutPropagation}
51 return {shifter.shift(predictions.para_move, container_tag::y),
52 shifter.shift(predictions.mutation),
53 shifter.shift(predictions.move)};
58 constexpr assignment_move_only_allocation_predictions shift(
const assignment_move_only_allocation_predictions& predictions,
59 const alloc_prediction_shifter<T>& shifter)
61 return {shifter.shift(predictions.move_without_propagation),
62 shifter.shift(predictions.move)};
65 template<top_level TopLevel>
73 requires (TopLevel == top_level::yes)
76 , m_Assign_y_to_x{assignYtoX}
83 requires (TopLevel == top_level::no)
87 , m_Assign_y_to_x{assignYtoX}
100 constexpr move_prediction move_allocs()
const noexcept {
return m_y.move; }
105 return m_Assign_y_to_x.move_without_propagation;
111 return m_Assign_y_to_x.move;
129 shifted.m_x = shifter.shift(m_x, container_tag::x);
130 shifted.m_y = testing::shift(m_y, shifter);
131 shifted.m_Assign_y_to_x = testing::shift(m_Assign_y_to_x, shifter);
145 return {predictions.x(), predictions.y(), predictions.assign_y_to_x()};
148 using move_only_allocation_predictions = basic_move_only_allocation_predictions<top_level::yes>;
149 using move_only_inner_allocation_predictions = basic_move_only_allocation_predictions<top_level::no>;
152 constexpr move_only_allocation_predictions shift(
const move_only_allocation_predictions& predictions)
154 const alloc_prediction_shifter<T> shifter{{1_containers, 1_containers, 0_postmutation}, top_level::yes};
155 return predictions.shift(shifter);
160 constexpr move_only_inner_allocation_predictions shift(
const move_only_inner_allocation_predictions& predictions)
162 const alloc_prediction_shifter<T> shifter{predictions.containers(), top_level::no};
163 return predictions.shift(shifter);
173 template<test_mode Mode, moveonly T,
class U, std::invocable<T&> Mutator, alloc_getter<T>... Getters>
174 requires checkable_against_for_semantics<Mode, T, U> && (!std::totally_ordered<T>) && (
sizeof...(Getters) > 0)
175 void check_semantics(std::string description,
179 const U& xEquivalent,
180 const U& yEquivalent,
181 optional_ref<const U> movedFromPostConstruction,
182 optional_ref<const U> movedFromPostAssignment,
186 impl::check_semantics(std::move(description),
193 movedFromPostConstruction,
194 movedFromPostAssignment,
199 template<test_mode Mode, moveonly T,
class U, std::invocable<T&> Mutator, alloc_getter<T>... Getters>
200 requires checkable_against_for_semantics<Mode, T, U> && std::totally_ordered<T> && (
sizeof...(Getters) > 0)
201 void check_semantics(std::
string description,
202 test_logger<Mode>& logger,
205 const U& xEquivalent,
206 const U& yEquivalent,
207 optional_ref<const U> movedFromPostConstruction,
208 optional_ref<const U> movedFromPostAssignment,
209 std::weak_ordering order,
211 const allocation_info<T, Getters>&... info)
213 impl::check_semantics(std::move(description),
215 impl::move_only_allocation_actions<T>{order},
220 movedFromPostConstruction,
221 movedFromPostAssignment,
230 regular_invocable_r<T> xMaker,
231 regular_invocable_r<T> yMaker,
232 std::invocable<T&> Mutator,
233 alloc_getter<T>... Getters
235 requires (!std::totally_ordered<T> && (
sizeof...(Getters) > 0))
236 std::pair<T,T> check_semantics(std::string description,
237 test_logger<Mode>& logger,
240 optional_ref<const T> movedFromPostConstruction,
241 optional_ref<const T> movedFromPostAssignment,
243 const allocation_info<T, Getters>&... info)
245 return impl::check_semantics(std::move(description),
247 impl::move_only_allocation_actions<T>{},
250 movedFromPostConstruction,
251 movedFromPostAssignment,
260 regular_invocable_r<T> xMaker,
261 regular_invocable_r<T> yMaker,
262 std::invocable<T&> Mutator,
263 alloc_getter<T>... Getters
265 requires (std::totally_ordered<T> && (
sizeof...(Getters) > 0))
266 std::pair<T,T> check_semantics(std::string description,
267 test_logger<Mode>& logger,
270 optional_ref<const T> movedFromPostConstruction,
271 optional_ref<const T> movedFromPostAssignment,
272 std::weak_ordering order,
274 const allocation_info<T, Getters>&... info)
276 return impl::check_semantics(std::move(description),
278 impl::move_only_allocation_actions<T>{order},
281 movedFromPostConstruction,
282 movedFromPostAssignment,
Client-facing utilities for performing allocation checks.
Implementation details specific to allocation checks for move-only types.
class template for shifting allocation predictions, especially for MSVC debug builds.
Definition: AllocationCheckers.hpp:217
Class for use with a container possessing a (shared counting) allocator.
Definition: AllocationCheckers.hpp:425
Definition: MoveOnlyAllocationCheckers.hpp:67
Definition: AllocationCheckers.hpp:575
Definition: TestLogger.hpp:183
Definition: MoveOnlyAllocationCheckers.hpp:35
Definition: AllocationCheckers.hpp:152
Definition: MoveOnlyAllocationCheckersDetails.hpp:23
Definition: MoveOnlyAllocationCheckers.hpp:20
Definition: AllocationCheckers.hpp:351