diff --git a/ShaderatorTests/barrier_tests.cpp b/ShaderatorTests/barrier_tests.cpp index 2823acc..3bd21e7 100644 --- a/ShaderatorTests/barrier_tests.cpp +++ b/ShaderatorTests/barrier_tests.cpp @@ -3,19 +3,19 @@ #include "gtest/gtest.h" #include #include +#include TEST(BarrierTests, 32_treads_are_properly_blocked) { int barrier_size = 32; Barrier barrier(barrier_size); - int beforeBarrier = 0; - int afterBarrier = 0; - + std::atomic beforeBarrier(0); + std::atomic afterBarrier(0); auto use_barrier = [&]() { beforeBarrier++; barrier.Wait(); - afterBarrier++; + afterBarrier++;// Atomic fetch add? }; std::vector threads; @@ -27,4 +27,7 @@ TEST(BarrierTests, 32_treads_are_properly_blocked) for (auto&& thread : threads) { thread.join(); } + + EXPECT_EQ(beforeBarrier.load(), barrier_size); + EXPECT_EQ(afterBarrier.load(), barrier_size); } \ No newline at end of file