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
5 changes: 4 additions & 1 deletion include/stdexec/__detail/__bulk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@ namespace STDEXEC

STDEXEC_TRY
{
__state.__data_.__fun_(__shape_t(), __shape_t(__state.__data_.__shape_), __args...);
if (__shape_t{} < __state.__data_.__shape_)
{
__state.__data_.__fun_(__shape_t(), __shape_t(__state.__data_.__shape_), __args...);
}
STDEXEC::set_value(static_cast<_State&&>(__state).__rcvr_,
static_cast<_Args&&>(__args)...);
}
Expand Down
20 changes: 20 additions & 0 deletions test/stdexec/algos/adaptors/test_bulk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,26 @@ namespace
ex::start(op);
}

TEST_CASE("bulk_chunked function is not called with a zero shape", "[adaptors][bulk]")
{
int called{};

auto snd = ex::just() | ex::bulk_chunked(ex::seq, 0, [&called](int, int) { called++; });
ex::sync_wait(std::move(snd));

CHECK(called == 0);
}

TEST_CASE("bulk_chunked function is not called with a negative shape", "[adaptors][bulk]")
{
int called{};

auto snd = ex::just() | ex::bulk_chunked(ex::seq, -1, [&called](int, int) { called++; });
ex::sync_wait(std::move(snd));

CHECK(called == 0);
}

TEST_CASE("bulk_unchunked function in not called on stop", "[adaptors][bulk]")
{
constexpr int n = 2;
Expand Down
Loading