kokkos-utils 0.0.1
 
Loading...
Searching...
No Matches
test_Helpers.cpp
Go to the documentation of this file.
1#include "gmock/gmock.h"
2#include "gtest/gtest.h"
3
5
16
17using execution_space = Kokkos::DefaultExecutionSpace;
18
20{
21
22using namespace Kokkos::utils::callbacks;
23
26{
27 const auto matcher = ABeginParallelForEventWithName(::testing::StrEq("computation - level 0 - pfor"));
28 ASSERT_EQ(::testing::DescribeMatcher<std::variant<BeginParallelForEvent>>(matcher), "is a variant<> with value of type 'Kokkos::utils::callbacks::BeginParallelForEvent' and the value is an object whose given field is equal to \"computation - level 0 - pfor\"");
29}
30
32TEST(ContainsInOrderMatcher, CanDescribeItself)
33{
34 const auto matcher = ContainsInOrder<int>(::testing::Eq(3), ::testing::Eq(4));
35 ASSERT_EQ(::testing::DescribeMatcher<std::vector<int>>(matcher), "contains in order elements that match (is equal to 3, is equal to 4)");
36
37 const auto matcher_not = ::testing::Not(ContainsInOrder<int>(::testing::Eq(3), ::testing::Eq(4)));
38 ASSERT_EQ(::testing::DescribeMatcher<std::vector<int>>(matcher_not), "does not contain in order elements that match (is equal to 3, is equal to 4)");
39}
40
42TEST(ContainsInOrderMatcher, Matches)
43{
44 const std::vector<int> vec{1, 2, 3, 4};
45 ASSERT_THAT(vec, ContainsInOrder<int>());
46 ASSERT_THAT(vec, ContainsInOrder<int>(::testing::Eq(2), ::testing::Eq(4)));
47 ASSERT_THAT(vec, ::testing::Not(ContainsInOrder<int>(::testing::Eq(2), ::testing::Eq(1))));
48}
49
50} // namespace Kokkos::utils::tests::callbacks
auto ABeginParallelForEventWithName(Matcher &&matcher)
Definition Helpers.hpp:59
auto ContainsInOrder(Matchers &&... matchers)
Definition Helpers.hpp:142
TEST(EventTest, BeginEvent)
Kokkos::DefaultExecutionSpace execution_space