From b0c87995cbe887d36c7aa5ecb6f5b0f3224eb595 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 4 Dec 2022 15:07:52 +0100 Subject: compat/lqt: make it build --- test/LooseQuadtreeTest.cpp | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'test/LooseQuadtreeTest.cpp') 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 -#include #include #include #include using namespace loose_quadtree; - - -#define ASSERT(CONDITION) if (!(CONDITION)) {\ - printf("Assertion failure %s:%d ASSERT(%s)\n", __FILE__, __LINE__, #CONDITION);\ - abort();\ - } - +namespace { template class TrivialBBExtractor { @@ -696,7 +700,8 @@ void StressTest() { template 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(); TestTraversals(); @@ -706,13 +711,17 @@ void RunTests(const char* type_str) { auto end = std::chrono::high_resolution_clock::now(); std::chrono::duration 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"); RunTests("double"); RunTests("long double"); @@ -724,6 +733,6 @@ int main(int, char*[]) { RunTests("unsigned short"); RunTests("long long"); puts("***** Testing is successfully finished *****"); - return 0; } +} // namespace floormat -- cgit v1.2.3