Sequoia
Loading...
Searching...
No Matches
SuiteTestingUtilities.hpp
Go to the documentation of this file.
1
2// Copyright Oliver J. Rosten 2023. //
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
15
16namespace sequoia::testing
17{
18 template<class ItemsKeyType, class ItemProjector, class Compare>
19 struct value_tester<object::granular_filter<ItemsKeyType, ItemProjector, Compare>>
20 {
22 using equivalent_suites_type = std::optional<typename type::suites_map_type>;
23 using equivalent_items_type = std::optional<typename type::items_map_type>;
24
25 using equivalent_type = std::pair<equivalent_suites_type, equivalent_items_type>;
26
27 template<test_mode Mode>
28 static void test(equivalence_check_t, test_logger<Mode>& logger, const type& data, const equivalent_type& prediction)
29 {
30 if(data.selected_suites() && prediction.first)
31 {
32 check(equality, "Selected Suites", logger, data.selected_suites()->begin(), data.selected_suites()->end(), prediction.first->begin(), prediction.first->end());
33 }
34 else
35 {
36 check(equality, "Selected Suites", logger, static_cast<bool>(data.selected_suites()), static_cast<bool>(prediction.first));
37 }
38
39 if(data.selected_items() && prediction.second)
40 {
41 check(equality, "Selected Items", logger, data.selected_items()->begin(), data.selected_items()->end(), prediction.second->begin(), prediction.second->end());
42 }
43 else
44 {
45 check(equality, "Selected Items", logger, static_cast<bool>(data.selected_items()), static_cast<bool>(prediction.second));
46 }
47 }
48 };
49}
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
Utilities for checking regular semantics.
Utilities for defining a suite of objects, filtered at runtime.
Definition: Suite.hpp:339
Definition: TestLogger.hpp:183
Definition: FreeCheckers.hpp:87
class template, specializations of which implement various comparisons for the specified type.
Definition: FreeCheckers.hpp:78