From c71ab5699af6645819d5090810a1b11531843022 Mon Sep 17 00:00:00 2001 From: Rajavardhan Gundi Date: Fri, 10 Feb 2023 19:46:43 +0530 Subject: [PATCH] tests: drivers: sbs_gauge: Include additional properties Include tests for Fuel Gauge mode, status, charge current, charge voltage, design capacity and design voltage. Signed-off-by: Rajavardhan Gundi --- subsys/emul/i2c/emul_sbs_gauge.c | 4 ++++ .../fuel_gauge/sbs_gauge/src/test_sbs_gauge.c | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/subsys/emul/i2c/emul_sbs_gauge.c b/subsys/emul/i2c/emul_sbs_gauge.c index 7cb8d42ca8..c0a39fda47 100644 --- a/subsys/emul/i2c/emul_sbs_gauge.c +++ b/subsys/emul/i2c/emul_sbs_gauge.c @@ -72,6 +72,10 @@ static int emul_sbs_gauge_reg_read(const struct emul *target, int reg, int *val) case SBS_GAUGE_CMD_CYCLE_COUNT: case SBS_GAUGE_CMD_DESIGN_VOLTAGE: case SBS_GAUGE_CMD_CURRENT: + case SBS_GAUGE_CMD_BATTERY_MODE: + case SBS_GAUGE_CMD_CHG_CURRENT: + case SBS_GAUGE_CMD_CHG_VOLTAGE: + case SBS_GAUGE_CMD_FLAGS: /* Arbitrary stub value. */ *val = 1; break; diff --git a/tests/drivers/fuel_gauge/sbs_gauge/src/test_sbs_gauge.c b/tests/drivers/fuel_gauge/sbs_gauge/src/test_sbs_gauge.c index a7a927ff0f..c01b971760 100644 --- a/tests/drivers/fuel_gauge/sbs_gauge/src/test_sbs_gauge.c +++ b/tests/drivers/fuel_gauge/sbs_gauge/src/test_sbs_gauge.c @@ -199,6 +199,24 @@ ZTEST_F(sbs_gauge_new_api, test_get_props__returns_ok) { .property_type = FUEL_GAUGE_SBS_MFR_ACCESS, }, + { + .property_type = FUEL_GAUGE_MODE, + }, + { + .property_type = FUEL_GAUGE_CHARGE_CURRENT, + }, + { + .property_type = FUEL_GAUGE_CHARGE_VOLTAGE, + }, + { + .property_type = FUEL_GAUGE_STATUS, + }, + { + .property_type = FUEL_GAUGE_DESIGN_CAPACITY, + }, + { + .property_type = FUEL_GAUGE_DESIGN_VOLTAGE, + }, }; int ret = fixture->api->get_property(fixture->dev, props, ARRAY_SIZE(props));