35 #if __cpp_deduction_guides >= 201703 36 #define MAKE(x) x MAKE_ 40 #define MAKE(x) make_##x 45 static_assert(mi::Receiver<decltype(out0)>,
"out0 not a receiver");
47 static_assert(mi::Receiver<decltype(out1)>,
"out1 not a receiver");
49 static_assert(mi::Receiver<decltype(out2)>,
"out2 not a receiver");
51 static_assert(mi::Receiver<decltype(out3)>,
"out3 not a receiver");
53 static_assert(mi::Receiver<decltype(out4)>,
"out4 not a receiver");
55 static_assert(mi::Receiver<decltype(out5)>,
"out5 not a receiver");
58 static_assert(mi::Receiver<decltype(out6)>,
"out6 not a receiver");
60 static_assert(mi::Receiver<decltype(out7)>,
"out7 not a receiver");
62 using Out0 = decltype(out0);
64 auto proxy0 =
mi::MAKE(receiver)(out0);
65 static_assert(mi::Receiver<decltype(proxy0)>,
"proxy0 not a receiver");
67 static_assert(mi::Receiver<decltype(proxy1)>,
"proxy1 not a receiver");
70 static_assert(mi::Receiver<decltype(proxy2)>,
"proxy2 not a receiver");
73 static_assert(mi::Receiver<decltype(proxy3)>,
"proxy3 not a receiver");
76 ](Out0 & d,
auto e)
noexcept { d.error(e); }));
77 static_assert(mi::Receiver<decltype(proxy4)>,
"proxy4 not a receiver");
79 static_assert(mi::Receiver<decltype(proxy5)>,
"proxy5 not a receiver");
82 ](Out0&,
auto e)
noexcept { e.get(); }));
83 static_assert(mi::Receiver<decltype(proxy6)>,
"proxy6 not a receiver");
85 static_assert(mi::Receiver<decltype(proxy7)>,
"proxy7 not a receiver");
87 std::promise<void> p0;
91 std::promise<void> p1;
101 static_assert(mi::Receiver<decltype(out0)>,
"out0 not a receiver");
103 static_assert(mi::Receiver<decltype(out1)>,
"out1 not a receiver");
105 static_assert(mi::Receiver<decltype(out2)>,
"out2 not a receiver");
107 static_assert(mi::Receiver<decltype(out3)>,
"out3 not a receiver");
108 auto out4 =
mi::MAKE(receiver)([](
auto v) {
v.get(); });
109 static_assert(mi::Receiver<decltype(out4)>,
"out4 not a receiver");
115 static_assert(mi::Receiver<decltype(out5)>,
"out5 not a receiver");
118 static_assert(mi::Receiver<decltype(out6)>,
"out6 not a receiver");
120 static_assert(mi::Receiver<decltype(out7)>,
"out7 not a receiver");
122 using Out0 = decltype(out0);
124 auto proxy0 =
mi::MAKE(receiver)(out0);
125 static_assert(mi::Receiver<decltype(proxy0)>,
"proxy0 not a receiver");
127 static_assert(mi::Receiver<decltype(proxy1)>,
"proxy1 not a receiver");
130 static_assert(mi::Receiver<decltype(proxy2)>,
"proxy2 not a receiver");
133 static_assert(mi::Receiver<decltype(proxy3)>,
"proxy3 not a receiver");
136 static_assert(mi::Receiver<decltype(proxy4)>,
"proxy4 not a receiver");
141 ](Out0&,
auto e)
noexcept { e.get(); }));
142 static_assert(mi::Receiver<decltype(proxy5)>,
"proxy5 not a receiver");
145 ](Out0&,
auto e)
noexcept { e.get(); }));
146 static_assert(mi::Receiver<decltype(proxy6)>,
"proxy6 not a receiver");
148 static_assert(mi::Receiver<decltype(proxy7)>,
"proxy7 not a receiver");
150 std::promise<int> p0;
154 std::promise<int> p1;
164 static_assert(mi::Receiver<decltype(out0)>,
"out0 not a receiver");
166 static_assert(mi::Receiver<decltype(out1)>,
"out1 not a receiver");
168 static_assert(mi::Receiver<decltype(out2)>,
"out2 not a receiver");
170 static_assert(mi::Receiver<decltype(out3)>,
"out3 not a receiver");
171 auto out4 =
mi::MAKE(receiver)([](
auto v) {
v.get(); });
172 static_assert(mi::Receiver<decltype(out4)>,
"out4 not a receiver");
178 static_assert(mi::Receiver<decltype(out5)>,
"out5 not a receiver");
181 static_assert(mi::Receiver<decltype(out6)>,
"out6 not a receiver");
183 static_assert(mi::Receiver<decltype(out7)>,
"out7 not a receiver");
185 using Out0 = decltype(out0);
187 auto proxy0 =
mi::MAKE(receiver)(out0);
188 static_assert(mi::Receiver<decltype(proxy0)>,
"proxy0 not a receiver");
190 static_assert(mi::Receiver<decltype(proxy1)>,
"proxy1 not a receiver");
193 static_assert(mi::Receiver<decltype(proxy2)>,
"proxy2 not a receiver");
196 static_assert(mi::Receiver<decltype(proxy3)>,
"proxy3 not a receiver");
199 static_assert(mi::Receiver<decltype(proxy4)>,
"proxy4 not a receiver");
204 ](Out0&,
auto e)
noexcept { e.get(); }));
205 static_assert(mi::Receiver<decltype(proxy5)>,
"proxy5 not a receiver");
208 ](Out0&,
auto e)
noexcept { e.get(); }));
209 static_assert(mi::Receiver<decltype(proxy6)>,
"proxy6 not a receiver");
211 static_assert(mi::Receiver<decltype(proxy7)>,
"proxy7 not a receiver");
218 auto in0 =
mi::MAKE(single_sender)();
219 static_assert(mi::Sender<decltype(in0)>,
"in0 not a sender");
221 static_assert(mi::Sender<decltype(in1)>,
"in1 not a sender");
223 static_assert(mi::Sender<decltype(in2)>,
"in2 not a sender");
231 static_assert(mi::Sender<decltype(in3)>,
"in3 not a sender");
233 std::promise<int> p0;
245 mi::Executor<mi::executor_t<decltype(in0)>>,
246 "sender has invalid executor");
251 static_assert(mi::Sender<decltype(in0)>,
"in0 not a sender");
253 static_assert(mi::Sender<decltype(in1)>,
"in1 not a sender");
255 static_assert(mi::Sender<decltype(in2)>,
"in2 not a sender");
263 static_assert(mi::Sender<decltype(in3)>,
"in3 not a sender");
273 mi::Executor<mi::executor_t<decltype(in0)>>,
274 "sender has invalid executor");
278 auto in0 =
mi::MAKE(constrained_single_sender)();
279 static_assert(mi::Sender<decltype(in0)>,
"in0 not a sender");
281 static_assert(mi::Sender<decltype(in1)>,
"in1 not a sender");
282 auto in2 =
mi::MAKE(constrained_single_sender)(
284 static_assert(mi::Sender<decltype(in2)>,
"in2 not a sender");
285 auto in3 =
mi::MAKE(constrained_single_sender)(
286 [&](
auto c,
auto out) {
295 static_assert(mi::Sender<decltype(in3)>,
"in3 not a sender");
296 auto in4 =
mi::MAKE(constrained_single_sender)(
298 static_assert(mi::Sender<decltype(in4)>,
"in4 not a sender");
300 std::promise<int> p0;
302 in0.submit(in0.top(),
std::move(promise0));
307 in3.submit(in0.top(), out1);
314 mi::Executor<mi::executor_t<decltype(in0)>>,
315 "sender has invalid executor");
322 auto in0 =
mi::MAKE(time_single_sender)();
323 static_assert(mi::Sender<decltype(in0)>,
"in0 not a sender");
325 static_assert(mi::Sender<decltype(in1)>,
"in1 not a sender");
326 auto in2 =
mi::MAKE(time_single_sender)(
328 static_assert(mi::Sender<decltype(in2)>,
"in2 not a sender");
329 auto in3 =
mi::MAKE(time_single_sender)(
330 [&](
auto tp,
auto out) {
339 static_assert(mi::Sender<decltype(in3)>,
"in3 not a sender");
341 static_assert(mi::Sender<decltype(in4)>,
"in4 not a sender");
343 std::promise<int> p0;
345 in0.submit(in0.top(),
std::move(promise0));
350 in3.submit(in0.top(), out1);
354 std::chrono::system_clock::time_point,
358 mi::Executor<mi::executor_t<decltype(in0)>>,
359 "sender has invalid executor");
368 auto out0 =
mi::MAKE(flow_receiver)();
369 static_assert(mi::Receiver<decltype(out0)>,
"out0 not a receiver");
371 static_assert(mi::Receiver<decltype(out1)>,
"out1 not a receiver");
373 static_assert(mi::Receiver<decltype(out2)>,
"out2 not a receiver");
376 static_assert(mi::Receiver<decltype(out3)>,
"out3 not a receiver");
377 auto out4 =
mi::MAKE(flow_receiver)([](
auto v) {
v.get(); });
378 static_assert(mi::Receiver<decltype(out4)>,
"out4 not a receiver");
379 auto out5 =
mi::MAKE(flow_receiver)(
384 static_assert(mi::Receiver<decltype(out5)>,
"out5 not a receiver");
387 static_assert(mi::Receiver<decltype(out6)>,
"out6 not a receiver");
389 static_assert(mi::Receiver<decltype(out7)>,
"out7 not a receiver");
391 auto out8 =
mi::MAKE(flow_receiver)(
393 static_assert(mi::Receiver<decltype(out8)>,
"out8 not a receiver");
395 using Out0 = decltype(out0);
397 auto proxy0 =
mi::MAKE(flow_receiver)(out0);
398 static_assert(mi::Receiver<decltype(proxy0)>,
"proxy0 not a receiver");
400 static_assert(mi::Receiver<decltype(proxy1)>,
"proxy1 not a receiver");
402 static_assert(mi::Receiver<decltype(proxy2)>,
"proxy2 not a receiver");
403 auto proxy3 =
mi::MAKE(flow_receiver)(
405 static_assert(mi::Receiver<decltype(proxy3)>,
"proxy3 not a receiver");
406 auto proxy4 =
mi::MAKE(flow_receiver)(
408 static_assert(mi::Receiver<decltype(proxy4)>,
"proxy4 not a receiver");
409 auto proxy5 =
mi::MAKE(flow_receiver)(
413 ](Out0&,
auto e)
noexcept { e.get(); }));
414 static_assert(mi::Receiver<decltype(proxy5)>,
"proxy5 not a receiver");
415 auto proxy6 =
mi::MAKE(flow_receiver)(
417 ](Out0&,
auto e)
noexcept { e.get(); }));
418 static_assert(mi::Receiver<decltype(proxy6)>,
"proxy6 not a receiver");
420 static_assert(mi::Receiver<decltype(proxy7)>,
"proxy7 not a receiver");
422 auto proxy8 =
mi::MAKE(flow_receiver)(
424 static_assert(mi::Receiver<decltype(proxy8)>,
"proxy8 not a receiver");
439 auto out0 =
mi::MAKE(flow_receiver)();
440 static_assert(mi::Receiver<decltype(out0)>,
"out0 not a receiver");
442 static_assert(mi::Receiver<decltype(out1)>,
"out1 not a receiver");
444 static_assert(mi::Receiver<decltype(out2)>,
"out2 not a receiver");
447 static_assert(mi::Receiver<decltype(out3)>,
"out3 not a receiver");
448 auto out4 =
mi::MAKE(flow_receiver)([](
auto v) {
v.get(); });
449 static_assert(mi::Receiver<decltype(out4)>,
"out4 not a receiver");
450 auto out5 =
mi::MAKE(flow_receiver)(
455 static_assert(mi::Receiver<decltype(out5)>,
"out5 not a receiver");
458 static_assert(mi::Receiver<decltype(out6)>,
"out6 not a receiver");
460 static_assert(mi::Receiver<decltype(out7)>,
"out7 not a receiver");
462 auto out8 =
mi::MAKE(flow_receiver)(
464 static_assert(mi::Receiver<decltype(out8)>,
"out8 not a receiver");
466 using Out0 = decltype(out0);
468 auto proxy0 =
mi::MAKE(flow_receiver)(out0);
469 static_assert(mi::Receiver<decltype(proxy0)>,
"proxy0 not a receiver");
471 static_assert(mi::Receiver<decltype(proxy1)>,
"proxy1 not a receiver");
473 static_assert(mi::Receiver<decltype(proxy2)>,
"proxy2 not a receiver");
474 auto proxy3 =
mi::MAKE(flow_receiver)(
476 static_assert(mi::Receiver<decltype(proxy3)>,
"proxy3 not a receiver");
477 auto proxy4 =
mi::MAKE(flow_receiver)(
479 static_assert(mi::Receiver<decltype(proxy4)>,
"proxy4 not a receiver");
480 auto proxy5 =
mi::MAKE(flow_receiver)(
484 ](Out0&,
auto e)
noexcept { e.get(); }));
485 static_assert(mi::Receiver<decltype(proxy5)>,
"proxy5 not a receiver");
486 auto proxy6 =
mi::MAKE(flow_receiver)(
488 ](Out0&,
auto e)
noexcept { e.get(); }));
489 static_assert(mi::Receiver<decltype(proxy6)>,
"proxy6 not a receiver");
491 static_assert(mi::Receiver<decltype(proxy7)>,
"proxy7 not a receiver");
493 auto proxy8 =
mi::MAKE(flow_receiver)(
495 static_assert(mi::Receiver<decltype(proxy8)>,
"proxy8 not a receiver");
510 auto in0 =
mi::MAKE(flow_single_sender)();
511 static_assert(mi::Sender<decltype(in0)>,
"in0 not a sender");
513 static_assert(mi::Sender<decltype(in1)>,
"in1 not a sender");
515 static_assert(mi::Sender<decltype(in2)>,
"in2 not a sender");
516 auto in3 =
mi::MAKE(flow_single_sender)(
523 static_assert(mi::Sender<decltype(in3)>,
"in3 not a sender");
525 auto out0 =
mi::MAKE(flow_receiver)();
526 auto out1 =
mi::MAKE(flow_receiver)(
535 mi::Executor<mi::executor_t<decltype(in0)>>,
536 "sender has invalid executor");
540 auto in0 =
mi::MAKE(flow_many_sender)();
541 static_assert(mi::Sender<decltype(in0)>,
"in0 not a sender");
543 static_assert(mi::Sender<decltype(in1)>,
"in1 not a sender");
545 static_assert(mi::Sender<decltype(in2)>,
"in2 not a sender");
546 auto in3 =
mi::MAKE(flow_many_sender)(
553 static_assert(mi::Sender<decltype(in3)>,
"in3 not a sender");
555 auto out0 =
mi::MAKE(flow_receiver)();
556 auto out1 =
mi::MAKE(flow_receiver)(
567 mi::Executor<mi::executor_t<decltype(in0)>>,
568 "sender has invalid executor");
void flow_single_sender_test()
auto on_value(Fns...fns) -> on_value_fn< Fns... >
detail::delegator< E > trampoline()
std::chrono::steady_clock::time_point now()
constexpr detail::Map< Move > move
auto on_error(Fns...fns) -> on_error_fn< Fns... >
requires E e noexcept(noexcept(s.error(std::move(e))))
inline_constrained_executor_t inline_constrained_executor()
void flow_receiver_1_test()
PUSHMI_INLINE_VAR constexpr detail::blocking_submit_fn blocking_submit
void flow_many_sender_test()
void flow_receiver_n_test()
PUSHMI_INLINE_VAR constexpr detail::submit_at_fn submit_at
void single_sender_test()
auto on_done(Fn fn) -> on_done_fn< Fn >
PUSHMI_INLINE_VAR constexpr __adl::set_value_fn set_value
void constrained_single_sender_test()
void time_single_sender_test()
inline_time_executor_t inline_time_executor()
PUSHMI_INLINE_VAR constexpr detail::submit_after_fn submit_after
TEST(SequencedExecutor, CPUThreadPoolExecutor)