From df799bf394fa63dc9f39a5b09fe21c16b1cc8a57 Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 1 Jan 2024 22:20:21 +0800 Subject: NEED TEST: fix compile errors of Event2 and create init test. --- test/common/Event2Test.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/common/Event2Test.cpp (limited to 'test/common/Event2Test.cpp') 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 + +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); +} -- cgit v1.2.3