tests: fuel_gauge: test negative current
Validate that the SBS fuel gauge driver returns the expected values for negative currents (discharging). Signed-off-by: Jordan Yates <jordan@embeint.com>
This commit is contained in:
parent
8345775de0
commit
8b69b79279
|
@ -206,7 +206,24 @@ ZTEST_USER_F(sbs_gauge_new_api, test_get_buffer_props__returns_ok)
|
|||
ZTEST_USER_F(sbs_gauge_new_api, test_charging_5v_3a)
|
||||
{
|
||||
uint32_t expected_uV = 5000 * 1000;
|
||||
uint32_t expected_uA = 3000 * 1000;
|
||||
int32_t expected_uA = 3000 * 1000;
|
||||
|
||||
union fuel_gauge_prop_val voltage;
|
||||
union fuel_gauge_prop_val current;
|
||||
|
||||
zassume_ok(emul_fuel_gauge_set_battery_charging(fixture->sbs_fuel_gauge, expected_uV,
|
||||
expected_uA));
|
||||
zassert_ok(fuel_gauge_get_prop(fixture->dev, FUEL_GAUGE_VOLTAGE, &voltage));
|
||||
zassert_ok(fuel_gauge_get_prop(fixture->dev, FUEL_GAUGE_CURRENT, ¤t));
|
||||
|
||||
zassert_equal(voltage.voltage, expected_uV, "Got %d instead of %d", voltage, expected_uV);
|
||||
zassert_equal(current.current, expected_uA, "Got %d instead of %d", current, expected_uA);
|
||||
}
|
||||
|
||||
ZTEST_USER_F(sbs_gauge_new_api, test_charging_5v_neg_1a)
|
||||
{
|
||||
uint32_t expected_uV = 5000 * 1000;
|
||||
int32_t expected_uA = -1000 * 1000;
|
||||
|
||||
union fuel_gauge_prop_val voltage;
|
||||
union fuel_gauge_prop_val current;
|
||||
|
|
Loading…
Reference in New Issue