From 1bf90fa404321271f7ba67aabc1cc11543492144 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Mon, 26 Feb 2024 11:14:36 -0800 Subject: [PATCH] Fix a bug in VUR VTS test. The logic is to check whether each element is not the same as previous element. We forgot to increase i. Test: Presubmit Bug: 326987403 Change-Id: I5cab61a86092fb14d17551a533e8cdaff1abfee5 --- .../vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index ccc0f3f91c..4ea6dfe5f2 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -640,13 +640,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, subscribe_enableVurIfSupported) { size_t i = 0; float previousValue; for (const auto& [_, value] : valuesByTimestamp) { - if (i == 0) { - previousValue = value; - } else { + if (i != 0) { ASSERT_FALSE(value != previousValue) << "received duplicate value: " << value << " when variable update rate is true"; - previousValue = value; } + previousValue = value; + i++; } }