diff options
Diffstat (limited to 'test/common/HandlerRegistryTest.cpp')
-rw-r--r-- | test/common/HandlerRegistryTest.cpp | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/test/common/HandlerRegistryTest.cpp b/test/common/HandlerRegistryTest.cpp deleted file mode 100644 index aacef70f..00000000 --- a/test/common/HandlerRegistryTest.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "cru/base/HandlerRegistry.h" - -#include <catch2/catch_test_macros.hpp> - -#include <algorithm> - -TEST_CASE("HandlerRegistry", "[handler_registry]") { - using namespace cru; - HandlerRegistry<void()> registry; - - int counter = 1; - - auto tag1 = registry.AddHandler([&counter] { counter++; }); - auto tag2 = registry.AddHandler([&counter] { counter++; }); - - for (const auto& handler : registry) { - handler(); - } - - REQUIRE(counter == 3); - - registry.RemoveHandler(tag1); - - for (const auto& handler : registry) { - handler(); - } - - REQUIRE(counter == 4); - - registry.RemoveHandler(tag2); - - for (const auto& handler : registry) { - handler(); - } - - REQUIRE(counter == 4); -} |