//===----------------------------------------------------------------------===// // // Part of CUDA Experimental in CUDA C++ Core Libraries, // under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. // //===----------------------------------------------------------------------===// #include #include "common/dummy_scheduler.cuh" #include "testing.cuh" // IWYU pragma: keep namespace ex = ::cuda::experimental::execution; struct not_a_receiver {}; struct a_receiver { using receiver_concept = ex::receiver_t; a_receiver(a_receiver&&) = default; void set_value(int) && noexcept {} void set_stopped() && noexcept {} }; C2H_TEST("tests for the receiver concepts", "[concepts]") { static_assert(!ex::receiver); static_assert(ex::receiver); using yes_completions = ex::completion_signatures; static_assert(ex::receiver_of); using no_completions = ex::completion_signatures; static_assert(!ex::receiver_of); } struct not_a_sender {}; struct a_sender { using sender_concept = ex::sender_t; template static constexpr auto get_completion_signatures() { return ex::completion_signatures{}; } }; struct non_constexpr_complsigs { using sender_concept = ex::sender_t; template _CCCL_HOST_DEVICE static auto get_completion_signatures() { return ex::completion_signatures{}; } }; C2H_TEST("tests for the sender concepts", "[concepts]") { static_assert(!ex::sender); static_assert(ex::sender); static_assert(ex::sender_in); static_assert(ex::sender_in>); static_assert(ex::sender); static_assert(!ex::sender_in); static_assert(!ex::sender_in>); [[maybe_unused]] auto read_env = ex::read_env(ex::get_scheduler); using read_env_t = decltype(read_env); static_assert(ex::sender); static_assert(!ex::sender_in); static_assert(!ex::sender_in>); static_assert(ex::sender_in>>); }