[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/EDMIG/cpp-taskflow/master/unittest/taskflow.cpp [Back]  [Original]

#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN

#include 

#include 
#include 
#include 
#include 
#include 

// --------------------------------------------------------
// Testcase: Executor
// --------------------------------------------------------
TEST_CASE("Executor" * doctest::timeout(300)) {

  SUBCASE("Empty Executor") {
    REQUIRE_THROWS(tf::Taskflow{nullptr});
  }

  SUBCASE("Default Executor") {
    tf::Taskflow tf1;
    tf::Taskflow tf2;
    REQUIRE(tf1.share_executor() != nullptr);
    REQUIRE(tf2.share_executor() != nullptr);
    REQUIRE(tf1.share_executor() != tf2.share_executor());
  }

  SUBCASE("Shared Executor") {
    tf::Taskflow tf1;
    tf::Taskflow tf2(tf1.share_executor());
    REQUIRE(tf1.share_executor() == tf2.share_executor());
  }

  SUBCASE("Custom Executor") {
    auto executor = std::make_shared(4);
    tf::Taskflow tf1(executor);
    tf::Taskflow tf2(executor);
    REQUIRE(executor != nullptr);
    REQUIRE(executor.use_count() == 3);
    auto e1 = tf1.share_executor();
    auto e2 = tf2.share_executor();
    REQUIRE(e1 == executor);
    REQUIRE(e2 == executor);
    REQUIRE(executor.use_count() == 5);
  }

  SUBCASE("Shared Dispatch") {
    
    for(int t=0; t

Web Proxy Viewer  |  New URL  |  Original Page