aboutsummaryrefslogtreecommitdiff
path: root/test/common/Event2Test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/common/Event2Test.cpp')
-rw-r--r--test/common/Event2Test.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/common/Event2Test.cpp b/test/common/Event2Test.cpp
new file mode 100644
index 00000000..f63a5347
--- /dev/null
+++ b/test/common/Event2Test.cpp
@@ -0,0 +1,19 @@
+#include "cru/common/Event2.h"
+
+#include <catch2/catch_test_macros.hpp>
+
+using cru::Event2;
+
+TEST_CASE("Event2 handlers should work.", "[event2]") {
+ Event2 event;
+
+ int counter = 0;
+
+ auto handler = [&counter] { counter++; };
+
+ event.AddHandler(handler);
+
+ event.Raise();
+
+ REQUIRE(counter == 1);
+}