@@ -51,12 +51,9 @@ TEST_F(TripTest, IgnoreLowSpeed) {
5151 EXPECT_FLOAT_EQ (trip.getDistanceKm (), 0 .0f );
5252}
5353
54- TEST_F (TripTest, TimeFormatting) {
55- char buffer[32 ];
56-
54+ TEST_F (TripTest, MovingTimeCalculation) {
5755 // Test 0
58- trip.getMovingTimeStr (buffer, sizeof (buffer));
59- EXPECT_STREQ (buffer, " 00:00" );
56+ EXPECT_EQ (trip.getMovingTimeMs (), 0 );
6057
6158 // Test 1h 1m 1s = 3600 + 60 + 1 = 3661 sec = 3661000 ms
6259 // Manually injecting moving time via update logic is hard without specific speed profile.
@@ -69,8 +66,7 @@ TEST_F(TripTest, TimeFormatting) {
6966 now += 3661000 ;
7067 trip.update (createNavData (10 .0f ), now); // Moving, so adds to moving time
7168
72- trip.getMovingTimeStr (buffer, sizeof (buffer));
73- EXPECT_STREQ (buffer, " 01:01" );
69+ EXPECT_EQ (trip.getMovingTimeMs (), 3661000 );
7470}
7571
7672TEST_F (TripTest, CalculateAvgSpeed) {
@@ -111,15 +107,12 @@ TEST_F(TripTest, StopMovingDoesNotIncreaseMovingTime) {
111107 trip.update (createNavData (10 .0f ), now); // Moving for 1 hour
112108 // movingTime = 1h
113109
114- char buffer[32 ];
115- trip.getMovingTimeStr (buffer, sizeof (buffer));
116- // 1h -> 01:00
117- EXPECT_STREQ (buffer, " 01:00" );
110+ // 1h -> 3600000ms
111+ EXPECT_EQ (trip.getMovingTimeMs (), 3600000 );
118112
119113 now += 3600000 ; // Another hour passes...
120114 trip.update (createNavData (0 .0f ), now); // ...but not moving
121115 // movingTime should stay 1h
122116
123- trip.getMovingTimeStr (buffer, sizeof (buffer));
124- EXPECT_STREQ (buffer, " 01:00" );
117+ EXPECT_EQ (trip.getMovingTimeMs (), 3600000 );
125118}
0 commit comments