8#ifndef SEN_LIBS_KERNEL_TEST_INTEGRATION_TRANSPORT_HELPERS_H
9#define SEN_LIBS_KERNEL_TEST_INTEGRATION_TRANSPORT_HELPERS_H
16#include "test_helpers/tester.stl.h"
32[[nodiscard]]
inline bool eq(T a, T b)
37 return eq(a.get(), b.get());
40 if constexpr (std::is_floating_point_v<T>)
42 constexpr T eps = 1e-3;
43 return std::fabs(a - b) < eps;
49template <
typename PropType>
50[[nodiscard]]
inline bool checkProp(std::promise<TestResult>& promise,
51 const std::string& propName,
55 if (!
eq(value, expectation))
58 err.append(
"Incorrect value of ");
60 promise.set_value(TestResult(err));
67[[nodiscard]]
inline bool checkMember(std::promise<TestResult>& promise,
const std::string& memberName,
bool isOk)
74 std::string err =
"Member ";
75 err.append(memberName);
76 err.append(
" adaptation failed.");
77 promise.set_value(TestResult(err));
Here we define a set of template meta-programming helpers to let the compiler take some decisions bas...
std::conditional_t< std::is_arithmetic_v< T >||shouldBePassedByValueV< T >, T, AddConstRef< T > > MaybeRef
returns 'const T&' or 'T' depending on the type
Definition class_helpers.h:46
Definition reader_writer.h:19
bool eq(T a, T b)
Definition helpers.h:32
bool checkProp(std::promise< TestResult > &promise, const std::string &propName, sen::MaybeRef< PropType > value, sen::MaybeRef< PropType > expectation)
Definition helpers.h:50
bool checkMember(std::promise< TestResult > &promise, const std::string &memberName, bool isOk)
Definition helpers.h:67
return false if T has not an 'using ValueType' or a 'typedef ValueType'
Definition class_helpers.h:51