summaryrefslogtreecommitdiff
path: root/test/test-helpers.hpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-01-07 18:45:16 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-01-07 18:45:16 +0000
commitcf2491a9c2062af1da61c128e45cfe14869c5edf (patch)
tree5414888d17fcd263bf8395b803ba7753874b1d3e /test/test-helpers.hpp
parentGeoData::quad works in world coordinates (diff)
downloadilt-cf2491a9c2062af1da61c128e45cfe14869c5edf.tar.bz2
ilt-cf2491a9c2062af1da61c128e45cfe14869c5edf.tar.xz
ilt-cf2491a9c2062af1da61c128e45cfe14869c5edf.zip
Don't invoke CHECK parameters multiple times
Diffstat (limited to 'test/test-helpers.hpp')
-rw-r--r--test/test-helpers.hpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/test/test-helpers.hpp b/test/test-helpers.hpp
index d99e1fa..5ebbea9 100644
--- a/test/test-helpers.hpp
+++ b/test/test-helpers.hpp
@@ -3,13 +3,19 @@
#include <boost/test/tools/context.hpp>
#include <boost/test/tools/interface.hpp>
-#define BOOST_CHECK_CLOSE_VEC(a, b) \
- BOOST_TEST_CONTEXT("BOOST_CHECK_CLOSE_VEC(" << a << ", " << b << ")") { \
- BOOST_CHECK_LT(glm::length(a - b), 0.1F); \
+#define BOOST_CHECK_CLOSE_VEC(a_, b_) \
+ { \
+ const auto a {a_}, b {b_}; \
+ BOOST_TEST_CONTEXT("BOOST_CHECK_CLOSE_VEC(" << a << ", " << b << ")") { \
+ BOOST_CHECK_LT(glm::length(a - b), 0.1F); \
+ } \
}
-#define BOOST_CHECK_BETWEEN(a, b, c) \
- BOOST_TEST_CONTEXT("BOOST_CHECK_BETWEEN(" << a << ", " << b << ", " << c << ")") { \
- BOOST_CHECK_LE(b, a); \
- BOOST_CHECK_GE(c, a); \
+#define BOOST_CHECK_BETWEEN(a_, b_, c_) \
+ { \
+ const auto a {a_}, b {b_}, c {c_}; \
+ BOOST_TEST_CONTEXT("BOOST_CHECK_BETWEEN(" << a << ", " << b << ", " << c << ")") { \
+ BOOST_CHECK_LE(b, a); \
+ BOOST_CHECK_GE(c, a); \
+ } \
}