17 #ifndef OPENKALMAN_COLLECTIONS_TESTS_HPP 18 #define OPENKALMAN_COLLECTIONS_TESTS_HPP 20 #include <type_traits> 23 #include <gtest/gtest.h> 36 template<collections::tuple_like Arg1, collections::tuple_like Arg2,
typename Err>
37 struct TestComparison<Arg1, Arg2, Err>
39 template<typename Arg1, typename Arg2, typename Err>
41 collections::tuple_like<Arg1> and collections::tuple_like<Arg2>>>
43 : ::testing::AssertionResult
47 template<std::size_t...Ix>
48 static ::testing::AssertionResult
49 compare(
const Arg1 arg1,
const Arg2 arg2,
const Err& err, std::index_sequence<Ix...>)
51 static_assert(std::tuple_size_v<Arg1> == std::tuple_size_v<Arg2>,
"tuple size of arguments must match");
53 if constexpr (collections::tuple_like<Err>)
55 static_assert(std::tuple_size_v<Err> == std::tuple_size_v<Arg1>,
"tuple size of error margins must match that of arguments");
59 return ::testing::AssertionSuccess();
63 return (::testing::AssertionFailure() << ... << (std::string(Ix == 0 ?
"" :
", ") +
71 return ::testing::AssertionSuccess();
75 return (::testing::AssertionFailure() << ... << (std::string(Ix == 0 ?
"" :
", ") +
84 : ::testing::AssertionResult {
compare(arg1, arg2, err, std::make_index_sequence<std::tuple_size_v<Arg1>>{})} {}
92 #endif //OPENKALMAN_COLLECTIONS_TESTS_HPP Definition for collections::tuple_like.
constexpr partial_ordering compare(const Lhs &lhs, const Rhs &rhs)
Compare two collections.
Definition: compare.hpp:106
Definition: tuple_reverse.hpp:103
Basic utilities for OpenKalman testing.