#include "engine/core/engine.hpp" #include "engine/core/engine_module.hpp" #include "engine/utils/rev_range.hpp" #include #include #include #include #include bool onInitWasCalled = false; bool onStartWasCalled = false; bool onUpdateWasCalled = false; bool onStopWasCalled = false; class TestModule : public MscEngineModule { public: std::string getName() const override { return "test_mod"; } std::uint16_t getRev() const override { return 1; } const std::unordered_map & getDependencies() const override { static const std::unordered_map deps{}; return deps; } void onInitialize(IMscEngineModuleAPI &engine) override { onInitWasCalled = true; } void onStart(IMscEngineModuleAPI &engine) override { onStartWasCalled = true; } void onUpdate(IMscEngineModuleAPI &engine, IMscEngineModuleAPI::clock::duration dt) override { onUpdateWasCalled = true; engine.requestStop(); } void onStop(IMscEngineModuleAPI &engine) override { onStopWasCalled = true; } void onDestory(IMscEngineModuleAPI &engine) override {} }; void testStates() { MscEngine engine({std::make_shared()}); engine.start(); assert(onInitWasCalled); assert(onStartWasCalled); assert(onUpdateWasCalled); assert(onStopWasCalled); } int main() { testStates(); return 0; }