From 26f3c871bb4c0c058d3697f63def61f832a2ace0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Gr=C3=BCtzmacher?= Date: Mon, 8 Apr 2024 18:34:10 +0200 Subject: [PATCH] Simplify the testing types Add template type functions to combine and merge type lists. As a result, the GINKGO_DPCPP_SINGLE_MODE only needs to be present once. Additionally, change the typen name ValueAndIndexType to ComplexAndPODTypes (because gko::size_type is not an IndexType). --- core/test/base/array.cpp | 2 +- core/test/base/iterator_factory.cpp | 2 +- core/test/utils.hpp | 256 ++++++++++-------- core/test/utils/CMakeLists.txt | 1 + core/test/utils/utils_test.cpp | 202 ++++++++++++++ cuda/test/base/array.cpp | 2 +- reference/test/base/array.cpp | 2 +- .../test/components/fill_array_kernels.cpp | 2 +- .../test/components/reduce_array_kernels.cpp | 2 +- test/components/fill_array_kernels.cpp | 2 +- test/components/reduce_array_kernels.cpp | 2 +- 11 files changed, 347 insertions(+), 128 deletions(-) create mode 100644 core/test/utils/utils_test.cpp diff --git a/core/test/base/array.cpp b/core/test/base/array.cpp index 59b1ef177f3..2f694364472 100644 --- a/core/test/base/array.cpp +++ b/core/test/base/array.cpp @@ -45,7 +45,7 @@ class Array : public ::testing::Test { gko::array x; }; -TYPED_TEST_SUITE(Array, gko::test::ValueAndIndexTypes, TypenameNameGenerator); +TYPED_TEST_SUITE(Array, gko::test::ComplexAndPODTypes, TypenameNameGenerator); TYPED_TEST(Array, CanBeCreatedWithoutAnExecutor) diff --git a/core/test/base/iterator_factory.cpp b/core/test/base/iterator_factory.cpp index d113f3198f4..0b50cd35558 100644 --- a/core/test/base/iterator_factory.cpp +++ b/core/test/base/iterator_factory.cpp @@ -366,7 +366,7 @@ class PermuteIterator : public ::testing::Test { using value_type = ValueType; }; -TYPED_TEST_SUITE(PermuteIterator, gko::test::ValueAndIndexTypes, +TYPED_TEST_SUITE(PermuteIterator, gko::test::ComplexAndPODTypes, TypenameNameGenerator); diff --git a/core/test/utils.hpp b/core/test/utils.hpp index c6ce7c273d1..da7394b996d 100644 --- a/core/test/utils.hpp +++ b/core/test/utils.hpp @@ -32,154 +32,170 @@ namespace gko { namespace test { +namespace detail { -using ValueTypes = -#if GINKGO_DPCPP_SINGLE_MODE - ::testing::Types>; -#else - ::testing::Types, std::complex>; -#endif +template +struct combine_types {}; -using ComplexValueTypes = -#if GINKGO_DPCPP_SINGLE_MODE - ::testing::Types>; -#else - ::testing::Types, std::complex>; -#endif +template