mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-02-04 08:59:07 +00:00
feat(core): add StormDestroy stub
This commit is contained in:
parent
982a89b6da
commit
02f5e26f36
14 changed files with 160 additions and 64 deletions
|
|
@ -1,25 +1,22 @@
|
|||
#include "test/Test.hpp"
|
||||
#include "storm/Core.hpp"
|
||||
#include "storm/Event.hpp"
|
||||
|
||||
#include <deque>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
void SEvtCleanExtraDataForTests();
|
||||
|
||||
|
||||
struct EventHandlerCalledWith {
|
||||
int handler;
|
||||
void* data;
|
||||
};
|
||||
|
||||
static std::deque<EventHandlerCalledWith> EventHandlerCallResults;
|
||||
extern std::deque<EventHandlerCalledWith> EventHandlerCallResults;
|
||||
|
||||
struct EventHandlerTest {
|
||||
EventHandlerTest() {
|
||||
EventHandlerCallResults.clear();
|
||||
SEvtDestroy();
|
||||
SEvtCleanExtraDataForTests();
|
||||
StormDestroy();
|
||||
}
|
||||
|
||||
static void RegisterCall(int handler, void* data) {
|
||||
|
|
@ -43,28 +40,14 @@ struct EventHandlerTest {
|
|||
};
|
||||
|
||||
|
||||
static void STORMAPI TestEventHandler1(void* data) {
|
||||
EventHandlerTest::RegisterCall(1, data);
|
||||
}
|
||||
|
||||
static void STORMAPI TestEventHandler2(void* data) {
|
||||
EventHandlerTest::RegisterCall(2, data);
|
||||
}
|
||||
|
||||
static void STORMAPI TestEventHandler3(void* data) {
|
||||
EventHandlerTest::RegisterCall(3, data);
|
||||
}
|
||||
|
||||
static void STORMAPI TestEventHandler4(void* data) {
|
||||
EventHandlerTest::RegisterCall(4, data);
|
||||
}
|
||||
void STORMAPI TestEventHandler1(void* data);
|
||||
void STORMAPI TestEventHandler2(void* data);
|
||||
void STORMAPI TestEventHandler3(void* data);
|
||||
void STORMAPI TestEventHandler4(void* data);
|
||||
|
||||
|
||||
// Helpers for comparing EventHandlerCalledWith structs
|
||||
std::ostream& operator <<(std::ostream& os, EventHandlerCalledWith const& value) {
|
||||
os << "{ TestEventHandler" << value.handler << ", " << value.data << " }";
|
||||
return os;
|
||||
}
|
||||
std::ostream& operator <<(std::ostream& os, EventHandlerCalledWith const& value);
|
||||
|
||||
template <class T>
|
||||
class EventHandlerCalledWithMatcher : public Catch::MatcherBase<T> {
|
||||
|
|
@ -85,6 +68,4 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
EventHandlerCalledWithMatcher<EventHandlerCalledWith> MatchesCall(EventHandlerCalledWith arg) {
|
||||
return { arg };
|
||||
}
|
||||
EventHandlerCalledWithMatcher<EventHandlerCalledWith> MatchesCall(EventHandlerCalledWith arg);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue