#include #include #include using namespace pls::internal::base; using namespace std; static bool visited; static int local_value_1; static vector local_value_two; TEST_CASE( "thread creation and joining", "[internal/base/thread.h]") { visited = false; auto t1 = create_thread([]() { visited = true; }, 0); t1.start(); t1.join(); REQUIRE(visited); } TEST_CASE( "thread state", "[internal/base/thread.h]") { auto t1 = create_thread([]() { local_value_1 = *this_thread::state(); }, 1); auto t2 = create_thread([]() { local_value_two = *this_thread::state>(); }, vector{1, 2}); t1.start(); t2.start(); t1.join(); t2.join(); REQUIRE(local_value_1 == 1); REQUIRE(local_value_two == vector{1, 2}); }