Lines Matching refs:fixture

49 static void test_shunt_cal(struct ina237_fixture *fixture)  in test_shunt_cal()  argument
52 double shunt_cal = 819.2e6 * fixture->current_lsb_uA * 1e-6 * fixture->rshunt_uOhms * 1e-6; in test_shunt_cal()
54 if (fixture->config & INA237_CFG_HIGH_PRECISION) { in test_shunt_cal()
62 zassert_ok(ina237_mock_get_register(fixture->mock->data, INA237_REG_CALIB, in test_shunt_cal()
68 static void test_current(struct ina237_fixture *fixture) in test_current() argument
86 double current_expected_A = fixture->current_lsb_uA * 1e-6 * current_register; in test_current()
89 ina237_mock_set_register(fixture->mock->data, INA237_REG_CURRENT, current_register); in test_current()
92 zassert_ok(sensor_sample_fetch(fixture->dev)); in test_current()
93 zassert_ok(sensor_channel_get(fixture->dev, SENSOR_CHAN_CURRENT, &sensor_val)); in test_current()
96 zexpect_within(current_expected_A, current_actual_A, fixture->current_lsb_uA*1e-6, in test_current()
101 static void test_bus_voltage(struct ina237_fixture *fixture) in test_bus_voltage() argument
103 zassert_not_null(fixture->mock); in test_bus_voltage()
118 ina237_mock_set_register(fixture->mock->data, INA237_REG_BUS_VOLT, in test_bus_voltage()
122 zassert_ok(sensor_sample_fetch(fixture->dev)); in test_bus_voltage()
123 zassert_ok(sensor_channel_get(fixture->dev, SENSOR_CHAN_VOLTAGE, &sensor_val)); in test_bus_voltage()
133 static void test_power(struct ina237_fixture *fixture) in test_power() argument
151 double power_expected_W = 0.2 * fixture->current_lsb_uA * 1e-6 * power_register; in test_power()
154 ina237_mock_set_register(fixture->mock->data, INA237_REG_POWER, power_register); in test_power()
157 zassert_ok(sensor_sample_fetch(fixture->dev)); in test_power()
158 zassert_ok(sensor_channel_get(fixture->dev, SENSOR_CHAN_POWER, &sensor_val)); in test_power()
166 static void test_temperature(struct ina237_fixture *fixture) in test_temperature() argument
168 zassert_not_null(fixture->mock); in test_temperature()
185 ina237_mock_set_register(fixture->mock->data, INA237_REG_DIETEMP, in test_temperature()
189 zassert_ok(sensor_sample_fetch(fixture->dev)); in test_temperature()
190 zassert_ok(sensor_channel_get(fixture->dev, SENSOR_CHAN_DIE_TEMP, &sensor_val)); in test_temperature()
200 static void test_vshunt(struct ina237_fixture *fixture) in test_vshunt() argument
202 zassert_not_null(fixture->mock); in test_vshunt()
221 ina237_mock_set_register(fixture->mock->data, INA237_REG_SHUNT_VOLT, in test_vshunt()
225 zassert_ok(sensor_sample_fetch_chan(fixture->dev, SENSOR_CHAN_VSHUNT)); in test_vshunt()
226 zassert_ok(sensor_channel_get(fixture->dev, SENSOR_CHAN_VSHUNT, &sensor_val)); in test_vshunt()
231 if (fixture->config & INA237_CFG_HIGH_PRECISION) { in test_vshunt()