#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN #include #include #include // -------------------------------------------------------- // Testcase: Runtime.Schedule.ModuleTask // -------------------------------------------------------- TEST_CASE("Runtime.Schedule.ModuleTask" * doctest::timeout(300)) { tf::Taskflow tf; int value {0}; auto a = tf.emplace([&]() { value = -100; }).name("A"); auto module_task = tf.placeholder().name("module"); auto b = tf.emplace([&]() { value++; }).name("B"); auto c = tf.emplace([&]() { value++; }).name("C"); a.precede(module_task); module_task.precede(b); b.precede(c); tf::Taskflow module_flow; auto m1 = module_flow.emplace([&]() { value++; }).name("m1"); auto m2 = module_flow.emplace([&]() { value++; }).name("m2"); m1.precede(m2); module_task.composed_of(module_flow); auto entrypoint = tf.emplace([]() { return 0; }).name("entrypoint"); auto schedule = tf.emplace([&](tf::Runtime& runtime) { value++; runtime.schedule(module_task); }); entrypoint.precede(schedule, a); tf::Executor executor; executor.run(tf).wait(); REQUIRE(value == 5); } // -------------------------------------------------------- // Testcase: Runtime.ExternalGraph.Simple // -------------------------------------------------------- TEST_CASE("Runtime.ExternalGraph.Simple" * doctest::timeout(300)) { const size_t N = 100; tf::Executor executor; tf::Taskflow taskflow; std::vector results(N, 0); std::vector graphs(N); for(size_t i=0; i