summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2022-12-12 15:21:11 -0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-12-13 16:58:29 +0000
commit1ee938e36b7396252a963e70d07c9129535713b1 (patch)
treee9eee904bc83171957cabf7d32a2b8685f8c48fc
parent96c9bbe136d773050fdd4435a577358f122edbd1 (diff)
downloadchrome-ec-1ee938e36b7396252a963e70d07c9129535713b1.tar.gz
include/test_util: Unify absolute value macros
The ABS macro already exists in math_util.h, so use that instead of creating a new macro in test_util.h. BRANCH=none BUG=b:234181908 TEST=make buildall TEST=./util/compare_build.sh -b all -j 120 => MATCH Change-Id: I0a034123abd97512b35413c3cef24dcaebf4ce93 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4098874 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--include/test_util.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/test_util.h b/include/test_util.h
index e3a9f27ebc..48560cd938 100644
--- a/include/test_util.h
+++ b/include/test_util.h
@@ -16,6 +16,7 @@ extern "C" {
#include "common.h"
#include "console.h"
+#include "math_util.h"
#include "stack_trace.h"
#ifdef CONFIG_ZTEST
@@ -92,9 +93,7 @@ extern "C" {
#define TEST_NEAR(a, b, epsilon, fmt) \
TEST_OPERATOR(ABS((a) - (b)), epsilon, <, fmt)
-#define __ABS(n) ((n) > 0 ? (n) : -(n))
-
-#define TEST_ASSERT_ABS_LESS(n, t) TEST_OPERATOR(__ABS(n), t, <, "%d")
+#define TEST_ASSERT_ABS_LESS(n, t) TEST_OPERATOR(ABS(n), t, <, "%d")
#define TEST_ASSERT_ARRAY_EQ(s, d, n) \
do { \