diff --git a/tests/unit_threadpool.cpp b/tests/unit_threadpool.cpp new file mode 100644 index 0000000..67bfe2a --- /dev/null +++ b/tests/unit_threadpool.cpp @@ -0,0 +1,24 @@ +#include +#include + +#include "daggy/ThreadPool.hpp" + +#include "catch.hpp" + +using namespace daggy; + +TEST_CASE("Threadpool Construction", "[threadpool]") { + std::atomic cnt(0); + ThreadPool tp(10); + + std::vector> res; + for (size_t i = 0; i < 100; ++i) { + res.push_back(tp.addTask([&cnt]() -> void { cnt++; return; })); + } + + for (auto & r : res) { + r.get(); + } + + REQUIRE(cnt == 100); +}