From add8724446fdeae1aaec9b07544cf7a5475a9bfe Mon Sep 17 00:00:00 2001
From: Loek Le Blansch <loek@pipeframe.xyz>
Date: Thu, 14 Nov 2024 19:57:45 +0100
Subject: ResourceManager working + tested

---
 src/test/main.cpp | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

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

diff --git a/src/test/main.cpp b/src/test/main.cpp
index 241015d..19a8d6e 100644
--- a/src/test/main.cpp
+++ b/src/test/main.cpp
@@ -5,11 +5,22 @@
 using namespace crepe;
 using namespace testing;
 
+class GlobalConfigReset : public EmptyTestEventListener {
+public:
+	Config & cfg = Config::get_instance();
+
+	// This function is called before each test
+	void OnTestStart(const TestInfo &) override {
+		cfg.log.level = Log::Level::WARNING;
+	}
+};
+
 int main(int argc, char ** argv) {
 	InitGoogleTest(&argc, argv);
 
-	auto & cfg = Config::get_instance();
-	cfg.log.level = Log::Level::ERROR;
+	UnitTest & ut = *UnitTest::GetInstance();
+	ut.listeners().Append(new GlobalConfigReset);
 
 	return RUN_ALL_TESTS();
 }
+
-- 
cgit v1.2.3


From a685e5f743786cc6499e7ce8973bb78a83d101f7 Mon Sep 17 00:00:00 2001
From: Loek Le Blansch <loek@pipeframe.xyz>
Date: Tue, 26 Nov 2024 20:03:41 +0100
Subject: big WIP

---
 src/crepe/CMakeLists.txt          |   2 +
 src/crepe/ResourceManager.cpp     |  36 ++++++++++++
 src/crepe/ResourceManager.h       |  76 +++++++++++++++++++++++++
 src/crepe/api/AudioSource.h       |   1 +
 src/crepe/api/CMakeLists.txt      |   2 -
 src/crepe/api/Config.h            |  27 +--------
 src/crepe/api/ResourceManager.cpp |  41 --------------
 src/crepe/api/ResourceManager.h   |  69 -----------------------
 src/crepe/system/AudioSystem.cpp  |   2 +-
 src/crepe/system/AudioSystem.h    |   4 +-
 src/crepe/util/Log.cpp            |   2 +-
 src/crepe/util/Log.h              |  16 ++++++
 src/test/EventTest.cpp            |   1 -
 src/test/ResourceManagerTest.cpp  | 115 +++++++++++++++++++++++++++-----------
 src/test/main.cpp                 |  12 ++--
 15 files changed, 224 insertions(+), 182 deletions(-)
 create mode 100644 src/crepe/ResourceManager.cpp
 create mode 100644 src/crepe/ResourceManager.h
 delete mode 100644 src/crepe/api/ResourceManager.cpp
 delete mode 100644 src/crepe/api/ResourceManager.h

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

diff --git a/src/crepe/CMakeLists.txt b/src/crepe/CMakeLists.txt
index df15b8f..0313dfa 100644
--- a/src/crepe/CMakeLists.txt
+++ b/src/crepe/CMakeLists.txt
@@ -3,6 +3,7 @@ target_sources(crepe PUBLIC
 	ComponentManager.cpp
 	Component.cpp
 	Collider.cpp
+	ResourceManager.cpp
 	Resource.cpp
 )
 
@@ -13,6 +14,7 @@ target_sources(crepe PUBLIC FILE_SET HEADERS FILES
 	Collider.h
 	ValueBroker.h
 	ValueBroker.hpp
+	ResourceManager.h
 	Resource.h
 )
 
