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