diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-12-04 15:07:52 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-12-04 15:39:43 +0100 |
commit | b0c87995cbe887d36c7aa5ecb6f5b0f3224eb595 (patch) | |
tree | 86ae804faf16195847c1d36eb800d58d0b027ef8 /test | |
parent | 7dd0604d57fb0941b87cc944f46afa68e386d99f (diff) |
compat/lqt: make it build
Diffstat (limited to 'test')
-rw-r--r-- | test/LooseQuadtreeTest.cpp | 35 | ||||
-rw-r--r-- | test/app.hpp | 1 | ||||
-rw-r--r-- | test/main.cpp | 1 |
3 files changed, 24 insertions, 13 deletions
diff --git a/test/LooseQuadtreeTest.cpp b/test/LooseQuadtreeTest.cpp index ca1e935d..3e19891b 100644 --- a/test/LooseQuadtreeTest.cpp +++ b/test/LooseQuadtreeTest.cpp @@ -1,20 +1,24 @@ -#include "LooseQuadtree.h" +#if defined __GNUG__ || defined __CLION_IDE__ +#pragma GCC diagnostic ignored "-Wfloat-equal" +#endif +#ifdef _MSC_VER +#pragma warning(disable : 4244) +#endif +#define ASSERT fm_assert + +#include "compat/LooseQuadtree.h" +#include "compat/LooseQuadtree-impl.h" +#include "compat/assert.hpp" +#include "test/app.hpp" #include <chrono> -#include <cstdlib> #include <cstdio> #include <random> #include <vector> using namespace loose_quadtree; - - -#define ASSERT(CONDITION) if (!(CONDITION)) {\ - printf("Assertion failure %s:%d ASSERT(%s)\n", __FILE__, __LINE__, #CONDITION);\ - abort();\ - } - +namespace { template <typename NumberT> class TrivialBBExtractor { @@ -696,7 +700,8 @@ void StressTest() { template <typename NumberT> void RunTests(const char* type_str) { - printf("***** Running tests for %s (%lu-bit)... ", type_str, sizeof(NumberT) * 8); + printf("quadtree test %s (%zu-bit)... ", type_str, sizeof(NumberT) * 8); + fflush(stdout); auto start = std::chrono::high_resolution_clock::now(); TestBoundingBox<NumberT>(); TestTraversals<NumberT>(); @@ -706,13 +711,17 @@ void RunTests(const char* type_str) { auto end = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> time = end - start; printf("took %f seconds\n", time.count()); + fflush(stdout); } +} // namespace +namespace floormat { -int main(int, char*[]) { +void test_app::test_quadtree() +{ puts("***** Testing is about to start *****"); - printf("***** This system is %lu-bit\n", sizeof(void*) * 8); + printf("***** This system is %zu-bit\n", sizeof(void*) * 8); RunTests<float>("float"); RunTests<double>("double"); RunTests<long double>("long double"); @@ -724,6 +733,6 @@ int main(int, char*[]) { RunTests<unsigned short>("unsigned short"); RunTests<long long>("long long"); puts("***** Testing is successfully finished *****"); - return 0; } +} // namespace floormat diff --git a/test/app.hpp b/test/app.hpp index 7365e093..94b6e506 100644 --- a/test/app.hpp +++ b/test/app.hpp @@ -24,5 +24,6 @@ struct test_app final : private FM_APPLICATION static void test_const_math(); static void test_serializer(); static void test_entity(); + static void test_quadtree(); }; } // namespace floormat diff --git a/test/main.cpp b/test/main.cpp index 72f21555..15654ad2 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -24,6 +24,7 @@ int test_app::exec() test_const_math(); test_serializer(); test_entity(); + test_quadtree(); return 0; } |