From 504d345e24e3be54d90f8bdd107c5bfbb38e57af Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 9 Dec 2023 12:04:07 +0000 Subject: Helper for testing integer vector approximations --- test/testHelpers.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/testHelpers.h') diff --git a/test/testHelpers.h b/test/testHelpers.h index 79e966a..f2b0901 100644 --- a/test/testHelpers.h +++ b/test/testHelpers.h @@ -15,6 +15,16 @@ std::unique_ptr uasprintf(const char * fmt, ...) __attrib } \ } +#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_}; \ -- cgit v1.2.3