From a91f743cea0e72b7ef7c18683d51aa603407afa2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 22 Nov 2023 15:29:40 +0100 Subject: a --- test/math.cpp | 64 ++++++++++++++++++++++++++--------------------------- test/wall-atlas.cpp | 5 ----- 2 files changed, 32 insertions(+), 37 deletions(-) (limited to 'test') diff --git a/test/math.cpp b/test/math.cpp index d70a64fb..6535e998 100644 --- a/test/math.cpp +++ b/test/math.cpp @@ -1,5 +1,5 @@ #include "app.hpp" -#include "compat/math.hpp" +#include namespace floormat { @@ -10,7 +10,7 @@ constexpr bool test_double_sqrt() using F = double; constexpr auto eps = F(1e-11); - static_assert(math::abs(math::sqrt((F)3) - (F)1.73205080757) < eps); + static_assert(Math::abs(Math::sqrt((F)3) - (F)1.73205080757) < eps); return true; } @@ -21,22 +21,22 @@ bool test_sqrt() constexpr auto test = [](double x) { auto x_ = (F)x; - auto y1 = math::sqrt(x_); + auto y1 = Math::sqrt(x_); auto y2 = std::sqrt(x_); - return math::abs(y1 - y2) < eps; + return Math::abs(y1 - y2) < eps; }; - static_assert(math::abs(math::sqrt((F)0) - (F)0) < eps); - static_assert(math::abs(math::sqrt((F)0.5) - (F)0.70710678118) < eps); - static_assert(math::abs(math::sqrt((F)1e-8) - (F)0.0001) < eps); - static_assert(math::abs(math::sqrt((F)2) - (F)1.41421356237) < eps); - static_assert(math::abs(math::sqrt((F)3) - (F)1.73205080757) < (F)1e-6); + static_assert(Math::abs(Math::sqrt((F)0) - (F)0) < eps); + static_assert(Math::abs(Math::sqrt((F)0.5) - (F)0.70710678118) < eps); + static_assert(Math::abs(Math::sqrt((F)1e-8) - (F)0.0001) < eps); + static_assert(Math::abs(Math::sqrt((F)2) - (F)1.41421356237) < eps); + static_assert(Math::abs(Math::sqrt((F)3) - (F)1.73205080757) < (F)1e-6); - static_assert(math::sqrt((F)0) == (F)0); - static_assert(math::sqrt((F)1) == (F)1); - static_assert(math::sqrt((F)4) == (F)2); - static_assert(math::sqrt((F)9) == (F)3); - static_assert(math::sqrt((F)36) == (F)6); + static_assert(Math::sqrt((F)0) == (F)0); + static_assert(Math::sqrt((F)1) == (F)1); + static_assert(Math::sqrt((F)4) == (F)2); + static_assert(Math::sqrt((F)9) == (F)3); + static_assert(Math::sqrt((F)36) == (F)6); fm_assert(test(0)); fm_assert(test(0.5)); @@ -60,15 +60,15 @@ bool test_sqrt() template constexpr bool test_floor() { - fm_assert(math::floor((F)-1.5) == -2); - fm_assert(math::floor((F)0) == 0); - fm_assert(math::floor((F)1) == 1); - fm_assert(math::floor((F)-1) == -1); - fm_assert(math::floor((F)-2) == -2); - fm_assert(math::floor((F)1.0000001) == 1); - fm_assert(math::floor((F)-1.000001) == -2); - fm_assert(math::floor((F)1e-8) == 0); - fm_assert(math::floor((F)-1e-8) == -1); + fm_assert(Math::floor((F)-1.5) == -2); + fm_assert(Math::floor((F)0) == 0); + fm_assert(Math::floor((F)1) == 1); + fm_assert(Math::floor((F)-1) == -1); + fm_assert(Math::floor((F)-2) == -2); + fm_assert(Math::floor((F)1.0000001) == 1); + fm_assert(Math::floor((F)-1.000001) == -2); + fm_assert(Math::floor((F)1e-8) == 0); + fm_assert(Math::floor((F)-1e-8) == -1); return true; } @@ -76,15 +76,15 @@ constexpr bool test_floor() template constexpr bool test_ceil() { - fm_assert(math::ceil((F)-1.5) == -1); - fm_assert(math::ceil((F)0) == 0); - fm_assert(math::ceil((F)1) == 1); - fm_assert(math::ceil((F)-1) == -1); - fm_assert(math::ceil((F)-2) == -2); - fm_assert(math::ceil((F)1.0000001) == 2); - fm_assert(math::ceil((F)-1.000001) == -1); - fm_assert(math::ceil((F)1e-8) == 1); - fm_assert(math::ceil((F)-1e-8) == 0); + fm_assert(Math::ceil((F)-1.5) == -1); + fm_assert(Math::ceil((F)0) == 0); + fm_assert(Math::ceil((F)1) == 1); + fm_assert(Math::ceil((F)-1) == -1); + fm_assert(Math::ceil((F)-2) == -2); + fm_assert(Math::ceil((F)1.0000001) == 2); + fm_assert(Math::ceil((F)-1.000001) == -1); + fm_assert(Math::ceil((F)1e-8) == 1); + fm_assert(Math::ceil((F)-1e-8) == 0); return true; } diff --git a/test/wall-atlas.cpp b/test/wall-atlas.cpp index 35096ea4..d544ac2b 100644 --- a/test/wall-atlas.cpp +++ b/test/wall-atlas.cpp @@ -104,11 +104,6 @@ void test_read_groups(StringView filename) return atlas; } -void write_to_temp_file(const wall_atlas_def& atlas) -{ - atlas.serialize(temp_filename()); -} - } // namespace } // namespace floormat::Wall::detail -- cgit v1.2.3