GitHub Viewer
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include
#include
// --------------------------------------------------------
// Testcase: Conditional Tasking
// --------------------------------------------------------
TEST_CASE("Cond.Types" * doctest::timeout(300)) {
tf::Taskflow taskflow;
auto explicit_c = [](){
return 1;
};
auto implicit_c = []() -> int {
return 2;
};
auto explicit_task = taskflow.emplace(explicit_c);
auto implicit_task = taskflow.emplace(implicit_c);
static_assert(tf::is_condition_task_v);
static_assert(tf::is_condition_task_v);
REQUIRE(explicit_task.type() == tf::TaskType::CONDITION);
REQUIRE(implicit_task.type() == tf::TaskType::CONDITION);
}
void conditional_spawn(
std::atomic& counter,
const int max_depth,
int depth,
tf::Subflow& subflow
) {
if(depth < max_depth) {
for(int i=0; i