Sequoia
Loading...
Searching...
No Matches
StaticPriorityQueueTestingUtilities.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
13
15
16namespace sequoia::testing
17{
18 template<class T, std::size_t MaxDepth, class Compare>
19 struct value_tester<data_structures::static_priority_queue<T, MaxDepth, Compare>>
20 {
22
23 template<class CheckerType, test_mode Mode>
24 static void test(CheckerType flavour, test_logger<Mode>& logger, const type& queue, const type& prediction)
25 {
26 check(equality, "Emptiness incorrect", logger, queue.empty(), prediction.empty());
27 check(equality, "Size incorrect", logger, queue.size(), prediction.size());
28
29 if(!prediction.empty() && !queue.empty())
30 {
31 check(flavour, "Top element incorrect", logger, queue.top(), prediction.top());
32 }
33
34 check("Hidden state incorrect", logger, prediction == queue);
35 check("Hidden state, symmetry of == incorrect", logger, queue == prediction);
36 }
37 };
38}
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.
A constexpr prority queue.
A priority_queue suitable for constexpr contexts.
Definition: StaticPriorityQueue.hpp:29
Definition: TestLogger.hpp:183
class template, specializations of which implement various comparisons for the specified type.
Definition: FreeCheckers.hpp:78