17 #include <type_traits> 49 template <
class ExecutorRef>
68 [&](
auto) { signals += 100; },
69 [&](
auto)
noexcept { signals += 1000; },
70 [&]() { signals += 10; });
73 <<
"expected that the value and done signals are each recorded once";
77 auto v = tr_ |
op::transform([](
auto) {
return 42; }) | op::get<int>;
79 EXPECT_THAT(
v,
Eq(42)) <<
"expected that the result would be different";
84 std::function<void(::folly::pushmi::any_executor_ref<> exec)> recurse; 85 recurse = [&](::folly::pushmi::any_executor_ref<> tr) { 88 tr | op::submit(recurse); 90 tr_ | op::submit([&](auto exec) { recurse(exec); }); 92 EXPECT_THAT(counter, Eq(0)) 93 << "expected that all nested submissions complete"; 96 TEST_F(TrampolineExecutor, StaticDerecursion) { 97 int counter = 100'000;
102 <<
"expected that all nested submissions complete";
106 std::vector<std::string>
values;
117 values.push_back(folly::to<std::string>(
v));
121 <<
"expected that only the first item was pushed";
125 mi::executor_t<decltype(sender)>,
126 mi::executor_t<decltype(inlineon)>>::
value),
128 <<
"expected that executor was not changed by on";
132 std::vector<std::string>
values;
143 values.push_back(folly::to<std::string>(
v));
147 <<
"expected that only the first item was pushed";
151 mi::executor_t<decltype(sender)>,
152 mi::executor_t<decltype(inlinevia)>>::
value),
154 <<
"expected that executor was changed by via";
TEST_F(TrampolineExecutor, TransformAndSubmit)
auto on_value(Fns...fns) -> on_value_fn< Fns... >
detail::delegator< E > trampoline()
internal::EqMatcher< T > Eq(T x)
void operator()(ExecutorRef exec)
requires E e noexcept(noexcept(s.error(std::move(e))))
PUSHMI_INLINE_VAR constexpr detail::transform_fn transform
PUSHMI_INLINE_VAR constexpr detail::via_fn via
static const char *const value
#define EXPECT_THAT(value, matcher)
std::atomic< int > counter
PUSHMI_INLINE_VAR constexpr __adl::set_value_fn set_value
inline_executor_t inline_executor()
internal::ElementsAreMatcher< ::testing::tuple<> > ElementsAre()
PUSHMI_INLINE_VAR constexpr detail::on_fn on
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::make_single_sender_fn make_single_sender
std::vector< int > values(1'000)
PUSHMI_INLINE_VAR constexpr __adl::set_done_fn set_done