Sequoia
Loading...
Searching...
No Matches
RegularCheckers.hpp
Go to the documentation of this file.
1
2// Copyright Oliver J. Rosten 2019. //
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
44
45namespace sequoia::testing
46{
48 template<test_mode Mode, pseudoregular T, class U>
49 requires checkable_against_for_semantics<Mode, T, U>
50 void check_semantics(std::string description,
51 test_logger<Mode>& logger,
52 const T& x,
53 const T& y,
54 optional_ref<const U> movedFromPostConstruction,
55 optional_ref<const U> movedFromPostAssignment)
56 {
57 sentinel<Mode> sentry{logger, add_type_info<T>(std::move(description)).append("\n")};
58 impl::check_semantics(logger,
60 x,
61 y,
62 movedFromPostConstruction,
63 movedFromPostAssignment,
65 }
66
72 template<test_mode Mode, pseudoregular T, class U, class V>
73 requires equivalence_checkable_for_semantics<Mode, T, U> && checkable_against_for_semantics<Mode, T, V>
74 void check_semantics(std::string description,
75 test_logger<Mode>& logger,
76 const T& x,
77 const T& y,
78 const U& xEquivalent,
79 const U& yEquivalent,
80 optional_ref<const V> movedFromPostConstruction,
81 optional_ref<const V> movedFromPostAssignment)
82 {
83 sentinel<Mode> sentry{logger, add_type_info<T>(std::move(description)).append("\n")};
84
85 impl::check_best_equivalence(logger, x, y, xEquivalent, yEquivalent);
86 impl::check_semantics(logger,
88 x,
89 y,
90 movedFromPostConstruction,
91 movedFromPostAssignment,
93 }
94
96 template<test_mode Mode, pseudoregular T, class U>
97 requires std::totally_ordered<T> && checkable_against_for_semantics<Mode, T, U>
98 void check_semantics(std::string description,
99 test_logger<Mode>& logger,
100 const T& x,
101 const T& y,
102 optional_ref<const U> movedFromPostConstruction,
103 optional_ref<const U> movedFromPostAssignment,
104 std::weak_ordering order)
105 {
106 sentinel<Mode> sentry{logger, add_type_info<T>(std::move(description)).append("\n")};
107 impl::check_semantics(logger,
109 x,
110 y,
111 movedFromPostConstruction,
112 movedFromPostAssignment,
114 }
115
121 template<test_mode Mode, pseudoregular T, class U, class V>
122 requires std::totally_ordered<T> && equivalence_checkable_for_semantics<Mode, T, U> && checkable_against_for_semantics<Mode, T, V>
123 void check_semantics(std::string description,
124 test_logger<Mode>& logger,
125 const T& x,
126 const T& y,
127 const U& xEquivalent,
128 const U& yEquivalent,
129 optional_ref<const V> movedFromPostConstruction,
130 optional_ref<const V> movedFromPostAssignment,
131 std::weak_ordering order)
132 {
133 sentinel<Mode> sentry{logger, add_type_info<T>(std::move(description)).append("\n")};
134
135 impl::check_best_equivalence(logger, x, y, xEquivalent, yEquivalent);
136 impl::check_semantics(logger,
138 x,
139 y,
140 movedFromPostConstruction,
141 movedFromPostAssignment,
143 }
144
146 template<test_mode Mode, pseudoregular T, class U, std::invocable<T&> Mutator>
147 requires checkable_against_for_semantics<Mode, T, U>
148 void check_semantics(std::string description,
149 test_logger<Mode>& logger,
150 const T& x,
151 const T& y,
152 optional_ref<const U> movedFromPostConstruction,
153 optional_ref<const U> movedFromPostAssignment,
154 Mutator yMutator)
155 {
156 sentinel<Mode> sentry{logger, add_type_info<T>(std::move(description)).append("\n")};
157 impl::check_semantics(logger,
159 x,
160 y,
161 movedFromPostConstruction,
162 movedFromPostAssignment,
163 yMutator);
164 }
165
171 template<test_mode Mode, pseudoregular T, class U, class V, std::invocable<T&> Mutator>
172 requires equivalence_checkable_for_semantics<Mode, T, U> && checkable_against_for_semantics<Mode, T, V>
173 void check_semantics(std::string description,
174 test_logger<Mode>& logger,
175 const T& x,
176 const T& y,
177 const U& xEquivalent,
178 const U& yEquivalent,
179 optional_ref<const V> movedFromPostConstruction,
180 optional_ref<const V> movedFromPostAssignment,
181 Mutator yMutator)
182 {
183 sentinel<Mode> sentry{logger, add_type_info<T>(std::move(description)).append("\n")};
184
185 impl::check_best_equivalence(logger, x, y, xEquivalent, yEquivalent);
186 impl::check_semantics(logger,
188 x,
189 y,
190 movedFromPostConstruction,
191 movedFromPostAssignment,
192 yMutator);
193 }
194
196 template<test_mode Mode, pseudoregular T, class U, std::invocable<T&> Mutator>
197 requires std::totally_ordered<T> && checkable_against_for_semantics<Mode, T, U>
198 void check_semantics(std::string description,
199 test_logger<Mode>& logger,
200 const T& x,
201 const T& y,
202 optional_ref<const U> movedFromPostConstruction,
203 optional_ref<const U> movedFromPostAssignment,
204 std::weak_ordering order,
205 Mutator yMutator)
206 {
207 sentinel<Mode> sentry{logger, add_type_info<T>(std::move(description)).append("\n")};
208 impl::check_semantics(logger,
210 x,
211 y,
212 movedFromPostConstruction,
213 movedFromPostAssignment,
214 yMutator);
215 }
216
222 template<test_mode Mode, pseudoregular T, class U, class V, std::invocable<T&> Mutator>
223 requires std::totally_ordered<T> && equivalence_checkable_for_semantics<Mode, T, U> && checkable_against_for_semantics<Mode, T, V>
224 void check_semantics(std::string description,
225 test_logger<Mode>& logger,
226 const T& x,
227 const T& y,
228 const U& xEquivalent,
229 const U& yEquivalent,
230 optional_ref<const V> movedFromPostConstruction,
231 optional_ref<const V> movedFromPostAssignment,
232 std::weak_ordering order,
233 Mutator yMutator)
234 {
235 sentinel<Mode> sentry{logger, add_type_info<T>(std::move(description)).append("\n")};
236
237 impl::check_best_equivalence(logger, x, y, xEquivalent, yEquivalent);
238 impl::check_semantics(logger,
240 x,
241 y,
242 movedFromPostConstruction,
243 movedFromPostAssignment,
244 yMutator);
245 }
246}
Free functions for performing checks, together with the 'checker' class template which wraps them.
Implementation details for checking regular semantics.
Definition: TestLogger.hpp:277
Definition: TestLogger.hpp:183
Definition: SemanticsCheckersDetails.hpp:150
Definition: SemanticsCheckersDetails.hpp:116