Sequoia
Loading...
Searching...
No Matches
PhysicalValueTestingUtilities.hpp
Go to the documentation of this file.
1
2// Copyright Oliver J. Rosten 2024. //
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
14
15namespace sequoia::testing
16{
17 template<maths::convex_space PhysicalValueSpace, physics::physical_unit Unit, class Convention, class Origin, class Validator>
18 struct value_tester<physics::physical_value<PhysicalValueSpace, Unit, Convention, Origin, Validator>>
19 {
21 using value_type = type::value_type;
22 constexpr static auto dimension{type::dimension};
23
24 template<test_mode Mode>
25 static void test(equality_check_t, test_logger<Mode>& logger, const type& actual, const type& prediction)
26 {
27 if constexpr(dimension == 1)
28 {
29 check(equality, "Wrapped Value", logger, actual.value(), prediction.value());
30 }
31 else
32 {
33 check(equality, "Wrapped Values", logger, actual.values(), prediction.values());
34 }
35 }
36
37 template<test_mode Mode>
38 requires (dimension == 1)
39 static void test(equivalence_check_t, test_logger<Mode>& logger, const type& actual, const value_type& prediction)
40 {
41 check(equality, "Wrapped Value", logger, actual.value(), prediction);
42 }
43
44 template<test_mode Mode>
45 requires (dimension > 1)
46 static void test(equivalence_check_t, test_logger<Mode>& logger, const type& actual, const std::array<value_type, dimension>& prediction)
47 {
48 check(equivalence, "Wrapped Values", logger, actual.values(), prediction);
49 }
50 };
51
52 template<maths::convex_space ValueSpace, class Unit, class Convention, class Origin, class Validator>
53 inline constexpr bool defines_physical_value_v{
54 requires {
56 }
57 };
58}
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.
Definition: PhysicalValues.hpp:440
Definition: TestLogger.hpp:183
Definition: FreeCheckers.hpp:82
Definition: FreeCheckers.hpp:87
class template, specializations of which implement various comparisons for the specified type.
Definition: FreeCheckers.hpp:78