11#include <fmt/ranges.h>
12#include <gtest/gtest.h>
23std::tuple<std::vector<std::string>, std::vector<std::string>>
26std::vector<std::string>
28std::vector<std::string>
32 template <
class ParamType>
33 std::string
operator()(const ::testing::TestParamInfo<ParamType>& info)
const
35 return fmt::format(
"{}_{}", std::get<0>(info.param), std::get<1>(info.param));
39class VolkTest :
public ::testing::TestWithParam<std::tuple<std::string, size_t>>
58 ::testing::AssertionResult result = ::testing::AssertionFailure();
59 if (expected.size() != actual.size()) {
60 return result <<
"expected result size=" << expected.size()
61 <<
" differs from actual size=" << actual.size();
63 const unsigned long length = expected.size();
66 const char* separator =
" ";
67 for (
unsigned long index = 0; index < length; index++) {
68 auto expected_real = ::testing::internal::FloatingPoint(expected[index].real());
69 auto expected_imag = ::testing::internal::FloatingPoint(expected[index].imag());
70 auto actual_real = ::testing::internal::FloatingPoint(actual[index].real());
71 auto actual_imag = ::testing::internal::FloatingPoint(actual[index].imag());
72 if (not expected_real.AlmostEquals(actual_real) or
73 not expected_imag.AlmostEquals(actual_imag))
76 if (errorsFound == 0) {
77 result <<
"Differences found:";
79 if (errorsFound < 3) {
80 result << separator << expected[index] <<
" != " << actual[index] <<
" @ "
87 if (errorsFound > 0) {
88 result << separator << errorsFound <<
" differences in total";
91 return ::testing::AssertionSuccess();
Definition volk_test.h:40
void initialize_test(const std::tuple< std::string, size_t > ¶m)
Definition volk_test.h:42
std::string implementation_name
Definition volk_test.h:48
bool is_aligned_implementation
Definition volk_test.h:49
size_t vector_length
Definition volk_test.h:50
Definition volk_test.h:31
std::string operator()(const ::testing::TestParamInfo< ParamType > &info) const
Definition volk_test.h:33
__VOLK_DECL_BEGIN struct volk_func_desc volk_func_desc_t
std::vector< std::string > get_aligned_kernel_implementation_names(const volk_func_desc_t desc)
Definition volk_test.cc:89
bool is_aligned_implementation_name(const std::string &name)
Definition volk_test.cc:68
::testing::AssertionResult AreComplexFloatingPointArraysAlmostEqual(const T &expected, const T &actual)
Definition volk_test.h:55
std::tuple< std::vector< std::string >, std::vector< std::string > > separate_implementations_by_alignment(const std::vector< std::string > &names)
Definition volk_test.cc:74
static constexpr std::array< size_t, 5 > default_vector_sizes
Definition volk_test.h:17
std::vector< std::string > get_unaligned_kernel_implementation_names(const volk_func_desc_t desc)
Definition volk_test.cc:97
std::vector< std::string > get_kernel_implementation_name_list(const volk_func_desc_t desc)
Definition volk_test.cc:58