aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-20 14:51:26 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-20 14:51:26 +0100
commitfb35ca64eee9afdd72f2cf8d279c4e745444baf9 (patch)
tree8337951f36d18ac7c44efc3abfe8ce3a8ca7889f /src
parent7e0c99bd2b30500c265370fe71bce3f243a10837 (diff)
`make format`
Diffstat (limited to 'src')
-rw-r--r--src/test/ECSTest.cpp15
-rw-r--r--src/test/SceneManagerTest.cpp10
2 files changed, 15 insertions, 10 deletions
diff --git a/src/test/ECSTest.cpp b/src/test/ECSTest.cpp
index eaa2dbc..d5a5826 100644
--- a/src/test/ECSTest.cpp
+++ b/src/test/ECSTest.cpp
@@ -1,3 +1,5 @@
+#include <gtest/gtest.h>
+
#define protected public
#include <crepe/ComponentManager.h>
@@ -5,7 +7,6 @@
#include <crepe/api/Metadata.h>
#include <crepe/api/Transform.h>
#include <crepe/api/Vector2.h>
-#include <gtest/gtest.h>
using namespace std;
using namespace crepe;
@@ -94,7 +95,7 @@ TEST_F(ECSTest, deleteGameObject) {
}
TEST_F(ECSTest, manyGameObjects) {
- for(int i = 0; i < 5000; i++) {
+ for (int i = 0; i < 5000; i++) {
GameObject obj = mgr.new_object("body", "person", Vector2{0, 0}, 0, i);
}
@@ -103,7 +104,7 @@ TEST_F(ECSTest, manyGameObjects) {
EXPECT_EQ(metadata.size(), 5000);
EXPECT_EQ(transform.size(), 5000);
- for(int i = 0; i < 5000; i++) {
+ for (int i = 0; i < 5000; i++) {
EXPECT_EQ(metadata[i].get().game_object_id, i);
EXPECT_EQ(metadata[i].get().name, "body");
EXPECT_EQ(metadata[i].get().tag, "person");
@@ -125,7 +126,7 @@ TEST_F(ECSTest, manyGameObjects) {
EXPECT_EQ(metadata.size(), 0);
EXPECT_EQ(transform.size(), 5000);
- for(int i = 0; i < 10000 - 5000; i++) {
+ for (int i = 0; i < 10000 - 5000; i++) {
string tag = "person" + to_string(i);
GameObject obj = mgr.new_object("body", tag, Vector2{0, 0}, i, 0);
}
@@ -165,14 +166,16 @@ TEST_F(ECSTest, tooMuchComponents) {
GameObject obj0 = mgr.new_object("body", "person", Vector2{0, 0}, 0, 1);
obj0.add_component<Transform>(Vector2{10, 10}, 0, 1);
} catch (const exception & e) {
- EXPECT_EQ(e.what(), string("Exceeded maximum number of instances for this component type"));
+ EXPECT_EQ(e.what(),
+ string("Exceeded maximum number of instances for this component type"));
}
try {
GameObject obj1 = mgr.new_object("body", "person", Vector2{0, 0}, 0, 1);
obj1.add_component<Metadata>("body", "person");
} catch (const exception & e) {
- EXPECT_EQ(e.what(), string("Exceeded maximum number of instances for this component type"));
+ EXPECT_EQ(e.what(),
+ string("Exceeded maximum number of instances for this component type"));
}
vector<reference_wrapper<Metadata>> metadata = mgr.get_components_by_type<Metadata>();
diff --git a/src/test/SceneManagerTest.cpp b/src/test/SceneManagerTest.cpp
index 98b2a23..69e1171 100644
--- a/src/test/SceneManagerTest.cpp
+++ b/src/test/SceneManagerTest.cpp
@@ -1,10 +1,10 @@
#include <crepe/ComponentManager.h>
#include <crepe/api/GameObject.h>
#include <crepe/api/Metadata.h>
-#include <crepe/api/Transform.h>
-#include <crepe/api/Vector2.h>
#include <crepe/api/Scene.h>
#include <crepe/api/SceneManager.h>
+#include <crepe/api/Transform.h>
+#include <crepe/api/Vector2.h>
#include <gtest/gtest.h>
using namespace std;
@@ -47,8 +47,10 @@ TEST_F(SceneManagerTest, loadScene) {
scene_mgr.load_next_scene();
- vector<reference_wrapper<Metadata>> metadata = component_mgr.get_components_by_type<Metadata>();
- vector<reference_wrapper<Transform>> transform = component_mgr.get_components_by_type<Transform>();
+ vector<reference_wrapper<Metadata>> metadata
+ = component_mgr.get_components_by_type<Metadata>();
+ vector<reference_wrapper<Transform>> transform
+ = component_mgr.get_components_by_type<Transform>();
EXPECT_EQ(metadata.size(), 3);
EXPECT_EQ(transform.size(), 3);