17 #include <type_traits> 42 TEST(EmptyNoArgSingleSender, TapAndSubmit) {
44 using E = decltype(e);
47 <<
"expected empty to return a single sender that can take an any_receiver";
52 [&]() { signals += 100; },
53 [&](
auto)
noexcept { signals += 1000; },
54 [&]() { signals += 10; }) |
56 [&]() { signals += 100; },
57 [&](
auto)
noexcept { signals += 1000; },
58 [&]() { signals += 10; });
61 <<
"expected the done signal to be recorded twice";
64 <<
"expected future_error when future_from is applied";
69 <<
"expected future_from(e) to return std::future<void>";
72 TEST(EmptyIntSingleSender, TapAndSubmit) {
73 auto e = op::empty<int>();
74 using E = decltype(e);
82 <<
"expected empty to return a single sender that can take an any_receiver<int>";
87 [&](
auto) { signals += 100; },
88 [&](
auto)
noexcept { signals += 1000; },
89 [&]() { signals += 10; }) |
91 [&](
auto) { signals += 100; },
92 [&](
auto)
noexcept { signals += 1000; },
93 [&]() { signals += 10; });
96 <<
"expected the done signal to be recorded twice";
98 EXPECT_THROW(v::future_from<int>(e).
get(), std::future_error)
99 <<
"expected future_error when future_from is applied";
102 (std::is_same<std::future<int>, decltype(v::future_from<int>(e))>::
value),
104 <<
"expected future_from(e) to return std::future<void>";
107 TEST(JustIntSingleSender, TransformAndSubmit) {
109 using J = decltype(j);
117 <<
"expected empty to return a single sender that can take an any_receiver<int>";
140 [&](
auto)
noexcept { signals += 1000; },
141 [&]() { signals += 10; });
144 <<
"expected that the transform signal is recorded twice and that the value and done signals once each";
148 auto twenty = v::future_from<int>(j).
get();
151 <<
"expected a different result from future_from(e).get()";
154 (std::is_same<std::future<int>, decltype(v::future_from<int>(j))>::value),
156 <<
"expected future_from(e) to return std::future<int>";
159 TEST(FromIntManySender, TransformAndSubmit) {
160 std::array<int, 3> arr{0, 9, 99};
162 using M = decltype(
m);
167 <<
"expected empty to return a many sender that can take an any_receiver<int>";
190 [&](
auto)
noexcept { signals += 1000; },
191 [&]() { signals += 10; });
194 <<
"expected that the transform signal is recorded six times and that the value signal three times and done signal once";
196 EXPECT_THAT(value,
Eq(222)) <<
"expected a different result";
#define EXPECT_THROW(statement, expected_exception)
internal::EqMatcher< T > Eq(T x)
PUSHMI_INLINE_VAR constexpr detail::tap_fn tap
TEST(EmptyNoArgSingleSender, TapAndSubmit)
requires E e noexcept(noexcept(s.error(std::move(e))))
PUSHMI_INLINE_VAR constexpr detail::transform_fn transform
constexpr auto empty(C const &c) -> decltype(c.empty())
requires SenderTo< In, std::promise< T >, is_single<> > std::future< T > future_from(In in)
static map< string, int > m
static const char *const value
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::operators::from_fn from
#define EXPECT_THAT(value, matcher)
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::operators::just_fn just