kokkos-execution 0.0.1
Loading...
Searching...
No Matches
test_sync_wait.cpp
Go to the documentation of this file.
2
6
18
20
22
28TEST_F(ExecutionSpaceContextTest, sync_wait) {
29 const context_t esc{exec};
30
31 auto chain = stdexec::schedule(esc.get_scheduler());
32
34
35 ASSERT_THAT(
37 [chain = std::move(chain)]() mutable { // NOLINT(performance-move-const-arg)
38 const auto value = stdexec::sync_wait(std::move(chain)); // NOLINT(performance-move-const-arg)
39 static_assert(std::same_as<decltype(value), const std::optional<std::tuple<>>>);
40 ASSERT_TRUE(value.has_value());
41 }),
42 testing::ElementsAre(MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "sync_wait"))));
43
45}
46
48TEST_F(ExecutionSpaceContextTest, rethrows) {
49 const context_t esc{exec};
50
51 auto chain = stdexec::schedule(esc.get_scheduler()) | stdexec::then(Tests::Utils::Functors::ThrowsWhenCopied{});
52
53 ASSERT_THAT(
54 Tests::Utils::Functors::MutableMoveToSyncWait{.sndr = std::move(chain)},
55 testing::ThrowsMessage<std::runtime_error>(testing::StrEq("ThrowsWhenCopied: Throwing in copy constructor!")));
56}
57
58} // namespace Tests::ExecutionSpaceImpl
constexpr std::string dispatch_label(const Exec &, Label &&label)
Get the dispatch label from Exec and label.
#define MATCHER_FOR_BEGIN_FENCE(_exec_, _label_)
Tests::Utils::ExecutionSpaceContextTest< TEST_EXECUTION_SPACE > ExecutionSpaceContextTest
auto get_scheduler() const noexcept -> ExecutionSpaceImpl::Scheduler< Exec >
Kokkos::Execution::ExecutionSpaceContext< Exec > context_t
Definition context.hpp:25
This helper struct throws when copy constructed.