summaryrefslogtreecommitdiffstats
path: root/health
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2020-02-16 00:16:05 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-02-16 00:16:05 +0000
commit0935243c4499da8cd48696f6868e8e4166642ab5 (patch)
tree47a540330cdf54a821c1e599f35dd4487a08953a /health
parenta36ef09893d321d8e04fa11369d1ab5b11debbd3 (diff)
parent32c4ec09d4f5803521288acdb07b36887d532e91 (diff)
downloadplatform_hardware_interfaces-0935243c4499da8cd48696f6868e8e4166642ab5.tar.gz
platform_hardware_interfaces-0935243c4499da8cd48696f6868e8e4166642ab5.tar.bz2
platform_hardware_interfaces-0935243c4499da8cd48696f6868e8e4166642ab5.zip
Merge "Fix VTS test for health HAL 2.1"
Diffstat (limited to 'health')
-rw-r--r--health/2.1/types.hal3
-rw-r--r--health/2.1/vts/functional/VtsHalHealthV2_1TargetTest.cpp14
2 files changed, 10 insertions, 7 deletions
diff --git a/health/2.1/types.hal b/health/2.1/types.hal
index d99f63f92f..be1eaf8262 100644
--- a/health/2.1/types.hal
+++ b/health/2.1/types.hal
@@ -85,9 +85,10 @@ struct HealthInfo {
/**
* Estimated battery full charge design capacity (in microamp hours, uAh).
- * batteryFullCharge must be less than (value * 1000).
* Value must be 0 if unknown.
* Value must be positive if known.
+ * Value must be greater than 100 000 uAh.
+ * Value must be less than 100 000 000 uAh.
*/
int32_t batteryFullChargeDesignCapacityUah;
};
diff --git a/health/2.1/vts/functional/VtsHalHealthV2_1TargetTest.cpp b/health/2.1/vts/functional/VtsHalHealthV2_1TargetTest.cpp
index ea69527ae3..deb1a29b37 100644
--- a/health/2.1/vts/functional/VtsHalHealthV2_1TargetTest.cpp
+++ b/health/2.1/vts/functional/VtsHalHealthV2_1TargetTest.cpp
@@ -219,6 +219,9 @@ AssertionResult IsEnum(T value) {
return AssertionFailure() << static_cast<std::underlying_type_t<T>>(value) << " is not valid";
}
+#define FULL_CHARGE_DESIGN_CAP_MIN ((long)100 * 1000)
+#define FULL_CHARGE_DESIGN_CAP_MAX ((long)100000 * 1000)
+
/*
* Tests the values returned by getHealthInfo() from interface IHealth.
*/
@@ -235,12 +238,11 @@ TEST_P(HealthHidlTest, getHealthInfo_2_1) {
EXPECT_GE(value.batteryFullChargeDesignCapacityUah, 0)
<< "batteryFullChargeDesignCapacityUah should not be negative";
- // Check for extreme outliers
- const auto& legacy = value.legacy.legacy;
- if (value.batteryFullChargeDesignCapacityUah > 0) {
- EXPECT_LT((long)legacy.batteryFullCharge,
- ((long)value.batteryFullChargeDesignCapacityUah * 1000));
- }
+ EXPECT_GT((long)value.batteryFullChargeDesignCapacityUah, FULL_CHARGE_DESIGN_CAP_MIN)
+ << "batteryFullChargeDesignCapacityUah should be greater than 100 mAh";
+
+ EXPECT_LT((long)value.batteryFullChargeDesignCapacityUah, FULL_CHARGE_DESIGN_CAP_MAX)
+ << "batteryFullChargeDesignCapacityUah should be less than 100,000 mAh";
})));
}