add brackets to macro expressions to ensure expected expansion results

This commit is contained in:
Crzyrndm 2018-06-18 19:12:02 +12:00
parent 6d16ffaddf
commit bd90cc4786

View File

@ -54,6 +54,6 @@
throw xlnt::exception("assert throws failed -> " XLNT_STRINGIFY(expression)); \ throw xlnt::exception("assert throws failed -> " XLNT_STRINGIFY(expression)); \
} while (false) } while (false)
#define xlnt_assert_equals(left, right) xlnt_assert(left == right) #define xlnt_assert_equals(left, right) xlnt_assert((left) == (right))
#define xlnt_assert_differs(left, right) xlnt_assert(left != right) #define xlnt_assert_differs(left, right) xlnt_assert((left) != (right))
#define xlnt_assert_delta(left, right, delta) xlnt_assert(std::abs(left - right) <= delta) #define xlnt_assert_delta(left, right, delta) xlnt_assert(std::abs((left) - (right)) <= (delta))