diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/common/CMakeLists.txt | 1 | ||||
-rw-r--r-- | test/common/Event2Test.cpp | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/test/common/CMakeLists.txt b/test/common/CMakeLists.txt index 602af819..f2fda47d 100644 --- a/test/common/CMakeLists.txt +++ b/test/common/CMakeLists.txt @@ -1,4 +1,5 @@ add_executable(CruBaseTest + Event2Test.cpp HandlerRegistryTest.cpp PropertyTreeTest.cpp SelfResolvableTest.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 <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); +} |