summaryrefslogtreecommitdiff
path: root/include/test_util.h
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2019-08-13 09:09:02 -0600
committerCommit Bot <commit-bot@chromium.org>2019-11-11 19:40:09 +0000
commit083ced83d71a6ab60204c7ada6c22d9c82731713 (patch)
tree84d730feb2e51f04bbb991a7aca4db54bfe7de8d /include/test_util.h
parent9f151350684fee0ac14deed0ce31ddfd520b2a36 (diff)
downloadchrome-ec-083ced83d71a6ab60204c7ada6c22d9c82731713.tar.gz
common: Refactor motion_sense_fifo
This change refactors the motion_sense_fifo to uniformly prefix all the functions to avoid collisions. It also adds several unit tests and fixes a few bugs with the fifo logic. BUG=b:137758297 BRANCH=kukui TEST=buildall TEST=run CTS on arcada, kohaku, and kukui TEST=boot kohaku (verify tablet mode works as expected) Change-Id: I6e8492ae5fa474d0aa870088ab56f76b220a73e3 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1835221 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'include/test_util.h')
-rw-r--r--include/test_util.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/test_util.h b/include/test_util.h
index f91a47674f..23034f918e 100644
--- a/include/test_util.h
+++ b/include/test_util.h
@@ -58,6 +58,8 @@
#define TEST_GE(a, b, fmt) TEST_OPERATOR(a, b, >=, fmt)
#define TEST_BITS_SET(a, bits) TEST_OPERATOR(a & (int)bits, (int)bits, ==, "%u")
#define TEST_BITS_CLEARED(a, bits) TEST_OPERATOR(a & (int)bits, 0, ==, "%u")
+#define TEST_NEAR(a, b, epsilon, fmt) \
+ TEST_OPERATOR(ABS((a) - (b)), epsilon, <, fmt)
#define __ABS(n) ((n) > 0 ? (n) : -(n))