aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-30 16:41:22 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-30 16:41:22 +0100
commit2d5721820063031b65d64b1b2b1b4797b71935af (patch)
tree405a52da123cda5c2b6845328da8bf6d0621274b /src/test
parent7a07c56d572a6f30d0aa611bd566197bc04c3b33 (diff)
`make format`
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ECSTest.cpp3
-rw-r--r--src/test/EventTest.cpp6
-rw-r--r--src/test/ParticleTest.cpp3
-rw-r--r--src/test/PhysicsTest.cpp3
-rw-r--r--src/test/RenderSystemTest.cpp3
-rw-r--r--src/test/SceneManagerTest.cpp7
-rw-r--r--src/test/ScriptEventTest.cpp7
-rw-r--r--src/test/ScriptSceneTest.cpp3
-rw-r--r--src/test/ScriptTest.cpp3
-rw-r--r--src/test/ScriptTest.h8
10 files changed, 24 insertions, 22 deletions
diff --git a/src/test/ECSTest.cpp b/src/test/ECSTest.cpp
index 22c4fe7..3e6c61c 100644
--- a/src/test/ECSTest.cpp
+++ b/src/test/ECSTest.cpp
@@ -2,17 +2,18 @@
#define protected public
-#include <crepe/manager/ComponentManager.h>
#include <crepe/api/GameObject.h>
#include <crepe/api/Metadata.h>
#include <crepe/api/Transform.h>
#include <crepe/api/Vector2.h>
+#include <crepe/manager/ComponentManager.h>
using namespace std;
using namespace crepe;
class ECSTest : public ::testing::Test {
Mediator m;
+
public:
ComponentManager mgr{m};
};
diff --git a/src/test/EventTest.cpp b/src/test/EventTest.cpp
index 350dd07..dccd554 100644
--- a/src/test/EventTest.cpp
+++ b/src/test/EventTest.cpp
@@ -2,9 +2,9 @@
#include <gtest/gtest.h>
#include <crepe/api/Event.h>
-#include <crepe/manager/EventManager.h>
#include <crepe/api/IKeyListener.h>
#include <crepe/api/IMouseListener.h>
+#include <crepe/manager/EventManager.h>
using namespace std;
using namespace std::chrono_literals;
@@ -37,9 +37,7 @@ public:
};
TEST_F(EventManagerTest, EventSubscription) {
- EventHandler<KeyPressEvent> key_handler = [](const KeyPressEvent & e) {
- return true;
- };
+ EventHandler<KeyPressEvent> key_handler = [](const KeyPressEvent & e) { return true; };
// Subscribe to KeyPressEvent
EventManager::get_instance().subscribe<KeyPressEvent>(key_handler, 1);
diff --git a/src/test/ParticleTest.cpp b/src/test/ParticleTest.cpp
index 4e9fa4e..a659fe5 100644
--- a/src/test/ParticleTest.cpp
+++ b/src/test/ParticleTest.cpp
@@ -1,4 +1,3 @@
-#include <crepe/manager/ComponentManager.h>
#include <crepe/Particle.h>
#include <crepe/api/Config.h>
#include <crepe/api/GameObject.h>
@@ -7,6 +6,7 @@
#include <crepe/api/Sprite.h>
#include <crepe/api/Texture.h>
#include <crepe/api/Transform.h>
+#include <crepe/manager/ComponentManager.h>
#include <crepe/system/ParticleSystem.h>
#include <gtest/gtest.h>
#include <math.h>
@@ -17,6 +17,7 @@ using namespace crepe;
class ParticlesTest : public ::testing::Test {
Mediator m;
+
public:
ComponentManager component_manager{m};
ParticleSystem particle_system{m};
diff --git a/src/test/PhysicsTest.cpp b/src/test/PhysicsTest.cpp
index 01b7c51..43af8e4 100644
--- a/src/test/PhysicsTest.cpp
+++ b/src/test/PhysicsTest.cpp
@@ -1,8 +1,8 @@
-#include <crepe/manager/ComponentManager.h>
#include <crepe/api/Config.h>
#include <crepe/api/GameObject.h>
#include <crepe/api/Rigidbody.h>
#include <crepe/api/Transform.h>
+#include <crepe/manager/ComponentManager.h>
#include <crepe/system/PhysicsSystem.h>
#include <gtest/gtest.h>
@@ -12,6 +12,7 @@ using namespace crepe;
class PhysicsTest : public ::testing::Test {
Mediator m;
+
public:
ComponentManager component_manager{m};
PhysicsSystem system{m};
diff --git a/src/test/RenderSystemTest.cpp b/src/test/RenderSystemTest.cpp
index 3528e46..c105dcb 100644
--- a/src/test/RenderSystemTest.cpp
+++ b/src/test/RenderSystemTest.cpp
@@ -7,11 +7,11 @@
#define protected public
#include <crepe/api/Camera.h>
-#include <crepe/manager/ComponentManager.h>
#include <crepe/api/Color.h>
#include <crepe/api/GameObject.h>
#include <crepe/api/Sprite.h>
#include <crepe/api/Texture.h>
+#include <crepe/manager/ComponentManager.h>
#include <crepe/system/RenderSystem.h>
@@ -21,6 +21,7 @@ using namespace testing;
class RenderSystemTest : public Test {
Mediator m;
+
public:
ComponentManager mgr{m};
RenderSystem sys{m};
diff --git a/src/test/SceneManagerTest.cpp b/src/test/SceneManagerTest.cpp
index d027d89..9bb260c 100644
--- a/src/test/SceneManagerTest.cpp
+++ b/src/test/SceneManagerTest.cpp
@@ -1,13 +1,13 @@
#include <gtest/gtest.h>
-#include <crepe/types.h>
-#include <crepe/manager/SceneManager.h>
-#include <crepe/manager/ComponentManager.h>
#include <crepe/api/GameObject.h>
#include <crepe/api/Metadata.h>
#include <crepe/api/Scene.h>
#include <crepe/api/Transform.h>
#include <crepe/api/Vector2.h>
+#include <crepe/manager/ComponentManager.h>
+#include <crepe/manager/SceneManager.h>
+#include <crepe/types.h>
using namespace std;
using namespace crepe;
@@ -57,6 +57,7 @@ private:
class SceneManagerTest : public ::testing::Test {
Mediator m;
+
public:
ComponentManager component_mgr{m};
SceneManager scene_mgr{m};
diff --git a/src/test/ScriptEventTest.cpp b/src/test/ScriptEventTest.cpp
index 7a9abbb..5da31e7 100644
--- a/src/test/ScriptEventTest.cpp
+++ b/src/test/ScriptEventTest.cpp
@@ -4,13 +4,13 @@
#define private public
#define protected public
-#include <crepe/manager/ComponentManager.h>
-#include <crepe/manager/EventManager.h>
#include <crepe/api/BehaviorScript.h>
#include <crepe/api/Event.h>
#include <crepe/api/GameObject.h>
#include <crepe/api/Script.h>
#include <crepe/api/Vector2.h>
+#include <crepe/manager/ComponentManager.h>
+#include <crepe/manager/EventManager.h>
#include <crepe/system/ScriptSystem.h>
#include "ScriptTest.h"
@@ -32,7 +32,7 @@ TEST_F(ScriptEventTest, Inactive) {
EventManager & evmgr = this->event_manager;
unsigned event_count = 0;
- script.subscribe<MyEvent>([&](const MyEvent &){
+ script.subscribe<MyEvent>([&](const MyEvent &) {
event_count++;
return true;
});
@@ -48,4 +48,3 @@ TEST_F(ScriptEventTest, Inactive) {
evmgr.trigger_event<MyEvent>();
EXPECT_EQ(1, event_count);
}
-
diff --git a/src/test/ScriptSceneTest.cpp b/src/test/ScriptSceneTest.cpp
index f96ae8b..9ee1e52 100644
--- a/src/test/ScriptSceneTest.cpp
+++ b/src/test/ScriptSceneTest.cpp
@@ -4,8 +4,8 @@
#define private public
#define protected public
-#include <crepe/manager/SceneManager.h>
#include "ScriptTest.h"
+#include <crepe/manager/SceneManager.h>
using namespace std;
using namespace crepe;
@@ -28,4 +28,3 @@ TEST_F(ScriptSceneTest, Inactive) {
script.set_next_scene(non_default_value);
EXPECT_EQ(non_default_value, scene_manager.next_scene);
}
-
diff --git a/src/test/ScriptTest.cpp b/src/test/ScriptTest.cpp
index 6d0d5fb..1d2d6dd 100644
--- a/src/test/ScriptTest.cpp
+++ b/src/test/ScriptTest.cpp
@@ -1,5 +1,5 @@
-#include <gtest/gtest.h>
#include <gmock/gmock.h>
+#include <gtest/gtest.h>
// stupid hack to allow access to private/protected members under test
#define private public
@@ -75,4 +75,3 @@ TEST_F(ScriptTest, UpdateInactive) {
system.update();
}
}
-
diff --git a/src/test/ScriptTest.h b/src/test/ScriptTest.h
index 9a71ba7..1bbfdd3 100644
--- a/src/test/ScriptTest.h
+++ b/src/test/ScriptTest.h
@@ -1,22 +1,24 @@
#pragma once
-#include <gtest/gtest.h>
#include <gmock/gmock.h>
+#include <gtest/gtest.h>
-#include <crepe/manager/ComponentManager.h>
-#include <crepe/system/ScriptSystem.h>
#include <crepe/api/BehaviorScript.h>
#include <crepe/api/Script.h>
+#include <crepe/manager/ComponentManager.h>
+#include <crepe/system/ScriptSystem.h>
class ScriptTest : public testing::Test {
protected:
crepe::Mediator mediator;
+
public:
crepe::ComponentManager component_manager{mediator};
crepe::ScriptSystem system{mediator};
class MyScript : public crepe::Script {
// NOTE: explicitly stating `public:` is not required on actual scripts
+
public:
MOCK_METHOD(void, init, (), (override));
MOCK_METHOD(void, update, (), (override));