diff --git a/src/crepe/ResourceManager.cpp b/src/crepe/ResourceManager.cpp
new file mode 100644
index 0000000..111b9e0
--- /dev/null
+++ b/src/crepe/ResourceManager.cpp
@@ -0,0 +1,36 @@
+#include <stdexcept>
+
+#include "util/Log.h"
+
+#include "ResourceManager.h"
+
+using namespace crepe;
+using namespace std;
+
+ResourceManager::~ResourceManager() { dbg_trace(); }
+ResourceManager::ResourceManager() { dbg_trace(); }
+
+void ResourceManager::clear() {
+	this->resources.clear();
+}
+
+// template <typename T>
+// T & ResourceManager::cache(const Asset & asset) {
+// 	dbg_trace();
+// 	static_assert(is_base_of<Resource, T>::value, "cache must recieve a derivative class of Resource");
+// 
+// 	if (!this->resources.contains(asset))
+// 		this->resources[asset] = make_unique<T>(asset);
+// 
+// 	Resource * resource = this->resources.at(asset).get();
+// 	T * concrete_resource = dynamic_cast<T *>(resource);
+// 
+// 	if (concrete_resource == nullptr)
+// 		throw runtime_error(format("ResourceManager: mismatch between requested type and actual type of resource ({})", asset.get_path()));
+// 
+// 	return *concrete_resource;
+// }
+// 
+// #include "facade/Sound.h"
+// template Sound & ResourceManager::cache(const Asset &);
+
diff --git a/src/crepe/ResourceManager.h b/src/crepe/ResourceManager.h
new file mode 100644
index 0000000..26a86a8
--- /dev/null
+++ b/src/crepe/ResourceManager.h
@@ -0,0 +1,76 @@
+#pragma once
+
+#include <memory>
+#include <unordered_map>
+
+#include "api/Asset.h"
+
+#include "Component.h"
+#include "Resource.h"
+
+namespace crepe {
+
+
+/**
+ * \brief The ResourceManager is responsible for storing and managing assets over
+ * multiple scenes.
+ * 
+ * The ResourceManager ensures that assets are loaded once and can be accessed
+ * across different scenes. It caches assets to avoid reloading them every time
+ * a scene is loaded. Assets are retained in memory until the ResourceManager is
+ * destroyed, at which point the cached assets are cleared.
+ */
+class ResourceManager {
+public:
+	ResourceManager(); // dbg_trace
+	virtual ~ResourceManager(); // dbg_trace
+
+private:
+	template <typename Resource>
+	Resource & get_internal(const Component & component, const Asset & asset);
+
+	template <typename Resource>
+	const Asset & get_source(const Component & component) const;
+
+	//! A cache that holds all the assets, accessible by their file path, over multiple scenes.
+	std::unordered_map<const Asset, std::unique_ptr<Resource>> resources;
+
+public:
+	/**
+	 * \brief Caches an asset by loading it from the given file path.
+	 *
+	 * \param file_path The path to the asset file to load.
+	 * \param reload If true, the asset will be reloaded from the file, even if
+	 * it is already cached.
+	 * \tparam T The type of asset to cache (e.g., texture, sound, etc.).
+	 * 
+	 * \return A reference to the resource
+	 * 
+	 * This template function caches the asset at the given file path. If the
+	 * asset is already cached, the existing instance will be returned.
+	 * Otherwise, the concrete resource will be instantiated and added to the
+	 * cache.
+	 */
+	template <typename Resource>
+	void cache(const Asset & asset, bool persistent = false);
+
+	template <typename Component>
+	void cache(const Component & component, bool persistent = false);
+
+	// void resman.cache<Resource>(Asset, Lifetime);
+	// void resman.cache(Component, Asset, Lifetime);
+
+	template <typename Resource, typename Component>
+	Resource & get(const Component & component);
+
+	//! Clear the resource cache
+	void clear();
+};
+
+class Sound;
+class AudioSource;
+template <>
+Sound & ResourceManager::get(const AudioSource & component);
+
+} // namespace crepe
+
diff --git a/src/crepe/api/AudioSource.h b/src/crepe/api/AudioSource.h
index 1264790..0950129 100644
--- a/src/crepe/api/AudioSource.h
+++ b/src/crepe/api/AudioSource.h
@@ -3,6 +3,7 @@
 #include "../Component.h"
 #include "../types.h"
 
