From bca7a65199faf460eb16dc700617b19c2aa9aca6 Mon Sep 17 00:00:00 2001 From: "Nevin \":-)\" Liber" Date: Thu, 23 May 2024 20:52:22 -0500 Subject: [PATCH] Added back to_Array tests --- core/unit_test/TestArray.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/core/unit_test/TestArray.cpp b/core/unit_test/TestArray.cpp index d20d355b792..824ffd61adc 100644 --- a/core/unit_test/TestArray.cpp +++ b/core/unit_test/TestArray.cpp @@ -160,4 +160,23 @@ constexpr bool test_array_specialization_kokkos_swap() { static_assert(test_array_specialization_kokkos_swap()); +KOKKOS_FUNCTION constexpr bool test_to_array() { + // copies a string literal + auto a1 = Kokkos::to_Array("foo"); + static_assert(a1.size() == 4); + + // deduces both element type and length + auto a2 = Kokkos::to_Array({0, 2, 1, 3}); + static_assert(std::is_same_v>); + + // deduces length with element type specified + // implicit conversion happens + auto a3 = Kokkos::to_Array({0, 1, 3}); + static_assert(std::is_same_v>); + + return true; +} + +static_assert(test_to_array()); + } // namespace