1#ifndef LOG_SURGEON_TESTS_COMPARISON_TEST_UTILS_HPP
2#define LOG_SURGEON_TESTS_COMPARISON_TEST_UTILS_HPP
8#include <catch2/catch_message.hpp>
9#include <catch2/catch_test_macros.hpp>
20template <StronglyThreeWayComparable T>
21auto test_equal(T
const& lhs, T
const& rhs) -> void;
28template <StronglyThreeWayComparable T>
36template <StronglyThreeWayComparable T>
43template <StronglyThreeWayComparable T>
46template <StronglyThreeWayComparable T>
48 REQUIRE((lhs <=> rhs) == std::strong_ordering::equal);
56 REQUIRE_FALSE(lhs != rhs);
57 REQUIRE_FALSE(lhs < rhs);
58 REQUIRE_FALSE(lhs > rhs);
59 REQUIRE_FALSE(rhs != lhs);
60 REQUIRE_FALSE(rhs < lhs);
61 REQUIRE_FALSE(rhs > lhs);
64template <StronglyThreeWayComparable T>
66 REQUIRE((lhs <=> rhs) == std::strong_ordering::greater);
74 REQUIRE_FALSE(lhs == rhs);
75 REQUIRE_FALSE(lhs <= rhs);
76 REQUIRE_FALSE(lhs < rhs);
77 REQUIRE_FALSE(rhs == lhs);
78 REQUIRE_FALSE(rhs >= lhs);
79 REQUIRE_FALSE(rhs > lhs);
82template <StronglyThreeWayComparable T>
84 REQUIRE((lhs <=> rhs) == std::strong_ordering::less);
92 REQUIRE_FALSE(lhs == rhs);
93 REQUIRE_FALSE(lhs >= rhs);
94 REQUIRE_FALSE(lhs > rhs);
95 REQUIRE_FALSE(rhs == lhs);
96 REQUIRE_FALSE(rhs <= lhs);
97 REQUIRE_FALSE(rhs < lhs);
100template <StronglyThreeWayComparable T>
103 for (
size_t i{0}; i < ordered_vector.size(); i++) {
105 for (
size_t j{0}; j < ordered_vector.size(); j++) {
110 test_equal(ordered_vector[i], ordered_vector[j]);
Definition comparison_test_utils.hpp:13
Definition comparison_test_utils.hpp:11
auto test_equal(T const &lhs, T const &rhs) -> void
Definition comparison_test_utils.hpp:47
auto pairwise_comparison_of_strictly_ascending_vector(std::vector< T > const &ordered_vector) -> void
Definition comparison_test_utils.hpp:101
auto test_less_than(T const &lhs, T const &rhs) -> void
Definition comparison_test_utils.hpp:83
auto test_greater_than(T const &lhs, T const &rhs) -> void
Definition comparison_test_utils.hpp:65