+#include "GameObject.h"
 #include "Asset.h"
 
 namespace crepe {
diff --git a/src/crepe/api/CMakeLists.txt b/src/crepe/api/CMakeLists.txt
index a2e21fa..ad82924 100644
--- a/src/crepe/api/CMakeLists.txt
+++ b/src/crepe/api/CMakeLists.txt
@@ -7,7 +7,6 @@ target_sources(crepe PUBLIC
 	Transform.cpp
 	Color.cpp
 	Texture.cpp
-	ResourceManager.cpp
 	Sprite.cpp
 	SaveManager.cpp
 	Config.cpp
@@ -39,7 +38,6 @@ target_sources(crepe PUBLIC FILE_SET HEADERS FILES
 	Vector2.hpp
 	Color.h
 	Texture.h 
-	ResourceManager.h 
 	SaveManager.h
 	Scene.h
 	Metadata.h
diff --git a/src/crepe/api/Config.h b/src/crepe/api/Config.h
index 0c9d116..5bd6913 100644
--- a/src/crepe/api/Config.h
+++ b/src/crepe/api/Config.h
@@ -11,35 +11,12 @@ namespace crepe {
  * modified *before* execution is handed over from the game programmer to the engine (i.e. the
  * main loop is started).
  */
-class Config final {
-public:
+struct Config final {
 	//! Retrieve handle to global Config instance
 	static Config & get_instance();
 
-private:
-	Config() = default;
-	~Config() = default;
-	Config(const Config &) = default;
-	Config(Config &&) = default;
-	Config & operator=(const Config &) = default;
-	Config & operator=(Config &&) = default;
-
-public:
 	//! Logging-related settings
-	struct {
-		/**
-		 * \brief Log level
-		 *
-		 * Only messages with equal or higher priority than this value will be logged.
-		 */
-		Log::Level level = Log::Level::INFO;
-		/**
-		 * \brief Colored log output
-		 *
-		 * Enables log coloring using ANSI escape codes.
-		 */
-		bool color = true;
-	} log;
+	Log::Config log;
 
 	//! Save manager
 	struct {
diff --git a/src/crepe/api/ResourceManager.cpp b/src/crepe/api/ResourceManager.cpp
deleted file mode 100644
index 7877ed9..0000000
--- a/src/crepe/api/ResourceManager.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <stdexcept>
-
-#include "util/Log.h"
-
-#include "ResourceManager.h"
-
-using namespace crepe;
-using namespace std;
-
-ResourceManager & ResourceManager::get_instance() {
-	static ResourceManager instance;
-	return instance;
-}
-
-ResourceManager::~ResourceManager() { dbg_trace(); }
-ResourceManager::ResourceManager() { dbg_trace(); }
-
-void ResourceManager::clear() {
-	this->resources.clear();
-}
-
-template <typename T>
-T & ResourceManager::cache(const Asset & asset) {
-	dbg_trace();
-	static_assert(is_base_of<Resource, T>::value, "cache must recieve a derivative class of Resource");
-
-	if (!this->resources.contains(asset))
-		this->resources[asset] = make_unique<T>(asset);
-
-	Resource * resource = this->resources.at(asset).get();
-	T * concrete_resource = dynamic_cast<T *>(resource);
-
-	if (concrete_resource == nullptr)
-		throw runtime_error(format("ResourceManager: mismatch between requested type and actual type of resource ({})", asset.get_path()));
-
-	return *concrete_resource;
-}
-
-#include "../facade/Sound.h"
-template Sound & ResourceManager::cache(const Asset &);
-
diff --git a/src/crepe/api/ResourceManager.h b/src/crepe/api/ResourceManager.h
deleted file mode 100644
index efdd5c5..0000000
--- a/src/crepe/api/ResourceManager.h
+++ /dev/null
@@ -1,69 +0,0 @@
-#pragma once
-
-#include <memory>
-#include <unordered_map>
-
-#include "Asset.h"
-#include "Resource.h"
-
-namespace crepe {
-
-class Sound;
-
-/**
- * \brief The ResourceManager is responsible for storing and managing assets over
- * multiple scenes.
- * 
- * The ResourceManager ensures that assets are loaded once and can be accessed
- * across different scenes. It caches assets to avoid reloading them every time
- * a scene is loaded. Assets are retained in memory until the ResourceManager is
- * destroyed, at which point the cached assets are cleared.
- */
-class ResourceManager {
-
-private:
-	//! A cache that holds all the assets, accessible by their file path, over multiple scenes.
-	std::unordered_map<const Asset, std::unique_ptr<Resource>> resources;
-
-private:
-	ResourceManager(); // dbg_trace
-	virtual ~ResourceManager(); // dbg_trace
-
-	ResourceManager(const ResourceManager &) = delete;
-	ResourceManager(ResourceManager &&) = delete;
-	ResourceManager & operator=(const ResourceManager &) = delete;
-	ResourceManager & operator=(ResourceManager &&) = delete;
-
-public:
-	/**
-	 * \brief Retrieves the singleton instance of the ResourceManager.
-	 *
-	 * \return A reference to the single instance of the ResourceManager.
-	 */
-	static ResourceManager & get_instance();
-
-public:
-	/**
-	 * \brief Caches an asset by loading it from the given file path.
-	 *
-	 * \param file_path The path to the asset file to load.
-	 * \param reload If true, the asset will be reloaded from the file, even if
-	 * it is already cached.
-	 * \tparam T The type of asset to cache (e.g., texture, sound, etc.).
-	 * 
-	 * \return A reference to the resource
-	 * 
-	 * This template function caches the asset at the given file path. If the
-	 * asset is already cached, the existing instance will be returned.
-	 * Otherwise, the concrete resource will be instantiated and added to the
-	 * cache.
-	 */
-	template <typename T>
-	T & cache(const Asset & asset);
-
-	//! Clear the resource cache
-	void clear();
-};
-
-} // namespace crepe
-
diff --git a/src/crepe/system/AudioSystem.cpp b/src/crepe/system/AudioSystem.cpp
index b7ac1f2..6c30b85 100644
--- a/src/crepe/system/AudioSystem.cpp
+++ b/src/crepe/system/AudioSystem.cpp
@@ -47,7 +47,7 @@ void AudioSystem::update() {
 		 *   using the same underlying instance of Sound (esp. w/
 		 *   play/pause/retrigger behavior).
 		 */
-		Sound & sound = this->resman.cache<Sound>(component.source);
+		// Sound & sound = this->resource_manager.get<Sound>(component);
 
 		// TODO: lots of state diffing
 	}
diff --git a/src/crepe/system/AudioSystem.h b/src/crepe/system/AudioSystem.h
index d0b4f9a..d3d5aeb 100644
--- a/src/crepe/system/AudioSystem.h
+++ b/src/crepe/system/AudioSystem.h
@@ -1,7 +1,7 @@
 #pragma once
 
 #include "../facade/SoundContext.h"
-#include "../api/ResourceManager.h"
+#include "../ResourceManager.h"
 
 #include "System.h"
 
@@ -14,7 +14,7 @@ public:
 
 private:
 	SoundContext context {};
-	ResourceManager & resman = ResourceManager::get_instance();
+	ResourceManager resource_manager {};
 };
 
 } // namespace crepe
diff --git a/src/crepe/util/Log.cpp b/src/crepe/util/Log.cpp
index 84d80a8..bc86c7e 100644
--- a/src/crepe/util/Log.cpp
+++ b/src/crepe/util/Log.cpp
@@ -25,7 +25,7 @@ string Log::prefix(const Level & level) {
 }
 
 void Log::log(const Level & level, const string & msg) {
-	auto & cfg = Config::get_instance();
+	auto & cfg = crepe::Config::get_instance();
 	if (level < cfg.log.level) return;
 
 	string out = Log::prefix(level) + msg;
diff --git a/src/crepe/util/Log.h b/src/crepe/util/Log.h
index fc0bb3a..914145a 100644
--- a/src/crepe/util/Log.h
+++ b/src/crepe/util/Log.h
@@ -77,6 +77,22 @@ private:
 	 * \return Colored message severity prefix string
 	 */
 	static std::string prefix(const Level & level);
+
+public:
+	struct Config {
+		/**
+		 * \brief Log level
+		 *
+		 * Only messages with equal or higher priority than this value will be logged.
+		 */
+		Level level = INFO;
+		/**
+		 * \brief Colored log output
+		 *
+		 * Enables log coloring using ANSI escape codes.
+		 */
+		bool color = true;
+	};
 };
 
 } // namespace crepe
diff --git a/src/test/EventTest.cpp b/src/test/EventTest.cpp
index b0e6c9c..a21a851 100644
--- a/src/test/EventTest.cpp
+++ b/src/test/EventTest.cpp
@@ -37,7 +37,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/ResourceManagerTest.cpp b/src/test/ResourceManagerTest.cpp
index 3fc9ebd..f57c419 100644
--- a/src/test/ResourceManagerTest.cpp
+++ b/src/test/ResourceManagerTest.cpp
@@ -1,52 +1,101 @@
 #include <gtest/gtest.h>
 
+#define private public
+#define protected public
+
 #include <crepe/util/Log.h>
-#include <crepe/api/Config.h>
-#include <crepe/api/ResourceManager.h>
+#include <crepe/ResourceManager.h>
+#include <crepe/api/GameObject.h>
+#include <crepe/Component.h>
+#include <crepe/ComponentManager.h>
 
 using namespace std;
 using namespace crepe;
 using namespace testing;
 
+class TestComponent : public Component {
+public:
+	TestComponent(game_object_id_t id, const Asset & asset)
+		: Component(id),
+		  source(asset) {}
+	const Asset source;
+};
+
+class TestResource : public Resource {
+public:
+	static unsigned instances;
+
+public:
+	const unsigned instance;
+	TestResource(const Asset & src)
+		: Resource(src),
+		  instance(this->instances++) { }
+};
+unsigned TestResource::instances = 0;
+
+template <>
+TestResource & ResourceManager::get(const TestComponent & component) {
+	return this->get_internal<TestResource>(component, component.source);
+}
+
 class ResourceManagerTest : public Test {
 public:
-	ResourceManager & resman = ResourceManager::get_instance();
-	Config & cfg = Config::get_instance();
+	ResourceManager resource_manager{};
+
+	static constexpr const char * ASSET_LOCATION = "asset/texture/img.png";
+
+	TestComponent a{0, ASSET_LOCATION};
+	TestComponent b{1, ASSET_LOCATION};
 
+private:
 	void SetUp() override {
-		resman.clear();
+		TestResource::instances = 0;
 	}
 };
 
-TEST_F(ResourceManagerTest, Main) {
-	// NOTE: there is no way (that I know of) to ensure the last cache call
-	// allocates the new Sound instance in a different location than the first,
-	// so this test should be verified manually using these print statements and
-	// debug trace messages.
-	cfg.log.level = Log::Level::TRACE;
-
-	Asset path1 = "mwe/audio/sfx1.wav";
-	Asset path2 = "mwe/audio/sfx1.wav";
-	ASSERT_EQ(path1, path2);
-
-	Sound * ptr1 = nullptr;
-	Sound * ptr2 = nullptr;
-	{
-		Log::logf(Log::Level::DEBUG, "Get first sound (constructor call)");
-		Sound & sound = resman.cache<Sound>(path1);
-		ptr1 = &sound;
-	}
-	{
-		Log::logf(Log::Level::DEBUG, "Get same sound (NO constructor call)");
-		Sound & sound = resman.cache<Sound>(path2);
-		ptr2 = &sound;
-	}
-	EXPECT_EQ(ptr1, ptr2);
+TEST_F(ResourceManagerTest, Uncached) {
+	TestResource & res_1 = resource_manager.get<TestResource>(a); // 1
+	TestResource & res_2 = resource_manager.get<TestResource>(a); // 1
+	TestResource & res_3 = resource_manager.get<TestResource>(b); // 2
+	TestResource & res_4 = resource_manager.get<TestResource>(b); // 2
+
+	ASSERT_EQ(res_1, res_2);
+	ASSERT_EQ(res_3, res_4);
+	EXPECT_NE(res_1, res_3);
+
+	EXPECT_EQ(TestResource::instances, 2);
+}
+
+// TODO: per GameObject / Component
+TEST_F(ResourceManagerTest, PerComponent) {
+	resource_manager.cache(a);
+	resource_manager.cache(b);
+
+	TestResource & res_1 = resource_manager.get<TestResource>(a); // 1
+	TestResource & res_2 = resource_manager.get<TestResource>(a); // 1
+	TestResource & res_3 = resource_manager.get<TestResource>(b); // 2
+	TestResource & res_4 = resource_manager.get<TestResource>(b); // 2
+
+	ASSERT_EQ(res_1, res_2);
+	ASSERT_EQ(res_3, res_4);
+	EXPECT_NE(res_1, res_3);
+
+	EXPECT_EQ(TestResource::instances, 2);
+}
+
+TEST_F(ResourceManagerTest, PerAsset) {
+	resource_manager.cache(ASSET_LOCATION);
+	EXPECT_EQ(TestResource::instances, 1);
+
+	TestResource & res_1 = resource_manager.get<TestResource>(a); // 1
+	TestResource & res_2 = resource_manager.get<TestResource>(a); // 1
+	TestResource & res_3 = resource_manager.get<TestResource>(b); // 1
+	TestResource & res_4 = resource_manager.get<TestResource>(b); // 1
 
-	Log::logf(Log::Level::DEBUG, "Clear cache (destructor call)");
-	resman.clear();
+	EXPECT_EQ(res_1, res_2);
+	EXPECT_EQ(res_2, res_3);
+	EXPECT_EQ(res_3, res_4);
 
-	Log::logf(Log::Level::DEBUG, "Get first sound again (constructor call)");
-	Sound & sound = resman.cache<Sound>(path1);
+	EXPECT_EQ(TestResource::instances, 1);
 }
 
diff --git a/src/test/main.cpp b/src/test/main.cpp
index e03a989..54f74fd 100644
--- a/src/test/main.cpp
+++ b/src/test/main.cpp
@@ -1,8 +1,4 @@
 #include <gtest/gtest.h>
-
-#define protected public
-#define private public
-
 #include <crepe/api/Config.h>
 
 using namespace crepe;
@@ -11,12 +7,14 @@ using namespace testing;
 class GlobalConfigReset : public EmptyTestEventListener {
 public:
 	Config & cfg = Config::get_instance();
-	Config cfg_default = Config();
 
 	// This function is called before each test
 	void OnTestStart(const TestInfo &) override {
-		cfg = cfg_default;
-		cfg.log.level = Log::Level::WARNING;
+		cfg = {
+			.log = {
+				.level = Log::Level::WARNING,
+			},
+		};
 	}
 };
 
-- 
cgit v1.2.3


From 9eff2e24fa4cf0ffad2b47cc922a6558bc1a9fa1 Mon Sep 17 00:00:00 2001
From: Loek Le Blansch <loek@pipeframe.xyz>
Date: Sat, 30 Nov 2024 16:42:21 +0100
Subject: `make format`

---
 src/crepe/Resource.cpp                 |  3 +--
 src/crepe/api/AudioSource.cpp          | 12 ++++--------
 src/crepe/api/AudioSource.h            |  4 ++--
 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/facade/Sound.cpp             |  9 ++++-----
 src/crepe/facade/SoundContext.cpp      |  5 +----
 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/ResourceManager.cpp  |  8 ++------
 src/crepe/manager/ResourceManager.hpp  | 13 +++++++------
 src/crepe/manager/SaveManager.cpp      |  4 ++--
 src/crepe/system/AudioSystem.cpp       | 10 +++++-----
 src/crepe/system/AudioSystem.h         |  6 +++---
 src/crepe/system/PhysicsSystem.cpp     |  2 +-
 src/crepe/system/RenderSystem.cpp      |  2 +-
 src/crepe/system/ScriptSystem.cpp      |  2 +-
 src/crepe/util/Private.cpp             | 17 +++++------------
 src/crepe/util/Private.h               |  5 ++---
 src/crepe/util/Private.hpp             | 18 ++++++++----------
 src/test/AudioTest.cpp                 | 15 +++++++--------
 src/test/ECSTest.cpp                   |  3 ++-
 src/test/EventTest.cpp                 |  6 ++----
 src/test/ParticleTest.cpp              |  3 ++-
 src/test/PhysicsTest.cpp               |  3 ++-
 src/test/PrivateTest.cpp               |  5 +----
 src/test/RenderSystemTest.cpp          |  3 ++-
 src/test/ResourceManagerTest.cpp       | 16 ++++++----------
 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 +++++---
 src/test/main.cpp                      |  3 +--
 39 files changed, 99 insertions(+), 133 deletions(-)

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

diff --git a/src/crepe/Resource.cpp b/src/crepe/Resource.cpp
index e254695..27b4c4b 100644
--- a/src/crepe/Resource.cpp
+++ b/src/crepe/Resource.cpp
@@ -2,5 +2,4 @@
 
 using namespace crepe;
 
-Resource::Resource(const Asset & asset) { }
-
+Resource::Resource(const Asset & asset) {}
diff --git a/src/crepe/api/AudioSource.cpp b/src/crepe/api/AudioSource.cpp
index cc70801..7b05cb1 100644
--- a/src/crepe/api/AudioSource.cpp
+++ b/src/crepe/api/AudioSource.cpp
@@ -3,17 +3,13 @@
 using namespace crepe;
 using namespace std;
 
-AudioSource::AudioSource(game_object_id_t id, const Asset & src) :
-	Component(id),
-	source(src)
-{ }
+AudioSource::AudioSource(game_object_id_t id, const Asset & src)
+	: Component(id),
+	  source(src) {}
 
 void AudioSource::play(bool looping) {
 	this->loop = looping;
 	this->oneshot_play = true;
 }
 
-void AudioSource::stop() {
-	this->oneshot_stop = true;
-}
-
+void AudioSource::stop() { this->oneshot_stop = true; }
diff --git a/src/crepe/api/AudioSource.h b/src/crepe/api/AudioSource.h
index 1899c22..63b4bc4 100644
--- a/src/crepe/api/AudioSource.h
+++ b/src/crepe/api/AudioSource.h
@@ -4,8 +4,8 @@
 #include "../types.h"
 #include "../util/Private.h"
 
-#include "GameObject.h"
 #include "Asset.h"
+#include "GameObject.h"
 
 namespace crepe {
 
@@ -20,6 +20,7 @@ protected:
 	AudioSource(game_object_id_t id, const Asset & source);
 	//! Only ComponentManager can create components
 	friend class ComponentManager;
+
 public:
 	// But std::unique_ptr needs to be able to destoy this component again
 	virtual ~AudioSource() = default;
@@ -62,4 +63,3 @@ private:
 };
 
 } // namespace crepe
-
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/facade/Sound.cpp b/src/crepe/facade/Sound.cpp
index 0df1f48..33a0c47 100644
--- a/src/crepe/facade/Sound.cpp
+++ b/src/crepe/facade/Sound.cpp
@@ -23,26 +23,25 @@ Sound::~Sound() { dbg_trace(); }
 // 		ctx.engine.setLooping(this->handle, this->looping);
 // 	}
 // }
-// 
+//
 // void Sound::pause(SoundContext & ctx) {
 // 	if (ctx.engine.getPause(this->handle)) return;
 // 	ctx.engine.setPause(this->handle, true);
 // }
-// 
+//
 // void Sound::rewind(SoundContext & ctx) {
 // 	if (!ctx.engine.isValidVoiceHandle(this->handle)) return;
 // 	ctx.engine.seek(this->handle, 0);
 // }
-// 
+//
 // void Sound::set_volume(SoundContext & ctx, float volume) {
 // 	this->volume = volume;
 // 	if (!ctx.engine.isValidVoiceHandle(this->handle)) return;
 // 	ctx.engine.setVolume(this->handle, this->volume);
 // }
-// 
+//
 // void Sound::set_looping(SoundContext & ctx, bool looping) {
 // 	this->looping = looping;
 // 	if (!ctx.engine.isValidVoiceHandle(this->handle)) return;
 // 	ctx.engine.setLooping(this->handle, this->looping);
 // }
-
diff --git a/src/crepe/facade/SoundContext.cpp b/src/crepe/facade/SoundContext.cpp
index 3ae5956..470b3cc 100644
--- a/src/crepe/facade/SoundContext.cpp
+++ b/src/crepe/facade/SoundContext.cpp
@@ -21,9 +21,7 @@ Sound::Handle SoundContext::play(Sound & resource) {
 	};
 }
 
-void SoundContext::stop(Sound::Handle & handle) {
-	this->engine.stop(handle.handle);
-}
+void SoundContext::stop(Sound::Handle & handle) { this->engine.stop(handle.handle); }
 
 void SoundContext::set_volume(Sound & resource, Sound::Handle & handle, float volume) {
 	this->engine.setVolume(handle.handle, volume);
@@ -33,4 +31,3 @@ void SoundContext::set_volume(Sound & resource, Sound::Handle & handle, float vo
 void SoundContext::set_loop(Sound & resource, Sound::Handle & handle, bool loop) {
 	this->engine.setLooping(handle.handle, loop);
 }
-
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 475aed9..e9c10b1 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 {
 
@@ -32,4 +32,4 @@ struct Mediator {
 	OptionalRef<ResourceManager> resource_manager;
 };
 
-}
+} // namespace crepe
diff --git a/src/crepe/manager/ResourceManager.cpp b/src/crepe/manager/ResourceManager.cpp
index 87585ad..7c01808 100644
--- a/src/crepe/manager/ResourceManager.cpp
+++ b/src/crepe/manager/ResourceManager.cpp
@@ -18,17 +18,13 @@ void ResourceManager::clear() {
 	});
 }
 
-void ResourceManager::clear_all() {
-	this->resources.clear();
-}
+void ResourceManager::clear_all() { this->resources.clear(); }
 
 void ResourceManager::set_persistent(const Asset & asset, bool persistent) {
 	this->get_entry(asset).persistent = persistent;
 }
 
 ResourceManager::CacheEntry & ResourceManager::get_entry(const Asset & asset) {
-	if (!this->resources.contains(asset))
-		this->resources[asset] = {};
+	if (!this->resources.contains(asset)) this->resources[asset] = {};
 	return this->resources.at(asset);
 }
-
diff --git a/src/crepe/manager/ResourceManager.hpp b/src/crepe/manager/ResourceManager.hpp
index 8270bc5..5167d71 100644
--- a/src/crepe/manager/ResourceManager.hpp
+++ b/src/crepe/manager/ResourceManager.hpp
@@ -9,18 +9,19 @@ namespace crepe {
 template <typename T>
 T & ResourceManager::get(const Asset & asset) {
 	using namespace std;
-	static_assert(is_base_of<Resource, T>::value, "cache must recieve a derivative class of Resource");
+	static_assert(is_base_of<Resource, T>::value,
+				  "cache must recieve a derivative class of Resource");
 
 	CacheEntry & entry = this->get_entry(asset);
-	if (entry.resource == nullptr)
-		entry.resource = make_unique<T>(asset);
+	if (entry.resource == nullptr) entry.resource = make_unique<T>(asset);
 
 	T * concrete_resource = dynamic_cast<T *>(entry.resource.get());
 	if (concrete_resource == nullptr)
-		throw runtime_error(format("ResourceManager: mismatch between requested type and actual type of resource ({})", asset.get_path()));
+		throw runtime_error(format("ResourceManager: mismatch between requested type and "
+								   "actual type of resource ({})",
+								   asset.get_path()));
 
 	return *concrete_resource;
 }
 
-}
-
+} // 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/AudioSystem.cpp b/src/crepe/system/AudioSystem.cpp
index 84a101a..0696b34 100644
--- a/src/crepe/system/AudioSystem.cpp
+++ b/src/crepe/system/AudioSystem.cpp
@@ -10,7 +10,8 @@ using namespace std;
 void AudioSystem::update() {
 	ComponentManager & component_manager = this->mediator.component_manager;
 	ResourceManager & resource_manager = this->mediator.resource_manager;
-	RefVector<AudioSource> components = component_manager.get_components_by_type<AudioSource>();
+	RefVector<AudioSource> components
+		= component_manager.get_components_by_type<AudioSource>();
 
 	for (AudioSource & component : components) {
 		Sound & resource = resource_manager.get<Sound>(component.source);
@@ -28,7 +29,8 @@ void AudioSystem::update() {
 	}
 }
 
-void AudioSystem::diff_update(AudioSource & component, ComponentPrivate & data, Sound & resource) {
+void AudioSystem::diff_update(AudioSource & component, ComponentPrivate & data,
+							  Sound & resource) {
 	SoundContext & context = this->get_context();
 
 	if (component.active != data.last_active) {
@@ -64,8 +66,6 @@ void AudioSystem::update_last(const AudioSource & component, ComponentPrivate &
 }
 
 SoundContext & AudioSystem::get_context() {
-	if (this->context.empty())
-		this->context.set<SoundContext>();
+	if (this->context.empty()) this->context.set<SoundContext>();
 	return this->context.get<SoundContext>();
 }
-
diff --git a/src/crepe/system/AudioSystem.h b/src/crepe/system/AudioSystem.h
index a004c60..c941470 100644
--- a/src/crepe/system/AudioSystem.h
+++ b/src/crepe/system/AudioSystem.h
@@ -1,8 +1,8 @@
 #pragma once
 
-#include "../facade/SoundContext.h"
-#include "../facade/Sound.h"
 #include "../api/AudioSource.h"
+#include "../facade/Sound.h"
+#include "../facade/SoundContext.h"
 
 #include "System.h"
 
@@ -37,9 +37,9 @@ private:
 
 protected:
 	virtual SoundContext & get_context();
+
 private:
 	Private context;
 };
 
 } // namespace crepe
-
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/crepe/util/Private.cpp b/src/crepe/util/Private.cpp
index cb4cb5b..262620d 100644
--- a/src/crepe/util/Private.cpp
+++ b/src/crepe/util/Private.cpp
@@ -2,18 +2,14 @@
 
 using namespace crepe;
 
-bool Private::empty() const noexcept {
-	return this->instance == nullptr;
-}
+bool Private::empty() const noexcept { return this->instance == nullptr; }
 
 Private::~Private() {
 	if (this->instance == nullptr) return;
 	this->destructor(this->instance);
 }
 
-Private::Private(Private && other) {
-	*this = std::move(other);
-}
+Private::Private(Private && other) { *this = std::move(other); }
 
 Private & Private::operator=(Private && other) {
 	// TODO: ideally this function checks for self-assignment
@@ -22,13 +18,10 @@ Private & Private::operator=(Private && other) {
 	this->type = other.type;
 
 	other.instance = nullptr;
-	other.destructor = [](void*){};
-
-	return *this;
-}
+	other.destructor = [](void *) {};
 
-Private::Private(const Private & other) { }
-Private & Private::operator=(const Private & other) {
 	return *this;
 }
 
+Private::Private(const Private & other) {}
+Private & Private::operator=(const Private & other) { return *this; }
diff --git a/src/crepe/util/Private.h b/src/crepe/util/Private.h
index 6dd28bb..62a2e1a 100644
--- a/src/crepe/util/Private.h
+++ b/src/crepe/util/Private.h
@@ -1,7 +1,7 @@
 #pragma once
 
-#include <typeindex>
 #include <functional>
+#include <typeindex>
 
 namespace crepe {
 
@@ -28,7 +28,6 @@ private:
 	void * instance = nullptr;
 };
 
-}
+} // namespace crepe
 
 #include "Private.hpp"
-
diff --git a/src/crepe/util/Private.hpp b/src/crepe/util/Private.hpp
index d6ab23f..3a87a9f 100644
--- a/src/crepe/util/Private.hpp
+++ b/src/crepe/util/Private.hpp
@@ -1,7 +1,7 @@
 #pragma once
 
-#include <stdexcept>
 #include <format>
+#include <stdexcept>
 
 #include "Private.h"
 
@@ -11,10 +11,8 @@ template <typename T, typename... Args>
 T & Private::set(Args &&... args) {
 	if (!this->empty()) this->destructor(this->instance);
 	T * instance = new T(std::forward<Args>(args)...);
-	this->instance = static_cast<void*>(instance);
-	this->destructor = [](void * instance) {
-		delete static_cast<T*>(instance);
-	};
+	this->instance = static_cast<void *>(instance);
+	this->destructor = [](void * instance) { delete static_cast<T *>(instance); };
 	this->type = typeid(T);
 	return *instance;
 }
@@ -22,12 +20,12 @@ T & Private::set(Args &&... args) {
 template <typename T>
 T & Private::get() {
 	using namespace std;
-	if (this->empty())
-		throw out_of_range("Private: get() called on empty object");
+	if (this->empty()) throw out_of_range("Private: get() called on empty object");
 	type_index requested_type = typeid(T);
 	if (this->type != requested_type)
-		throw logic_error(format("Private: get() called with [T = {}] (actual is [T = {}])", requested_type.name(), this->type.name()));
-	return *static_cast<T*>(this->instance);
+		throw logic_error(format("Private: get() called with [T = {}] (actual is [T = {}])",
+								 requested_type.name(), this->type.name()));
+	return *static_cast<T *>(this->instance);
 }
 
-}
+} // namespace crepe
diff --git a/src/test/AudioTest.cpp b/src/test/AudioTest.cpp
index 9c3cb9c..14f57bd 100644
--- a/src/test/AudioTest.cpp
+++ b/src/test/AudioTest.cpp
@@ -1,10 +1,10 @@
-#include <gtest/gtest.h>
 #include <gmock/gmock.h>
+#include <gtest/gtest.h>
 
-#include <crepe/manager/ComponentManager.h>
-#include <crepe/manager/ResourceManager.h>
 #include <crepe/api/AudioSource.h>
 #include <crepe/api/GameObject.h>
+#include <crepe/manager/ComponentManager.h>
+#include <crepe/manager/ResourceManager.h>
 #include <crepe/system/AudioSystem.h>
 
 using namespace std;
@@ -26,21 +26,21 @@ private:
 	public:
 		using AudioSystem::AudioSystem;
 		StrictMock<TestSoundContext> context;
-		virtual SoundContext & get_context() {
-			return this->context;
-		}
+		virtual SoundContext & get_context() { return this->context; }
 	};
 
 private:
 	Mediator mediator;
 	ComponentManager component_manager{mediator};
 	ResourceManager resource_manager{mediator};
