kokkos-execution 0.0.1
Loading...
Searching...
No Matches
test_properties.cpp
Go to the documentation of this file.
1#include "gtest/gtest.h"
2
5
7
18
19namespace Tests::Impl {
20
53
54static_assert(test_has_property());
55
57consteval bool test_get_property() {
60
61 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
62#define TEST_GET_PROPERTY(_prop_, _data_t_, _value_t_) \
63 static_assert( \
64 std::same_as<decltype(Kokkos::Execution::Impl::get_property<_prop_>(std::declval<_data_t_>())), _value_t_>);
65
67 TEST_GET_PROPERTY(Tests::Utils::MyPropA, const multi_data_t&, const std::string&)
68 TEST_GET_PROPERTY(Tests::Utils::MyPropA, multi_data_t&, std::string&)
69 TEST_GET_PROPERTY(Tests::Utils::MyPropA, multi_data_t&&, std::string&&)
70
71
72 TEST_GET_PROPERTY(Kokkos::Execution::Impl::Label, const labeled_data_t&, const std::string_view&)
73 TEST_GET_PROPERTY(Kokkos::Execution::Impl::Label, labeled_data_t&, std::string_view&)
74 TEST_GET_PROPERTY(Kokkos::Execution::Impl::Label, labeled_data_t&&, std::string_view&&)
75
76#undef TEST_GET_PROPERTY
77
78 constexpr labeled_data_t data{"my-nice-label"};
80 static_assert(value == "my-nice-label");
81
82 return true;
83}
84
85static_assert(test_get_property());
86
91TEST(get_property, label) {
92 ASSERT_EQ(
95 "my-nice-label");
96}
97
98} // namespace Tests::Impl
consteval bool has_property()
Return true when Data derives from the property Property.
constexpr decltype(auto) get_property(Data &&data) noexcept
consteval bool test_has_property()
consteval bool test_get_property()
#define TEST_GET_PROPERTY(_prop_, _data_t_, _value_t_)