summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-13 20:40:17 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-13 20:43:16 +0100
commit9ee7bc711a5ec19802aafffc2b0d5312cb54f5e2 (patch)
treec5b84cd15564e274bf374f47571c8cde96f44a8b /test
parent8577350b4b3eeec0f64626d815597eb805ddd9c7 (diff)
test stuff
Diffstat (limited to 'test')
-rw-r--r--test/app.hpp6
-rw-r--r--test/const-math.cpp9
-rw-r--r--test/entity.cpp12
-rw-r--r--test/json.cpp4
-rw-r--r--test/main.cpp6
-rw-r--r--test/tile-iter.cpp3
6 files changed, 23 insertions, 17 deletions
diff --git a/test/app.hpp b/test/app.hpp
index 76cbab18..7365e093 100644
--- a/test/app.hpp
+++ b/test/app.hpp
@@ -19,9 +19,9 @@ struct test_app final : private FM_APPLICATION
explicit test_app(const Arguments& arguments);
~test_app();
int exec() override;
- static bool test_json();
- static bool test_tile_iter();
- static bool test_const_math();
+ static void test_json();
+ static void test_tile_iter();
+ static void test_const_math();
static void test_serializer();
static void test_entity();
};
diff --git a/test/const-math.cpp b/test/const-math.cpp
index a9c710fe..afea9a0a 100644
--- a/test/const-math.cpp
+++ b/test/const-math.cpp
@@ -46,7 +46,7 @@ static constexpr void test_int()
fm_assert(a.sum() == 8);
}
-static constexpr void* compile_tests()
+static constexpr bool compile_tests()
{
test_float2<Vector<2, float>, float>();
test_float2<Vector<2, double>, double>();
@@ -56,15 +56,14 @@ static constexpr void* compile_tests()
test_int<Vector<2, unsigned>>();
test_int<Vector<2, char>>();
- return nullptr;
+ return true;
}
namespace floormat {
-bool test_app::test_const_math()
+void test_app::test_const_math()
{
- static_assert(compile_tests() == nullptr);
- return true;
+ static_assert(compile_tests());
}
} // namespace floormat
diff --git a/test/entity.cpp b/test/entity.cpp
index 6789a241..50d5e34b 100644
--- a/test/entity.cpp
+++ b/test/entity.cpp
@@ -2,7 +2,9 @@
#include "compat/assert.hpp"
#include "src/entity.hpp"
-struct Test {
+namespace {
+
+struct TestAccessors {
int foo = 111;
int bar() const { return _bar; }
void set_bar(int value) { _bar = value; }
@@ -11,12 +13,15 @@ private:
int _bar = 222;
};
+} // namespace
+
namespace floormat {
using namespace floormat::entities;
static void test_accessors()
{
+ using Test = ::TestAccessors;
using Entity = entity<Test>;
constexpr auto m_foo = Entity::Field<int>::make("foo"_s, &Test::foo, &Test::foo);
constexpr auto m_bar = Entity::Field<int>::make("bar"_s, &Test::bar, &Test::set_bar);
@@ -40,6 +45,11 @@ static void test_accessors()
}
}
+static void test_()
+{
+
+}
+
void test_app::test_entity()
{
test_accessors();
diff --git a/test/json.cpp b/test/json.cpp
index c304d3d2..1ef6feb8 100644
--- a/test/json.cpp
+++ b/test/json.cpp
@@ -32,7 +32,7 @@ static chunk make_test_chunk()
return c;
}
-bool test_app::test_json() // NOLINT(readability-convert-member-functions-to-static)
+void test_app::test_json() // NOLINT(readability-convert-member-functions-to-static)
{
fm_assert(Path::exists("../CMakeCache.txt"));
constexpr auto output_dir = "../test/."_s;
@@ -51,8 +51,6 @@ bool test_app::test_json() // NOLINT(readability-convert-member-functions-to-sta
Magnum::Math::Vector3 vec{0.f/zero, -1.f/zero, 123.f};
json_helper::to_json(vec, Path::join(output_dir, "vec3_inf.json"));
}
-
- return true;
}
} // namespace floormat
diff --git a/test/main.cpp b/test/main.cpp
index dbf4a10e..72f21555 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -19,9 +19,9 @@ test_app::~test_app()
int test_app::exec()
{
- fm_assert(test_json());
- fm_assert(test_tile_iter());
- fm_assert(test_const_math());
+ test_json();
+ test_tile_iter();
+ test_const_math();
test_serializer();
test_entity();
return 0;
diff --git a/test/tile-iter.cpp b/test/tile-iter.cpp
index 38fad206..9d31fd49 100644
--- a/test/tile-iter.cpp
+++ b/test/tile-iter.cpp
@@ -8,7 +8,7 @@ static inline bool always_false()
return ret;
}
-bool test_app::test_tile_iter() // NOLINT(readability-function-size)
+void test_app::test_tile_iter() // NOLINT(readability-function-size)
{
if (always_false())
{
@@ -28,7 +28,6 @@ bool test_app::test_tile_iter() // NOLINT(readability-function-size)
for ([[maybe_unused]] const auto [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), const tile_ref>);
}
- return true;
}
} // namespace floormat