15namespace sequoia::testing
19 template<
class CheckerType, test_mode Mode,
class Edge,
class Prediction>
20 void check_partial([[maybe_unused]] CheckerType flavour, test_logger<Mode>& logger,
const Edge& edge,
const Prediction& prediction)
22 check(equality,
"Target node incorrect", logger, edge.target_node(), prediction.target_node());
24 if constexpr (!std::is_empty_v<typename Edge::weight_type>)
26 check(flavour,
"Weight incorrect", logger, edge.weight(), prediction.weight());
29 if constexpr(!std::is_empty_v<typename Edge::meta_data_type>)
31 check(flavour,
"Meta data incorrect", logger, edge.meta_data(), prediction.meta_data());
35 template<test_mode Mode,
class Edge,
class Prediction>
36 void check_complementary(test_logger<Mode>& logger,
const Edge& edge,
const Prediction& prediction)
38 check(equality,
"Complementary index incorrect", logger, edge.complementary_index(), prediction.complementary_index());
42 template<
class WeightHandler,
class MetaData, std::
integral IndexType>
43 requires object::handler<WeightHandler>
47 using weight_type =
typename type::weight_type;
49 template<
class CheckerType, test_mode Mode>
52 impl::check_partial(flavour, logger, edge, prediction);
55 template<test_mode Mode,
class OtherHandler>
59 impl::check_partial(with_best_available, logger, edge, prediction);
62 template<test_mode Mode>
63 requires std::is_empty_v<weight_type> && std::is_empty_v<MetaData>
66 check(equality,
"Target node incorrect", logger, edge.target_node(), target);
69 template<test_mode Mode>
70 requires (!std::is_empty_v<weight_type>) && std::is_empty_v<MetaData>
73 check(equality,
"Target node incorrect", logger, edge.target_node(), prediction.first);
74 check(equality,
"Weight incorrect", logger, edge.weight(), prediction.second);
77 template<test_mode Mode>
78 requires std::is_empty_v<weight_type> && (!std::is_empty_v<MetaData>)
81 check(equality,
"Target node incorrect", logger, edge.target_node(), prediction.first);
82 check(equality,
"Weight incorrect", logger, edge.meta_data(), prediction.second);
85 template<test_mode Mode>
86 requires (!std::is_empty_v<weight_type>) && (!std::is_empty_v<MetaData>)
89 check(equality,
"Target node incorrect", logger, edge.target_node(), std::get<0>(prediction));
90 check(equality,
"Weight incorrect", logger, edge.weight(), std::get<2>(prediction));
91 check(equality,
"Meta data incorrect", logger, edge.meta_data(), std::get<1>(prediction));
95 template<
class WeightHandler,
class MetaData, std::
integral IndexType>
100 using weight_type =
typename type::weight_type;
102 template<
class CheckerType, test_mode Mode>
105 impl::check_partial(flavour, logger, edge, prediction);
106 impl::check_complementary(logger, edge, prediction);
109 template<test_mode Mode,
class OtherHandler>
113 impl::check_partial(with_best_available, logger, edge, prediction);
114 impl::check_complementary(logger, edge, prediction);
117 template<test_mode Mode>
118 requires std::is_empty_v<weight_type>&& std::is_empty_v<MetaData>
121 check(equality,
"Target node incorrect", logger, edge.target_node(), prediction.first);
122 check(equality,
"Complementary index incorrect", logger, edge.complementary_index(), prediction.second);
125 template<test_mode Mode>
126 requires (!std::is_empty_v<weight_type>) && std::is_empty_v<MetaData>
129 check(equality,
"Target node incorrect", logger, edge.target_node(), std::get<0>(prediction));
130 check(equality,
"Complementary index incorrect", logger, edge.complementary_index(), std::get<1>(prediction));
131 check(equality,
"Weight incorrect", logger, edge.weight(), std::get<2>(prediction));
134 template<test_mode Mode>
135 requires std::is_empty_v<weight_type> && (!std::is_empty_v<MetaData>)
138 check(equality,
"Target node incorrect", logger, edge.target_node(), std::get<0>(prediction));
139 check(equality,
"Complementary index incorrect", logger, edge.complementary_index(), std::get<1>(prediction));
140 check(equality,
"Weight incorrect", logger, edge.meta_data(), std::get<2>(prediction));
143 template<test_mode Mode>
144 requires (!std::is_empty_v<weight_type>) && (!std::is_empty_v<MetaData>)
147 check(equality,
"Target node incorrect", logger, edge.target_node(), std::get<0>(prediction));
148 check(equality,
"Complementary index incorrect", logger, edge.complementary_index(), std::get<1>(prediction));
149 check(equality,
"Weight incorrect", logger, edge.weight(), std::get<3>(prediction));
150 check(equality,
"Meta data incorrect", logger, edge.meta_data(), std::get<2>(prediction));
Various edge types for use by graphs.
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.
Decoration of a partial_edge to record the location on the target node into which the edge is embedde...
Definition: Edge.hpp:328
A concrete edge containing a target index and, optionally, a weight.
Definition: Edge.hpp:303
Definition: TestLogger.hpp:183
Definition: HandlerTraits.hpp:20
Definition: FreeCheckers.hpp:87
class template, specializations of which implement various comparisons for the specified type.
Definition: FreeCheckers.hpp:78