Sequoia
Loading...
Searching...
No Matches
StaticLinearlyPartitionedSequenceTestingUtilities.hpp
Go to the documentation of this file.
1
2// Copyright Oliver J. Rosten 2020. //
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 T, std::size_t Npartitions, std::size_t NelementsPerPartition, std::integral IndexType>
19 struct value_tester<sequoia::data_structures::static_linearly_partitioned_sequence<T, Npartitions, NelementsPerPartition, IndexType>>
20 {
22
23 template<class CheckType, test_mode Mode>
24 static void test(CheckType flavour, test_logger<Mode>& logger, const type& actual, const type& prediction)
25 {
26 impl::check_details(flavour, logger, actual, prediction);
27 }
28
29 template<test_mode Mode>
30 static void test(equivalence_check_t, test_logger<Mode>& logger, const type& actual, const std::array<std::array<T, NelementsPerPartition>, Npartitions>& prediction)
31 {
32 for (std::size_t i{}; i < prediction.size(); ++i)
33 {
34 const auto message{ std::string{"Partition "}.append(std::to_string(i)) };
35 check(with_best_available, message + ": iterator", logger, actual.begin_partition(i), actual.end_partition(i), (prediction.begin() + i)->begin(), (prediction.begin() + i)->end());
36
37 check(with_best_available, message + ": riterator", logger, actual.rbegin_partition(i), actual.rend_partition(i), std::rbegin(*(prediction.begin() + i)), std::rend(*(prediction.begin() + i)));
38 }
39 }
40 };
41}
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.
Classes implementing the concept of a linearly partitioned sequence of data.
Definition: PartitionedData.hpp:1099
Definition: TestLogger.hpp:183
Definition: FreeCheckers.hpp:87
class template, specializations of which implement various comparisons for the specified type.
Definition: FreeCheckers.hpp:78