Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions test/exec/test_repeat_effect_until.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,22 @@ namespace {

REQUIRE(called);
}

TEST_CASE("repeat_effect_until works with bulk on a static_thread_pool", "[adaptors][repeat_n]") {
exec::static_thread_pool pool{2};
std::atomic<bool> failed{false};
const auto tid = std::this_thread::get_id();
bool called{false};
ex::sender auto snd = stdexec::on(
pool.get_scheduler(), ex::just() | ex::bulk(ex::par_unseq, 1024, [&](int index) noexcept {
if (tid == std::this_thread::get_id()) {
failed = true;
}
}) | ex::then([&] {
called = true;
return called;
}) | exec::repeat_effect_until());
stdexec::sync_wait(std::move(snd));
REQUIRE(called);
}
} // namespace
26 changes: 22 additions & 4 deletions test/exec/test_repeat_n.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,28 @@ namespace {
TEST_CASE("repeat_n works when changing threads", "[adaptors][repeat_n]") {
exec::static_thread_pool pool{2};
bool called{false};
sender auto snd = stdexec::on(pool.get_scheduler(), ex::just() | ex::then([&] {
called = true;
}) | exec::repeat_n(10));
stdexec::sync_wait(std::move(snd));
sender auto snd = ex::on(pool.get_scheduler(), ex::just() | ex::then([&] {
called = true;
}) | exec::repeat_n(10));
ex::sync_wait(std::move(snd));
REQUIRE(called);
}

TEST_CASE("repeat_n works with bulk on a static_thread_pool", "[adaptors][repeat_n]") {
exec::static_thread_pool pool{2};
std::atomic<bool> failed{false};
const auto tid = std::this_thread::get_id();
bool called{false};
sender auto snd =
ex::on(pool.get_scheduler(), ex::just() | ex::bulk(ex::par_unseq, 1024, [&](int) noexcept {
if (tid == std::this_thread::get_id()) {
failed = true;
}
}) | ex::then([&] {
called = true;
}) | exec::repeat_n(10));
ex::sync_wait(std::move(snd));
REQUIRE(called);
REQUIRE(!failed.load());
}
} // namespace
Loading