diff options
Diffstat (limited to 'zephyr/test/drivers/rt9490/src/bc12.c')
-rw-r--r-- | zephyr/test/drivers/rt9490/src/bc12.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/zephyr/test/drivers/rt9490/src/bc12.c b/zephyr/test/drivers/rt9490/src/bc12.c index b32d50768e..eae2308c93 100644 --- a/zephyr/test/drivers/rt9490/src/bc12.c +++ b/zephyr/test/drivers/rt9490/src/bc12.c @@ -3,8 +3,11 @@ * found in the LICENSE file. */ -#include "charge_manager.h" +#include <zephyr/ztest.h> +#include <zephyr/fff.h> + #include "charger.h" +#include "charge_manager.h" #include "driver/charger/rt9490.h" #include "driver/tcpm/tcpci.h" #include "emul/emul_rt9490.h" @@ -14,16 +17,11 @@ #include "timer.h" #include "usb_charge.h" -#include <zephyr/fff.h> -#include <zephyr/ztest.h> - -FAKE_VALUE_FUNC(int, board_tcpc_post_init, int); - static const struct emul *emul = EMUL_DT_GET(DT_NODELABEL(rt9490)); static const struct emul *tcpci_emul = EMUL_DT_GET(DT_NODELABEL(tcpci_emul)); static const int chgnum = CHARGER_SOLO; -static void run_bc12_test(int reg_value, enum charge_supplier expected_result) +void run_bc12_test(int reg_value, enum charge_supplier expected_result) { int port = 0; @@ -31,19 +29,7 @@ static void run_bc12_test(int reg_value, enum charge_supplier expected_result) tcpci_emul_set_reg(tcpci_emul, TCPC_REG_POWER_STATUS, TCPC_REG_POWER_STATUS_VBUS_PRES | TCPC_REG_POWER_STATUS_VBUS_DET); - - /* This is the same as calling tcpc_config[port].drv->init(port) but - * also calls our board_tcpc_post_init_fake stub. During the init, the - * other tasks are also running and will at times also call the same - * function. So the verification just checks that the call count - * increased and that the first history element matches the port we - * provided. - */ - RESET_FAKE(board_tcpc_post_init); - zassert_ok(tcpm_init(port)); - zassert_true(board_tcpc_post_init_fake.call_count > 0); - zassert_equal(port, board_tcpc_post_init_fake.arg0_history[0]); - + zassert_ok(tcpc_config[port].drv->init(port), NULL); zassert_true(tcpc_config[port].drv->check_vbus_level(port, VBUS_PRESENT), NULL); |