Sequoia
Loading...
Searching...
No Matches
StaticQueueTestingUtilities.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 MaxPushes>
19 struct value_tester<data_structures::static_queue<T, MaxPushes>>
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, "Front element incorrect", logger, queue.front(), prediction.front());
32
33 check(flavour, "Back element incorrect", logger, queue.back(), prediction.back());
34 }
35
36 check("Hidden state incorrect", logger, prediction == queue);
37 check("Hidden state, symmetry of operator== incorrect", logger, queue == prediction);
38 }
39 };
40}
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 queue.
A queue suitable for constexpr contexts.
Definition: StaticQueue.hpp:27
Definition: TestLogger.hpp:183
class template, specializations of which implement various comparisons for the specified type.
Definition: FreeCheckers.hpp:78