Loading automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ using ::android::base::Result; using ::android::base::StringPrintf; using ::ndk::ScopedAStatus; constexpr float EPSILON = 0.0000001; constexpr float ONE_SECOND_IN_NANOS = 1'000'000'000.; SubscribeOptions newSubscribeOptions(int32_t propId, int32_t areaId, float sampleRateHz, Loading Loading @@ -88,7 +89,7 @@ bool SubscriptionManager::checkResolution(float resolution) { } float log = std::log10(resolution); return log == (int)log; return std::abs(log - std::round(log)) < EPSILON; } void ContSubConfigs::refreshCombinedConfig() { Loading automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -521,6 +521,8 @@ TEST_F(SubscriptionManagerTest, testCheckSampleRateHzInvalidZero) { } TEST_F(SubscriptionManagerTest, testCheckResolutionValid) { ASSERT_TRUE(SubscriptionManager::checkResolution(0.0)); ASSERT_TRUE(SubscriptionManager::checkResolution(0.1)); ASSERT_TRUE(SubscriptionManager::checkResolution(1.0)); } Loading Loading
automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ using ::android::base::Result; using ::android::base::StringPrintf; using ::ndk::ScopedAStatus; constexpr float EPSILON = 0.0000001; constexpr float ONE_SECOND_IN_NANOS = 1'000'000'000.; SubscribeOptions newSubscribeOptions(int32_t propId, int32_t areaId, float sampleRateHz, Loading Loading @@ -88,7 +89,7 @@ bool SubscriptionManager::checkResolution(float resolution) { } float log = std::log10(resolution); return log == (int)log; return std::abs(log - std::round(log)) < EPSILON; } void ContSubConfigs::refreshCombinedConfig() { Loading
automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -521,6 +521,8 @@ TEST_F(SubscriptionManagerTest, testCheckSampleRateHzInvalidZero) { } TEST_F(SubscriptionManagerTest, testCheckResolutionValid) { ASSERT_TRUE(SubscriptionManager::checkResolution(0.0)); ASSERT_TRUE(SubscriptionManager::checkResolution(0.1)); ASSERT_TRUE(SubscriptionManager::checkResolution(1.0)); } Loading