health 2.1 VTS: fix test on batteryFullCapacityUah

getHealthInfo_2_1 reports batteryFullCapacityUah:
- 0 if value is unknown. In such case, no requirement is enforced.
- positive if value is known. In such case, require it to be 50%~120% of
  batteryFullCharge.

Test: run on cuttlefish
Bug: 144948996

Change-Id: I7856729aafa3a19a3bfcc00e6e0ad5162f22afea
This commit is contained in:
Yifan Hong 2020-01-28 18:48:11 -08:00
parent 3a8eb92143
commit 3f91f296ba

View file

@ -233,9 +233,13 @@ TEST_P(HealthHidlTest, getHealthInfo_2_1) {
EXPECT_TRUE(IsEnum(value.batteryCapacityLevel)) << " BatteryCapacityLevel";
EXPECT_GE(value.batteryChargeTimeToFullNowSeconds, 0);
EXPECT_GE(value.batteryFullCapacityUah, 0) << "batteryFullCapacityUah is unknown";
EXPECT_GE(value.batteryFullCapacityUah, legacy.batteryFullCharge * 0.50);
EXPECT_LE(value.batteryFullCapacityUah, legacy.batteryFullCharge * 1.20);
EXPECT_GE(value.batteryFullCapacityUah, 0)
<< "batteryFullCapacityUah should not be negative";
if (value.batteryFullCapacityUah > 0) {
EXPECT_GE(value.batteryFullCapacityUah, legacy.batteryFullCharge * 0.50);
EXPECT_LE(value.batteryFullCapacityUah, legacy.batteryFullCharge * 1.20);
}
})));
}