#include <catch.hpp> #include <pls/internal/base/thread.h> #include <string> using namespace pls::internal::base; using namespace std; static bool visited; TEST_CASE( "thread creation and joining", "[internal/base/thread.h]") { visited = false; auto t1 = thread<int>::start([]() { visited = true; }, 0); t1.join(); REQUIRE(visited); } TEST_CASE( "thread state", "[internal/base/thread.h]") { auto t1 = thread<int>::start([]() { REQUIRE(thread<int>::get_current()->local_object_ == 1); }, 1); auto t2 = thread<string>::start([]() { REQUIRE(thread<string>::get_current()->local_object_ == "Hello"); }, "Hello"); t1.join(); t2.join(); }