summaryrefslogtreecommitdiff
path: root/common/test_util.c
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2019-07-15 14:15:10 -0600
committerCommit Bot <commit-bot@chromium.org>2019-07-24 21:16:37 +0000
commit2df71e976a0f16fe4e53c826f75193250c66212d (patch)
tree1c0c6ccadce825232df8048039f6d5c31322e9b6 /common/test_util.c
parent701f45f574cfcf9182e89267e5479af5eb709576 (diff)
downloadchrome-ec-2df71e976a0f16fe4e53c826f75193250c66212d.tar.gz
test: Add new test framework tools
Add new before/after test functions to be used for clean-up and tear-down of tests. Add new asserting functions: - TEST_EQ ensures that two values are equal - TEST_NE ensures that two values are not equal - TEST_BITS_SET ensures that a value contains all bits in mask - TEST_BITS_CLEARED ensures that a value doesn't contain any bits in mask The benefit of these is that unlike TEST_ASSERT they will also print the values when the assersion is wrong. BRANCH=None BUG=b:137758297 TEST=None yet Change-Id: I2f305ef34e541c289f22c6596f53ee5cd977c7a8 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704165 Reviewed-by: Enrico Granata <egranata@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common/test_util.c')
-rw-r--r--common/test_util.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/test_util.c b/common/test_util.c
index 72dc59f33d..2d2d3ba462 100644
--- a/common/test_util.c
+++ b/common/test_util.c
@@ -33,6 +33,12 @@ test_mockable void run_test(void) { }
/* Default dummy test init */
test_mockable void test_init(void) { }
+/* Default dummy before test */
+test_mockable void before_test(void) { }
+
+/* Default dummy after test */
+test_mockable void after_test(void) { }
+
#ifdef TEST_COVERAGE
extern void __gcov_flush(void);