Loading automotive/vehicle/2.0/default/tests/RecurrentTimer_test.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -41,7 +41,8 @@ TEST(RecurrentTimerTest, oneInterval) { timer.registerRecurrentEvent(milliseconds(1), 0xdead); std::this_thread::sleep_for(milliseconds(100)); ASSERT_EQ_WITH_TOLERANCE(100, counter.load(), 20); // This test is unstable, so set the tolerance to 50. ASSERT_EQ_WITH_TOLERANCE(100, counter.load(), 50); } TEST(RecurrentTimerTest, multipleIntervals) { Loading @@ -66,7 +67,8 @@ TEST(RecurrentTimerTest, multipleIntervals) { timer.registerRecurrentEvent(milliseconds(5), 0xbeef); std::this_thread::sleep_for(milliseconds(100)); ASSERT_EQ_WITH_TOLERANCE(100, counter1ms.load(), 20); // This test is unstable, so set the tolerance to 50. ASSERT_EQ_WITH_TOLERANCE(100, counter1ms.load(), 50); ASSERT_EQ_WITH_TOLERANCE(20, counter5ms.load(), 5); } Loading automotive/vehicle/2.0/default/tests/VehicleObjectPool_test.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -58,10 +58,12 @@ public: TEST_F(VehicleObjectPoolTest, valuePoolBasicCorrectness) { auto value = valuePool->obtain(VehiclePropertyType::INT32); // At this point, v1 should be recycled and the only object in the pool. ASSERT_EQ(value.get(), valuePool->obtain(VehiclePropertyType::INT32).get()); void* raw = value.get(); value.reset(); // At this point, value should be recycled and the only object in the pool. ASSERT_EQ(raw, valuePool->obtain(VehiclePropertyType::INT32).get()); // Obtaining value of another type - should return a new object ASSERT_NE(value.get(), valuePool->obtain(VehiclePropertyType::FLOAT).get()); ASSERT_NE(raw, valuePool->obtain(VehiclePropertyType::FLOAT).get()); ASSERT_EQ(3u, stats->Obtained); ASSERT_EQ(2u, stats->Created); Loading Loading
automotive/vehicle/2.0/default/tests/RecurrentTimer_test.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -41,7 +41,8 @@ TEST(RecurrentTimerTest, oneInterval) { timer.registerRecurrentEvent(milliseconds(1), 0xdead); std::this_thread::sleep_for(milliseconds(100)); ASSERT_EQ_WITH_TOLERANCE(100, counter.load(), 20); // This test is unstable, so set the tolerance to 50. ASSERT_EQ_WITH_TOLERANCE(100, counter.load(), 50); } TEST(RecurrentTimerTest, multipleIntervals) { Loading @@ -66,7 +67,8 @@ TEST(RecurrentTimerTest, multipleIntervals) { timer.registerRecurrentEvent(milliseconds(5), 0xbeef); std::this_thread::sleep_for(milliseconds(100)); ASSERT_EQ_WITH_TOLERANCE(100, counter1ms.load(), 20); // This test is unstable, so set the tolerance to 50. ASSERT_EQ_WITH_TOLERANCE(100, counter1ms.load(), 50); ASSERT_EQ_WITH_TOLERANCE(20, counter5ms.load(), 5); } Loading
automotive/vehicle/2.0/default/tests/VehicleObjectPool_test.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -58,10 +58,12 @@ public: TEST_F(VehicleObjectPoolTest, valuePoolBasicCorrectness) { auto value = valuePool->obtain(VehiclePropertyType::INT32); // At this point, v1 should be recycled and the only object in the pool. ASSERT_EQ(value.get(), valuePool->obtain(VehiclePropertyType::INT32).get()); void* raw = value.get(); value.reset(); // At this point, value should be recycled and the only object in the pool. ASSERT_EQ(raw, valuePool->obtain(VehiclePropertyType::INT32).get()); // Obtaining value of another type - should return a new object ASSERT_NE(value.get(), valuePool->obtain(VehiclePropertyType::FLOAT).get()); ASSERT_NE(raw, valuePool->obtain(VehiclePropertyType::FLOAT).get()); ASSERT_EQ(3u, stats->Obtained); ASSERT_EQ(2u, stats->Created); Loading