Loading sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -24,7 +24,9 @@ #include <log/log.h> #include <utils/SystemClock.h> #include <algorithm> #include <cinttypes> #include <unordered_map> #include <vector> using ::android::hardware::Return; Loading Loading @@ -149,6 +151,7 @@ std::vector<SensorInfo> SensorsHidlTest::getSensorsList() { TEST_P(SensorsHidlTest, SensorListValid) { S()->getSensorsList([&](const auto& list) { const size_t count = list.size(); std::unordered_map<int32_t, std::vector<std::string>> sensorTypeNameMap; for (size_t i = 0; i < count; ++i) { const auto& s = list[i]; SCOPED_TRACE(::testing::Message() Loading @@ -167,6 +170,14 @@ TEST_P(SensorsHidlTest, SensorListValid) { EXPECT_FALSE(s.name.empty()); EXPECT_FALSE(s.vendor.empty()); // Make sure that sensors of the same type have a unique name. std::vector<std::string>& v = sensorTypeNameMap[static_cast<int32_t>(s.type)]; bool isUniqueName = std::find(v.begin(), v.end(), s.name) == v.end(); EXPECT_TRUE(isUniqueName) << "Duplicate sensor Name: " << s.name; if (isUniqueName) { v.push_back(s.name); } // Test power > 0, maxRange > 0 EXPECT_LE(0, s.power); EXPECT_LT(0, s.maxRange); Loading sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h +11 −0 Original line number Diff line number Diff line Loading @@ -26,10 +26,12 @@ #include <log/log.h> #include <utils/SystemClock.h> #include <algorithm> #include <cinttypes> #include <condition_variable> #include <cstring> #include <map> #include <unordered_map> #include <vector> /** Loading Loading @@ -373,6 +375,7 @@ int32_t SensorsHidlTest::getInvalidSensorHandle() { TEST_P(SensorsHidlTest, SensorListValid) { getSensors()->getSensorsList([&](const auto& list) { const size_t count = list.size(); std::unordered_map<int32_t, std::vector<std::string>> sensorTypeNameMap; for (size_t i = 0; i < count; ++i) { const auto& s = list[i]; SCOPED_TRACE(::testing::Message() Loading @@ -393,6 +396,14 @@ TEST_P(SensorsHidlTest, SensorListValid) { EXPECT_FALSE(s.name.empty()); EXPECT_FALSE(s.vendor.empty()); // Make sure that sensors of the same type have a unique name. std::vector<std::string>& v = sensorTypeNameMap[static_cast<int32_t>(s.type)]; bool isUniqueName = std::find(v.begin(), v.end(), s.name) == v.end(); EXPECT_TRUE(isUniqueName) << "Duplicate sensor Name: " << s.name; if (isUniqueName) { v.push_back(s.name); } // Test power > 0, maxRange > 0 EXPECT_LE(0, s.power); EXPECT_LT(0, s.maxRange); Loading Loading
sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -24,7 +24,9 @@ #include <log/log.h> #include <utils/SystemClock.h> #include <algorithm> #include <cinttypes> #include <unordered_map> #include <vector> using ::android::hardware::Return; Loading Loading @@ -149,6 +151,7 @@ std::vector<SensorInfo> SensorsHidlTest::getSensorsList() { TEST_P(SensorsHidlTest, SensorListValid) { S()->getSensorsList([&](const auto& list) { const size_t count = list.size(); std::unordered_map<int32_t, std::vector<std::string>> sensorTypeNameMap; for (size_t i = 0; i < count; ++i) { const auto& s = list[i]; SCOPED_TRACE(::testing::Message() Loading @@ -167,6 +170,14 @@ TEST_P(SensorsHidlTest, SensorListValid) { EXPECT_FALSE(s.name.empty()); EXPECT_FALSE(s.vendor.empty()); // Make sure that sensors of the same type have a unique name. std::vector<std::string>& v = sensorTypeNameMap[static_cast<int32_t>(s.type)]; bool isUniqueName = std::find(v.begin(), v.end(), s.name) == v.end(); EXPECT_TRUE(isUniqueName) << "Duplicate sensor Name: " << s.name; if (isUniqueName) { v.push_back(s.name); } // Test power > 0, maxRange > 0 EXPECT_LE(0, s.power); EXPECT_LT(0, s.maxRange); Loading
sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h +11 −0 Original line number Diff line number Diff line Loading @@ -26,10 +26,12 @@ #include <log/log.h> #include <utils/SystemClock.h> #include <algorithm> #include <cinttypes> #include <condition_variable> #include <cstring> #include <map> #include <unordered_map> #include <vector> /** Loading Loading @@ -373,6 +375,7 @@ int32_t SensorsHidlTest::getInvalidSensorHandle() { TEST_P(SensorsHidlTest, SensorListValid) { getSensors()->getSensorsList([&](const auto& list) { const size_t count = list.size(); std::unordered_map<int32_t, std::vector<std::string>> sensorTypeNameMap; for (size_t i = 0; i < count; ++i) { const auto& s = list[i]; SCOPED_TRACE(::testing::Message() Loading @@ -393,6 +396,14 @@ TEST_P(SensorsHidlTest, SensorListValid) { EXPECT_FALSE(s.name.empty()); EXPECT_FALSE(s.vendor.empty()); // Make sure that sensors of the same type have a unique name. std::vector<std::string>& v = sensorTypeNameMap[static_cast<int32_t>(s.type)]; bool isUniqueName = std::find(v.begin(), v.end(), s.name) == v.end(); EXPECT_TRUE(isUniqueName) << "Duplicate sensor Name: " << s.name; if (isUniqueName) { v.push_back(s.name); } // Test power > 0, maxRange > 0 EXPECT_LE(0, s.power); EXPECT_LT(0, s.maxRange); Loading