summaryrefslogtreecommitdiff
path: root/zephyr/test/drivers/src/stm_mems_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/test/drivers/src/stm_mems_common.c')
-rw-r--r--zephyr/test/drivers/src/stm_mems_common.c56
1 files changed, 0 insertions, 56 deletions
diff --git a/zephyr/test/drivers/src/stm_mems_common.c b/zephyr/test/drivers/src/stm_mems_common.c
deleted file mode 100644
index 3085007f4d..0000000000
--- a/zephyr/test/drivers/src/stm_mems_common.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <ztest.h>
-#include <device.h>
-#include <devicetree.h>
-#include <errno.h>
-
-#include "common.h"
-#include "driver/stm_mems_common.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/i2c_mock.h"
-#include "i2c/i2c.h"
-
-#define MOCK_EMUL emul_get_binding(DT_LABEL(DT_NODELABEL(i2c_mock)))
-
-static void setup(void)
-{
- i2c_mock_reset(MOCK_EMUL);
-}
-
-static int mock_read_fn(struct i2c_emul *emul, int reg, uint8_t *val, int bytes,
- void *data)
-{
- ztest_check_expected_value(reg);
- ztest_check_expected_value(bytes);
- return ztest_get_return_value();
-}
-
-static void test_st_raw_read_n(void)
-{
- const struct emul *emul = MOCK_EMUL;
- struct i2c_emul *i2c_emul = i2c_mock_to_i2c_emul(emul);
- int rv;
-
- i2c_common_emul_set_read_func(i2c_emul, mock_read_fn, NULL);
- ztest_expect_value(mock_read_fn, reg, 0x80);
- ztest_expect_value(mock_read_fn, bytes, 0);
- ztest_returns_value(mock_read_fn, -EIO);
-
- rv = st_raw_read_n(I2C_PORT_POWER, i2c_mock_get_addr(emul), 0, NULL, 2);
- /* The shim layer translates -EIO to EC_ERROR_INVAL. */
- zassert_equal(rv, EC_ERROR_INVAL, "rv was %d but expected %d", rv,
- EC_ERROR_INVAL);
-}
-
-void test_suite_stm_mems_common(void)
-{
- ztest_test_suite(stm_mems_common,
- ztest_unit_test_setup_teardown(
- test_st_raw_read_n,
- setup, unit_test_noop));
- ztest_run_test_suite(stm_mems_common);
-}