feat: add event test

This commit is contained in:
2026-05-11 07:59:28 -03:00
parent 430cb5bc5b
commit 0fbf8c715c
+37
View File
@@ -0,0 +1,37 @@
#include "tests.h"
#include <seallib/events.h>
#include <string>
#include <iostream>
using namespace seallib;
class EventTest : ITest
{
public:
EventTest() : ITest() {};
virtual void run() override
{
Event<std::string> testEvent;
auto listener1 = testEvent.addListener(
[](std::string str) { std::cout << "(Listener 1) Event has been fired with string: " << str << std::endl; });
auto listener2 = testEvent.addListener(
[](std::string str) { std::cout << "(Listener 2) Event has been fired, string: " << str << std::endl; });
const char* str1 = "somestring";
testEvent.run(str1);
std::string str2("hello world");
testEvent.run(str2);
testEvent.removeListener(listener2);
testEvent.run("event without listener 2");
};
};
static EventTest g_eventTest;