From 6fd7cec7d4bbf5aeb361b3f1337671bb0f9af61b Mon Sep 17 00:00:00 2001
From: Loek Le Blansch <loek@pipeframe.xyz>
Date: Thu, 28 Nov 2024 10:13:11 +0100
Subject: manager mediator refactor

---
 src/test/ScriptTest.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

(limited to 'src/test/ScriptTest.cpp')

diff --git a/src/test/ScriptTest.cpp b/src/test/ScriptTest.cpp
index 78d5061..3187ed2 100644
--- a/src/test/ScriptTest.cpp
+++ b/src/test/ScriptTest.cpp
@@ -4,10 +4,10 @@
 #define private public
 #define protected public
 
-#include <crepe/ComponentManager.h>
+#include <crepe/manager/ComponentManager.h>
+#include <crepe/manager/EventManager.h>
 #include <crepe/api/BehaviorScript.h>
 #include <crepe/api/Event.h>
-#include <crepe/api/EventManager.h>
 #include <crepe/api/GameObject.h>
 #include <crepe/api/Script.h>
 #include <crepe/api/Vector2.h>
@@ -20,10 +20,11 @@ using namespace testing;
 class MyEvent : public Event {};
 
 class ScriptTest : public Test {
+	Mediator m;
 public:
-	ComponentManager component_manager{};
-	ScriptSystem system{component_manager};
-	EventManager & event_manager = EventManager::get_instance();
+	ComponentManager component_manager{m};
+	ScriptSystem system{m};
+	EventManager & event_manager = m.event_manager;
 
 	class MyScript : public Script {
 		// NOTE: default (private) visibility of init and update shouldn't cause
-- 
cgit v1.2.3


From 42d4cdbd12fbe8ddc77e4c6600fe8aae4e9298ad Mon Sep 17 00:00:00 2001
From: Loek Le Blansch <loek@pipeframe.xyz>
Date: Thu, 28 Nov 2024 11:03:48 +0100
Subject: split up script tests

---
 src/CMakeLists.txt           |   1 +
 src/test/CMakeLists.txt      |   1 +
 src/test/EventTest.cpp       |   1 -
 src/test/ScriptEventTest.cpp |  71 ++++++++++++++++++++++++++++
 src/test/ScriptTest.cpp      | 107 +++++++++++++++----------------------------
 5 files changed, 111 insertions(+), 70 deletions(-)
 create mode 100644 src/test/ScriptEventTest.cpp

(limited to 'src/test/ScriptTest.cpp')

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c3f29da..97b21f0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -40,5 +40,6 @@ install(
 
 target_link_libraries(test_main
 	PRIVATE gtest
+	PRIVATE gmock
 	PUBLIC crepe
 )
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
index d310f6a..7b03a5f 100644
--- a/src/test/CMakeLists.txt
+++ b/src/test/CMakeLists.txt
@@ -12,4 +12,5 @@ target_sources(test_main PUBLIC
 	ValueBrokerTest.cpp
 	DBTest.cpp
 	Vector2Test.cpp
+	ScriptEventTest.cpp
 )
diff --git a/src/test/EventTest.cpp b/src/test/EventTest.cpp
index f232027..350dd07 100644
--- a/src/test/EventTest.cpp
+++ b/src/test/EventTest.cpp
@@ -38,7 +38,6 @@ public:
 
 TEST_F(EventManagerTest, EventSubscription) {
 	EventHandler<KeyPressEvent> key_handler = [](const KeyPressEvent & e) {
-		std::cout << "Key Event Triggered" << std::endl;
 		return true;
 	};
 
diff --git a/src/test/ScriptEventTest.cpp b/src/test/ScriptEventTest.cpp
new file mode 100644
index 0000000..ab7dd35
--- /dev/null
+++ b/src/test/ScriptEventTest.cpp
@@ -0,0 +1,71 @@
+#include <gtest/gtest.h>
+
+// stupid hack to allow access to private/protected members under test
+#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/system/ScriptSystem.h>
+
+using namespace std;
+using namespace crepe;
+using namespace testing;
+
+class ScriptEventTest : public Test {
+	Mediator m;
+public:
+	ComponentManager component_manager{m};
+	ScriptSystem system{m};
+	EventManager & event_manager = m.event_manager;
+
+	class MyEvent : public Event {};
+	class MyScript : public Script {};
+
+	OptionalRef<BehaviorScript> behaviorscript;
+	OptionalRef<MyScript> script;
+
+	void SetUp() override {
+		auto & mgr = this->component_manager;
+		GameObject entity = mgr.new_object("name");
+		BehaviorScript & component = entity.add_component<BehaviorScript>();
+
+		this->behaviorscript = component;
+		ASSERT_TRUE(this->behaviorscript);
+		EXPECT_EQ(component.script.get(), nullptr);
+		component.set_script<MyScript>();
+		ASSERT_NE(component.script.get(), nullptr);
+
+		this->script = *(MyScript *) component.script.get();
+		ASSERT_TRUE(this->script);
+	}
+};
+
+TEST_F(ScriptEventTest, Inactive) {
+	BehaviorScript & behaviorscript = this->behaviorscript;
+	MyScript & script = this->script;
+	EventManager & evmgr = this->event_manager;
+
+	unsigned event_count = 0;
+	script.subscribe<MyEvent>([&](const MyEvent &){
+		event_count++;
+		return true;
+	});
+
+	system.update();
+	behaviorscript.active = false;
+	EXPECT_EQ(0, event_count);
+
+	evmgr.trigger_event<MyEvent>();
+	EXPECT_EQ(0, event_count);
+
+	behaviorscript.active = true;
+	evmgr.trigger_event<MyEvent>();
+	EXPECT_EQ(1, event_count);
+}
+
diff --git a/src/test/ScriptTest.cpp b/src/test/ScriptTest.cpp
index 3187ed2..fabf127 100644
--- a/src/test/ScriptTest.cpp
+++ b/src/test/ScriptTest.cpp
@@ -1,24 +1,20 @@
 #include <gtest/gtest.h>
+#include <gmock/gmock.h>
 
 // stupid hack to allow access to private/protected members under test
 #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/system/ScriptSystem.h>
 
 using namespace std;
 using namespace crepe;
 using namespace testing;
 
-class MyEvent : public Event {};
-
 class ScriptTest : public Test {
 	Mediator m;
 public:
@@ -27,25 +23,10 @@ public:
 	EventManager & event_manager = m.event_manager;
 
 	class MyScript : public Script {
-		// NOTE: default (private) visibility of init and update shouldn't cause
-		// issues!
-		void init() {
-			this->init_count++;
-
-			subscribe<MyEvent>([this](const MyEvent &) {
-				this->event_count++;
-				return true;
-			});
-
-			// init should never be called more than once
-			EXPECT_LE(this->init_count, 1);
-		}
-		void update() { this->update_count++; }
-
+		// NOTE: explicitly stating `public:` is not required on actual scripts
 	public:
-		unsigned init_count = 0;
-		unsigned update_count = 0;
-		unsigned event_count = 0;
+		MOCK_METHOD(void, init, (), (override));
+		MOCK_METHOD(void, update, (), (override));
 	};
 
 	OptionalRef<BehaviorScript> behaviorscript;
@@ -64,67 +45,55 @@ public:
 
 		this->script = *(MyScript *) component.script.get();
 		ASSERT_TRUE(this->script);
-
-		// sanity
-		MyScript & script = this->script;
-		ASSERT_EQ(script.init_count, 0);
-		ASSERT_EQ(script.update_count, 0);
-		ASSERT_EQ(script.event_count, 0);
 	}
 };
 
 TEST_F(ScriptTest, Default) {
 	MyScript & script = this->script;
-	EXPECT_EQ(0, script.init_count);
-	EXPECT_EQ(0, script.update_count);
-	EXPECT_EQ(0, script.event_count);
+	EXPECT_CALL(script, init()).Times(0);
+	EXPECT_CALL(script, update()).Times(0);
 }
 
 TEST_F(ScriptTest, UpdateOnce) {
 	MyScript & script = this->script;
 
-	system.update();
-	EXPECT_EQ(1, script.init_count);
-	EXPECT_EQ(1, script.update_count);
-	EXPECT_EQ(0, script.event_count);
+	{
+		InSequence seq;
+
+		EXPECT_CALL(script, init()).Times(1);
+		EXPECT_CALL(script, update()).Times(1);
+		system.update();
+	}
+
+	{
+		InSequence seq;
+
+		EXPECT_CALL(script, init()).Times(0);
+		EXPECT_CALL(script, update()).Times(1);
+		system.update();
+	}
 }
 
 TEST_F(ScriptTest, UpdateInactive) {
 	BehaviorScript & behaviorscript = this->behaviorscript;
 	MyScript & script = this->script;
 
-	behaviorscript.active = false;
-	system.update();
-	EXPECT_EQ(0, script.init_count);
-	EXPECT_EQ(0, script.update_count);
-	EXPECT_EQ(0, script.event_count);
-
-	behaviorscript.active = true;
-	system.update();
-	EXPECT_EQ(1, script.init_count);
-	EXPECT_EQ(1, script.update_count);
-	EXPECT_EQ(0, script.event_count);
-}
+	{
+		InSequence seq;
 
-TEST_F(ScriptTest, EventInactive) {
-	BehaviorScript & behaviorscript = this->behaviorscript;
-	MyScript & script = this->script;
-	EventManager & evmgr = this->event_manager;
-
-	system.update();
-	behaviorscript.active = false;
-	EXPECT_EQ(1, script.init_count);
-	EXPECT_EQ(1, script.update_count);
-	EXPECT_EQ(0, script.event_count);
-
-	evmgr.trigger_event<MyEvent>();
-	EXPECT_EQ(1, script.init_count);
-	EXPECT_EQ(1, script.update_count);
-	EXPECT_EQ(0, script.event_count);
-
-	behaviorscript.active = true;
-	evmgr.trigger_event<MyEvent>();
-	EXPECT_EQ(1, script.init_count);
-	EXPECT_EQ(1, script.update_count);
-	EXPECT_EQ(1, script.event_count);
+		EXPECT_CALL(script, init()).Times(0);
+		EXPECT_CALL(script, update()).Times(0);
+		behaviorscript.active = false;
+		system.update();
+	}
+
+	{
+		InSequence seq;
+
+		EXPECT_CALL(script, init()).Times(1);
+		EXPECT_CALL(script, update()).Times(1);
+		behaviorscript.active = true;
+		system.update();
+	}
 }
+
-- 
cgit v1.2.3


From 2a2a3391ff0b449602825c3182af33c2ff52abc0 Mon Sep 17 00:00:00 2001
From: Loek Le Blansch <loek@pipeframe.xyz>
Date: Thu, 28 Nov 2024 11:19:33 +0100
Subject: add test for Script::set_next_scene

---
 src/test/CMakeLists.txt      |  1 +
 src/test/ScriptEventTest.cpp | 28 ++++--------------------
 src/test/ScriptSceneTest.cpp | 31 +++++++++++++++++++++++++++
 src/test/ScriptTest.cpp      | 51 +++++++++++++-------------------------------
 src/test/ScriptTest.h        | 29 +++++++++++++++++++++++++
 5 files changed, 80 insertions(+), 60 deletions(-)
 create mode 100644 src/test/ScriptSceneTest.cpp
 create mode 100644 src/test/ScriptTest.h

(limited to 'src/test/ScriptTest.cpp')

diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
index 7b03a5f..d3e27b0 100644
--- a/src/test/CMakeLists.txt
+++ b/src/test/CMakeLists.txt
@@ -13,4 +13,5 @@ target_sources(test_main PUBLIC
 	DBTest.cpp
 	Vector2Test.cpp
 	ScriptEventTest.cpp
+	ScriptSceneTest.cpp
 )
diff --git a/src/test/ScriptEventTest.cpp b/src/test/ScriptEventTest.cpp
index ab7dd35..7a9abbb 100644
--- a/src/test/ScriptEventTest.cpp
+++ b/src/test/ScriptEventTest.cpp
@@ -13,37 +13,17 @@
 #include <crepe/api/Vector2.h>
 #include <crepe/system/ScriptSystem.h>
 
+#include "ScriptTest.h"
+
 using namespace std;
 using namespace crepe;
 using namespace testing;
 
-class ScriptEventTest : public Test {
-	Mediator m;
+class ScriptEventTest : public ScriptTest {
 public:
-	ComponentManager component_manager{m};
-	ScriptSystem system{m};
-	EventManager & event_manager = m.event_manager;
+	EventManager & event_manager = mediator.event_manager;
 
 	class MyEvent : public Event {};
-	class MyScript : public Script {};
-
-	OptionalRef<BehaviorScript> behaviorscript;
-	OptionalRef<MyScript> script;
-
-	void SetUp() override {
-		auto & mgr = this->component_manager;
-		GameObject entity = mgr.new_object("name");
-		BehaviorScript & component = entity.add_component<BehaviorScript>();
-
-		this->behaviorscript = component;
-		ASSERT_TRUE(this->behaviorscript);
-		EXPECT_EQ(component.script.get(), nullptr);
-		component.set_script<MyScript>();
-		ASSERT_NE(component.script.get(), nullptr);
-
-		this->script = *(MyScript *) component.script.get();
-		ASSERT_TRUE(this->script);
-	}
 };
 
 TEST_F(ScriptEventTest, Inactive) {
diff --git a/src/test/ScriptSceneTest.cpp b/src/test/ScriptSceneTest.cpp
new file mode 100644
index 0000000..f96ae8b
--- /dev/null
+++ b/src/test/ScriptSceneTest.cpp
@@ -0,0 +1,31 @@
+#include <gtest/gtest.h>
+
+// stupid hack to allow access to private/protected members under test
+#define private public
+#define protected public
+
+#include <crepe/manager/SceneManager.h>
+#include "ScriptTest.h"
+
+using namespace std;
+using namespace crepe;
+using namespace testing;
+
+class ScriptSceneTest : public ScriptTest {
+public:
+	SceneManager scene_manager{mediator};
+
+	class MyScene : public Scene {};
+};
+
+TEST_F(ScriptSceneTest, Inactive) {
+	BehaviorScript & behaviorscript = this->behaviorscript;
+	MyScript & script = this->script;
+
+	const char * non_default_value = "foo";
+	ASSERT_NE(non_default_value, scene_manager.next_scene);
+
+	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 fabf127..6d0d5fb 100644
--- a/src/test/ScriptTest.cpp
+++ b/src/test/ScriptTest.cpp
@@ -5,48 +5,27 @@
 #define private public
 #define protected public
 
-#include <crepe/manager/ComponentManager.h>
-#include <crepe/api/BehaviorScript.h>
+#include "ScriptTest.h"
 #include <crepe/api/GameObject.h>
-#include <crepe/api/Script.h>
-#include <crepe/system/ScriptSystem.h>
 
 using namespace std;
 using namespace crepe;
 using namespace testing;
 
-class ScriptTest : public Test {
-	Mediator m;
-public:
-	ComponentManager component_manager{m};
-	ScriptSystem system{m};
-	EventManager & event_manager = m.event_manager;
-
-	class MyScript : public Script {
-		// NOTE: explicitly stating `public:` is not required on actual scripts
-	public:
-		MOCK_METHOD(void, init, (), (override));
-		MOCK_METHOD(void, update, (), (override));
-	};
-
-	OptionalRef<BehaviorScript> behaviorscript;
-	OptionalRef<MyScript> script;
-
-	void SetUp() override {
-		auto & mgr = this->component_manager;
-		GameObject entity = mgr.new_object("name");
-		BehaviorScript & component = entity.add_component<BehaviorScript>();
-
-		this->behaviorscript = component;
-		ASSERT_TRUE(this->behaviorscript);
-		EXPECT_EQ(component.script.get(), nullptr);
-		component.set_script<MyScript>();
-		ASSERT_NE(component.script.get(), nullptr);
-
-		this->script = *(MyScript *) component.script.get();
-		ASSERT_TRUE(this->script);
-	}
-};
+void ScriptTest::SetUp() {
+	auto & mgr = this->component_manager;
+	GameObject entity = mgr.new_object("name");
+	BehaviorScript & component = entity.add_component<BehaviorScript>();
+
+	this->behaviorscript = component;
+	ASSERT_TRUE(this->behaviorscript);
+	EXPECT_EQ(component.script.get(), nullptr);
+	component.set_script<NiceMock<MyScript>>();
+	ASSERT_NE(component.script.get(), nullptr);
+
+	this->script = *(MyScript *) component.script.get();
+	ASSERT_TRUE(this->script);
+}
 
 TEST_F(ScriptTest, Default) {
 	MyScript & script = this->script;
diff --git a/src/test/ScriptTest.h b/src/test/ScriptTest.h
new file mode 100644
index 0000000..9a71ba7
--- /dev/null
+++ b/src/test/ScriptTest.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include <crepe/manager/ComponentManager.h>
+#include <crepe/system/ScriptSystem.h>
+#include <crepe/api/BehaviorScript.h>
+#include <crepe/api/Script.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));
+	};
+
+	crepe::OptionalRef<crepe::BehaviorScript> behaviorscript;
+	crepe::OptionalRef<MyScript> script;
+
+	virtual void SetUp();
+};
-- 
cgit v1.2.3


From 2d5721820063031b65d64b1b2b1b4797b71935af Mon Sep 17 00:00:00 2001
From: Loek Le Blansch <loek@pipeframe.xyz>
Date: Sat, 30 Nov 2024 16:41:22 +0100
Subject: `make format`

---
 src/crepe/api/LoopManager.cpp          | 5 +----
 src/crepe/api/LoopManager.h            | 2 +-
 src/crepe/api/Scene.h                  | 3 ++-
 src/crepe/api/Script.cpp               | 1 -
 src/crepe/api/Script.h                 | 4 ++--
 src/crepe/manager/ComponentManager.cpp | 2 +-
 src/crepe/manager/Manager.cpp          | 3 +--
 src/crepe/manager/Manager.h            | 3 +--
 src/crepe/manager/Mediator.h           | 4 ++--
 src/crepe/manager/SaveManager.cpp      | 4 ++--
 src/crepe/system/PhysicsSystem.cpp     | 2 +-
 src/crepe/system/RenderSystem.cpp      | 2 +-
 src/crepe/system/ScriptSystem.cpp      | 2 +-
 src/test/ECSTest.cpp                   | 3 ++-
 src/test/EventTest.cpp                 | 6 ++----
 src/test/ParticleTest.cpp              | 3 ++-
 src/test/PhysicsTest.cpp               | 3 ++-
 src/test/RenderSystemTest.cpp          | 3 ++-
 src/test/SceneManagerTest.cpp          | 7 ++++---
 src/test/ScriptEventTest.cpp           | 7 +++----
 src/test/ScriptSceneTest.cpp           | 3 +--
 src/test/ScriptTest.cpp                | 3 +--
 src/test/ScriptTest.h                  | 8 +++++---
 23 files changed, 40 insertions(+), 43 deletions(-)

(limited to 'src/test/ScriptTest.cpp')

diff --git a/src/crepe/api/LoopManager.cpp b/src/crepe/api/LoopManager.cpp
index b277185..731cfb7 100644
--- a/src/crepe/api/LoopManager.cpp
+++ b/src/crepe/api/LoopManager.cpp
@@ -22,9 +22,7 @@ LoopManager::LoopManager() {
 	this->load_system<ScriptSystem>();
 }
 
-void LoopManager::process_input() {
-	this->sdl_context.handle_events(this->game_running);
-}
+void LoopManager::process_input() { this->sdl_context.handle_events(this->game_running); }
 
 void LoopManager::start() {
 	this->setup();
@@ -69,4 +67,3 @@ void LoopManager::render() {
 }
 
 void LoopManager::update() {}
-
diff --git a/src/crepe/api/LoopManager.h b/src/crepe/api/LoopManager.h
index 6ea5ccc..d8910a0 100644
--- a/src/crepe/api/LoopManager.h
+++ b/src/crepe/api/LoopManager.h
@@ -2,10 +2,10 @@
 
 #include <memory>
 
+#include "../facade/SDLContext.h"
 #include "../manager/ComponentManager.h"
 #include "../manager/SceneManager.h"
 #include "../system/System.h"
-#include "../facade/SDLContext.h"
 
 #include "LoopTimer.h"
 
diff --git a/src/crepe/api/Scene.h b/src/crepe/api/Scene.h
index 66dad17..9f1e8ce 100644
--- a/src/crepe/api/Scene.h
+++ b/src/crepe/api/Scene.h
@@ -2,8 +2,8 @@
 
 #include <string>
 
-#include "../util/OptionalRef.h"
 #include "../manager/Mediator.h"
+#include "../util/OptionalRef.h"
 
 namespace crepe {
 
@@ -37,6 +37,7 @@ public:
 
 	// TODO: Late references should ALWAYS be private! This is currently kept as-is so unit tests
 	// keep passing, but this reference should not be directly accessible by the user!!!
+
 protected:
 	/**
 	 * \name Late references
diff --git a/src/crepe/api/Script.cpp b/src/crepe/api/Script.cpp
index a27838e..4091fd4 100644
--- a/src/crepe/api/Script.cpp
+++ b/src/crepe/api/Script.cpp
@@ -25,4 +25,3 @@ void Script::set_next_scene(const string & name) {
 	SceneManager & mgr = mediator.scene_manager;
 	mgr.set_next_scene(name);
 }
-
diff --git a/src/crepe/api/Script.h b/src/crepe/api/Script.h
index e1f86b2..1b339b0 100644
--- a/src/crepe/api/Script.h
+++ b/src/crepe/api/Script.h
@@ -2,10 +2,10 @@
 
 #include <vector>
 
+#include "../manager/EventManager.h"
+#include "../manager/Mediator.h"
 #include "../types.h"
 #include "../util/OptionalRef.h"
-#include "../manager/Mediator.h"
-#include "../manager/EventManager.h"
 
 namespace crepe {
 
diff --git a/src/crepe/manager/ComponentManager.cpp b/src/crepe/manager/ComponentManager.cpp
index 5a96158..80cf8b4 100644
--- a/src/crepe/manager/ComponentManager.cpp
+++ b/src/crepe/manager/ComponentManager.cpp
@@ -1,6 +1,6 @@
 #include "../api/GameObject.h"
-#include "../util/Log.h"
 #include "../types.h"
+#include "../util/Log.h"
 
 #include "ComponentManager.h"
 
diff --git a/src/crepe/manager/Manager.cpp b/src/crepe/manager/Manager.cpp
index fe7c936..1182785 100644
--- a/src/crepe/manager/Manager.cpp
+++ b/src/crepe/manager/Manager.cpp
@@ -2,5 +2,4 @@
 
 using namespace crepe;
 
-Manager::Manager(Mediator & mediator) : mediator(mediator) { }
-
+Manager::Manager(Mediator & mediator) : mediator(mediator) {}
diff --git a/src/crepe/manager/Manager.h b/src/crepe/manager/Manager.h
index 9adfd0b..4f21ef4 100644
--- a/src/crepe/manager/Manager.h
+++ b/src/crepe/manager/Manager.h
@@ -13,5 +13,4 @@ protected:
 	Mediator & mediator;
 };
 
-}
-
+} // namespace crepe
diff --git a/src/crepe/manager/Mediator.h b/src/crepe/manager/Mediator.h
index a91509e..71bd1c9 100644
--- a/src/crepe/manager/Mediator.h
+++ b/src/crepe/manager/Mediator.h
@@ -3,8 +3,8 @@
 #include "../util/OptionalRef.h"
 
 // TODO: remove these singletons:
-#include "SaveManager.h"
 #include "EventManager.h"
+#include "SaveManager.h"
 
 namespace crepe {
 
@@ -30,4 +30,4 @@ struct Mediator {
 	OptionalRef<EventManager> event_manager = EventManager::get_instance();
 };
 
-}
+} // namespace crepe
diff --git a/src/crepe/manager/SaveManager.cpp b/src/crepe/manager/SaveManager.cpp
index 121d017..d4ed1c1 100644
--- a/src/crepe/manager/SaveManager.cpp
+++ b/src/crepe/manager/SaveManager.cpp
@@ -1,7 +1,7 @@
+#include "../ValueBroker.h"
+#include "../api/Config.h"
 #include "../facade/DB.h"
 #include "../util/Log.h"
-#include "../api/Config.h"
-#include "../ValueBroker.h"
 
 #include "SaveManager.h"
 
diff --git a/src/crepe/system/PhysicsSystem.cpp b/src/crepe/system/PhysicsSystem.cpp
index eba9dfa..bebcf3d 100644
--- a/src/crepe/system/PhysicsSystem.cpp
+++ b/src/crepe/system/PhysicsSystem.cpp
@@ -1,10 +1,10 @@
 #include <cmath>
 
-#include "../manager/ComponentManager.h"
 #include "../api/Config.h"
 #include "../api/Rigidbody.h"
 #include "../api/Transform.h"
 #include "../api/Vector2.h"
+#include "../manager/ComponentManager.h"
 
 #include "PhysicsSystem.h"
 
diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp
index 4e97b3e..0ad685c 100644
--- a/src/crepe/system/RenderSystem.cpp
+++ b/src/crepe/system/RenderSystem.cpp
@@ -5,12 +5,12 @@
 #include <stdexcept>
 #include <vector>
 
-#include "../manager/ComponentManager.h"
 #include "../api/Camera.h"
 #include "../api/ParticleEmitter.h"
 #include "../api/Sprite.h"
 #include "../api/Transform.h"
 #include "../facade/SDLContext.h"
+#include "../manager/ComponentManager.h"
 
 #include "RenderSystem.h"
 
diff --git a/src/crepe/system/ScriptSystem.cpp b/src/crepe/system/ScriptSystem.cpp
index 2e16eb0..d6b2ca1 100644
--- a/src/crepe/system/ScriptSystem.cpp
+++ b/src/crepe/system/ScriptSystem.cpp
@@ -1,6 +1,6 @@
-#include "../manager/ComponentManager.h"
 #include "../api/BehaviorScript.h"
 #include "../api/Script.h"
+#include "../manager/ComponentManager.h"
 
 #include "ScriptSystem.h"
 
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));
-- 
cgit v1.2.3