kokkos-execution 0.0.1
Loading...
Searching...
No Matches
test_sync_wait.cpp
Go to the documentation of this file.
3
9
21
23
24using namespace Kokkos::utils::callbacks;
25
37
42>());
43
45TEST_F(SyncWaitTest, sync_wait) {
46 const context_t esc{exec};
47
48 auto sndr = stdexec::schedule(esc.get_scheduler());
49
50 ASSERT_THAT(
51 recorder_listener_t::record([sndr = std::move(sndr)]() mutable { // NOLINT(performance-move-const-arg)
52 const auto value = stdexec::sync_wait(std::move(sndr)); // NOLINT(performance-move-const-arg)
53 static_assert(std::same_as<decltype(value), const std::optional<std::tuple<>>>);
54 ASSERT_TRUE(value.has_value());
55 }),
56 testing::IsEmpty());
57}
58
60TEST_F(SyncWaitTest, rethrows) {
61 const context_t esc{exec};
62
63 auto sndr = stdexec::schedule(esc.get_scheduler()) | stdexec::then(Tests::Utils::Functors::ThrowsWhenCopied{});
64
65 ASSERT_THAT(
66 Tests::Utils::Functors::MutableMoveToSyncWait{.sndr = std::move(sndr)},
67 testing::ThrowsMessage<std::runtime_error>(testing::StrEq("ThrowsWhenCopied: Throwing in copy constructor!")));
68}
69
70} // namespace Tests::ExecutionSpaceImpl
RecorderListener< EventDiscardMatcher< TEST_EXECUTION_SPACE >, BeginFenceEvent, Kokkos::Execution::Impl::RecordEvent, Kokkos::Execution::Impl::WaitEvent > recorder_listener_t
consteval bool check_nothrow_apply_sender()
Matcher to filter out events that are just noise for tests.
auto get_scheduler() const noexcept -> ExecutionSpaceImpl::Scheduler< Exec >
Event to be sent to Kokkos::utils::callbacks::dispatch when calling record.
Definition event.hpp:52
Event to be sent to Kokkos::utils::callbacks::dispatch when calling wait.
Definition event.hpp:73
decltype(stdexec::schedule(std::declval< scheduler_t >())) schedule_sender_t
Definition context.hpp:29
Kokkos::Execution::ExecutionSpaceContext< Exec > context_t
Definition context.hpp:27
This helper struct throws when copy constructed.