aboutsummaryrefslogtreecommitdiff
path: root/test/common/HandlerRegistryTest.cpp
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-09-03 12:42:10 +0800
committerYuqian Yang <crupest@crupest.life>2025-09-03 12:42:10 +0800
commitefa1266f10e90c0c46f47cc06645422142cb2d9f (patch)
tree3d8cfefb81ce4645d150c08fc52ad646b6da80e2 /test/common/HandlerRegistryTest.cpp
parent5e59a8e38c9f8992e6ffd9dbbde11e1f873780e1 (diff)
downloadcru-efa1266f10e90c0c46f47cc06645422142cb2d9f.tar.gz
cru-efa1266f10e90c0c46f47cc06645422142cb2d9f.tar.bz2
cru-efa1266f10e90c0c46f47cc06645422142cb2d9f.zip
common -> base in test dir.
Diffstat (limited to 'test/common/HandlerRegistryTest.cpp')
-rw-r--r--test/common/HandlerRegistryTest.cpp37
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);
-}