aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-21 10:01:04 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-21 10:01:04 +0100
commit115d6f50152dc018073345800ca90b85846ebaa9 (patch)
tree2a260e1a280f170d26ef41519677ca04483d5596
parente7facf23888c38e09128749822c8e7d2b1d7e2fe (diff)
`make format`loek/util
-rw-r--r--src/crepe/util/OptionalRef.h2
-rw-r--r--src/crepe/util/OptionalRef.hpp2
-rw-r--r--src/test/OptionalRefTest.cpp9
-rw-r--r--src/test/SceneManagerTest.cpp4
4 files changed, 6 insertions, 11 deletions
diff --git a/src/crepe/util/OptionalRef.h b/src/crepe/util/OptionalRef.h
index 253bc07..3201667 100644
--- a/src/crepe/util/OptionalRef.h
+++ b/src/crepe/util/OptionalRef.h
@@ -31,7 +31,7 @@ public:
*
* \throws std::runtime_error if this function is called while the reference it not set
*/
- operator T & () const;
+ operator T &() const;
/**
* \brief Check if this reference is not empty
*
diff --git a/src/crepe/util/OptionalRef.hpp b/src/crepe/util/OptionalRef.hpp
index ae7c73e..4608c9e 100644
--- a/src/crepe/util/OptionalRef.hpp
+++ b/src/crepe/util/OptionalRef.hpp
@@ -12,7 +12,7 @@ OptionalRef<T>::OptionalRef(T & ref) {
}
template <typename T>
-OptionalRef<T>::operator T & () const {
+OptionalRef<T>::operator T &() const {
if (this->ref == nullptr)
throw std::runtime_error("OptionalRef: attempt to dereference nullptr");
return *this->ref;
diff --git a/src/test/OptionalRefTest.cpp b/src/test/OptionalRefTest.cpp
index 1c69348..83f7b23 100644
--- a/src/test/OptionalRefTest.cpp
+++ b/src/test/OptionalRefTest.cpp
@@ -18,9 +18,7 @@ TEST(OptionalRefTest, Normal) {
ref.clear();
EXPECT_FALSE(ref);
- ASSERT_THROW({
- string & value_ref = ref;
- }, runtime_error);
+ ASSERT_THROW({ string & value_ref = ref; }, runtime_error);
}
TEST(OptionalRefTest, Empty) {
@@ -28,9 +26,7 @@ TEST(OptionalRefTest, Empty) {
OptionalRef<string> ref;
EXPECT_FALSE(ref);
- ASSERT_THROW({
- string & value_ref = ref;
- }, runtime_error);
+ ASSERT_THROW({ string & value_ref = ref; }, runtime_error);
}
TEST(OptionalRefTest, Chain) {
@@ -44,4 +40,3 @@ TEST(OptionalRefTest, Chain) {
value_ref = "bar";
EXPECT_EQ(value_ref, value);
}
-
diff --git a/src/test/SceneManagerTest.cpp b/src/test/SceneManagerTest.cpp
index dab2ce9..1efcfb2 100644
--- a/src/test/SceneManagerTest.cpp
+++ b/src/test/SceneManagerTest.cpp
@@ -21,7 +21,7 @@ public:
GameObject object3 = mgr.new_object("scene_1", "tag_scene_1", Vector2{2, 0}, 0, 1);
}
- string get_name() const { return "scene1";}
+ string get_name() const { return "scene1"; }
};
class ConcreteScene2 : public Scene {
@@ -36,7 +36,7 @@ public:
GameObject object4 = mgr.new_object("scene_2", "tag_scene_2", Vector2{0, 3}, 0, 1);
}
- string get_name() const { return "scene2";}
+ string get_name() const { return "scene2"; }
};
class SceneManagerTest : public ::testing::Test {