+
 public:
-	TestAudioSystem system {mediator};
+	TestAudioSystem system{mediator};
 	TestSoundContext & context = system.context;
 
 private:
 	GameObject entity = component_manager.new_object("name");
+
 public:
 	AudioSource & component = entity.add_component<AudioSource>("mwe/audio/bgm.ogg");
 };
@@ -150,4 +150,3 @@ TEST_F(AudioTest, PlayOnActive) {
 		system.update();
 	}
 }
-
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/PrivateTest.cpp b/src/test/PrivateTest.cpp
index 0ea67d6..454789e 100644
--- a/src/test/PrivateTest.cpp
+++ b/src/test/PrivateTest.cpp
@@ -27,9 +27,7 @@ unsigned PrivateTest::constructors;
 unsigned PrivateTest::destructors;
 
 TEST_F(PrivateTest, Empty) {
-	{
-		Private foo;
-	}
+	{ Private foo; }
 
 	EXPECT_EQ(PrivateTest::constructors, 0);
 	EXPECT_EQ(PrivateTest::destructors, 0);
@@ -155,4 +153,3 @@ TEST_F(PrivateTest, DoubleAssignment) {
 	EXPECT_EQ(PrivateTest::constructors, 2);
 	EXPECT_EQ(PrivateTest::destructors, 2);
 }
-
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/ResourceManagerTest.cpp b/src/test/ResourceManagerTest.cpp
index 1f56e23..b6be3c0 100644
--- a/src/test/ResourceManagerTest.cpp
+++ b/src/test/ResourceManagerTest.cpp
@@ -3,9 +3,9 @@
 #define private public
 #define protected public
 
-#include <crepe/util/Log.h>
-#include <crepe/manager/ResourceManager.h>
 #include <crepe/api/GameObject.h>
+#include <crepe/manager/ResourceManager.h>
+#include <crepe/util/Log.h>
 
 using namespace std;
 using namespace crepe;
@@ -13,6 +13,7 @@ using namespace testing;
 
 class ResourceManagerTest : public Test {
 	Mediator mediator;
+
 public:
 	ResourceManager resource_manager{mediator};
 
@@ -25,19 +26,15 @@ public:
 
 	public:
 		const unsigned instance;
-		TestResource(const Asset & src)
-			: Resource(src),
-				instance(this->instances++) { }
+		TestResource(const Asset & src) : Resource(src), instance(this->instances++) {}
 		~TestResource() { this->instances--; }
-		bool operator == (const TestResource & other) const {
+		bool operator==(const TestResource & other) const {
 			return this->instance == other.instance;
 		}
 	};
 
 private:
-	void SetUp() override {
-		TestResource::instances = 0;
-	}
+	void SetUp() override { TestResource::instances = 0; }
 };
 unsigned ResourceManagerTest::TestResource::instances = 0;
 
@@ -72,4 +69,3 @@ TEST_F(ResourceManagerTest, Persistent) {
 	resource_manager.clear_all();
 	EXPECT_EQ(TestResource::instances, 0);
 }
-
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));
diff --git a/src/test/main.cpp b/src/test/main.cpp
index 54f74fd..ed2aed5 100644
--- a/src/test/main.cpp
+++ b/src/test/main.cpp
@@ -1,5 +1,5 @@
-#include <gtest/gtest.h>
 #include <crepe/api/Config.h>
+#include <gtest/gtest.h>
 
 using namespace crepe;
 using namespace testing;
@@ -26,4 +26,3 @@ int main(int argc, char ** argv) {
 
 	return RUN_ALL_TESTS();
 }
-
-- 
cgit v1.2.3