diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-01 17:56:26 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-01 17:56:26 +0000 |
commit | d5cdbbf38380239524e351cb69aec94090884ca5 (patch) | |
tree | 5d7dff2f2775701069806eceb4eaef23b22eba3f /test/testHelpers.h | |
parent | Reformat with new clang-format (diff) | |
parent | Remove more use of legacy types (diff) | |
download | ilt-d5cdbbf38380239524e351cb69aec94090884ca5.tar.bz2 ilt-d5cdbbf38380239524e351cb69aec94090884ca5.tar.xz ilt-d5cdbbf38380239524e351cb69aec94090884ca5.zip |
Merge remote-tracking branch 'origin/terrain'
Diffstat (limited to 'test/testHelpers.h')
-rw-r--r-- | test/testHelpers.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/testHelpers.h b/test/testHelpers.h index 54b7fc6..f2b0901 100644 --- a/test/testHelpers.h +++ b/test/testHelpers.h @@ -2,6 +2,7 @@ #include <boost/test/tools/context.hpp> #include <boost/test/tools/interface.hpp> +#include <iomanip> // IWYU pragma: keep std::setprecision #include <memory> std::unique_ptr<char, decltype(&free)> uasprintf(const char * fmt, ...) __attribute__((format(printf, 1, 2))); @@ -9,11 +10,21 @@ std::unique_ptr<char, decltype(&free)> uasprintf(const char * fmt, ...) __attrib #define BOOST_CHECK_CLOSE_VEC(a_, b_) \ { \ const auto a {a_}, b {b_}; \ - BOOST_TEST_CONTEXT("BOOST_CHECK_CLOSE_VEC(" << a << ", " << b << ")") { \ + BOOST_TEST_CONTEXT("BOOST_CHECK_CLOSE_VEC(" << std::setprecision(8) << a << ", " << b << ")") { \ BOOST_CHECK_LT(glm::length(a - b), 0.1F); \ } \ } +#define BOOST_CHECK_CLOSE_VECI(a_, b_) \ + { \ + const auto a {a_}, b {b_}; \ + BOOST_TEST_CONTEXT("BOOST_CHECK_CLOSE_VEC(" << std::setprecision(8) << a << ", " << b << ")") { \ + BOOST_CHECK_LE(std::abs(a.x - b.x), 1); \ + BOOST_CHECK_LE(std::abs(a.y - b.y), 1); \ + BOOST_CHECK_LE(std::abs(a.z - b.z), 1); \ + } \ + } + #define BOOST_CHECK_BETWEEN(a_, b_, c_) \ { \ const auto a {a_}, b {b_}, c {c_}; \ |