11#include " gmock/gmock.h"
22#include " gtest/gtest.h"
33
4- #include " MockRuntime.hpp"
54#include " DirectionlessOdometer.hpp"
5+ #include " MockRuntime.hpp"
66
77using namespace ::testing;
88using namespace smartcarlib ::constants::odometer;
99
1010namespace
1111{
12- const int8_t kNotAnInterrupt = -1 ;
13- const int8_t kAnInterrupt = 1 ;
14- const uint8_t kRisingEdge = 1 ;
15- const uint8_t kInput = 0 ;
16- const unsigned long kMinimumPulseGap = 700 ;
12+ const int8_t kNotAnInterrupt = -1 ;
13+ const int8_t kAnInterrupt = 1 ;
14+ const uint8_t kRisingEdge = 3 ;
15+ const uint8_t kInput = 0 ;
16+ const unsigned long kMinimumPulseGap = 700 ;
1717} // namespace
1818
1919class DirectionlessOdometerBasicTest : public Test
@@ -56,10 +56,14 @@ class DirectionlessOdometerAttachedTest : public DirectionlessOdometerBasicTest
5656class DirectionlessOdometerBadPulsesPerMeter : public DirectionlessOdometerBasicTest
5757{
5858public:
59- DirectionlessOdometerBadPulsesPerMeter () : DirectionlessOdometerBasicTest(0 ) {}
59+ DirectionlessOdometerBadPulsesPerMeter ()
60+ : DirectionlessOdometerBasicTest(0 )
61+ {
62+ }
6063};
6164
62- TEST_F (DirectionlessOdometerBadPulsesPerMeter, constructor_WhenCalledWithZeroPulsesPerMeter_WillNotDivideByZero)
65+ TEST_F (DirectionlessOdometerBadPulsesPerMeter,
66+ constructor_WhenCalledWithZeroPulsesPerMeter_WillNotDivideByZero)
6367{
6468 // Providing `0` as the argument to pulses per meter should not cause the constructor
6569 // to crash due to a division by zero
@@ -191,7 +195,8 @@ TEST_F(DirectionlessOdometerAttachedTest, update_WhenPulsesTooClose_WillIgnorePu
191195 EXPECT_EQ (mDirectionlessOdometer .getDistance (), initialDistance);
192196}
193197
194- TEST_F (DirectionlessOdometerAttachedTest, update_WhenFirstPulseArrives_WillCalculateDistanceButNotSpeed)
198+ TEST_F (DirectionlessOdometerAttachedTest,
199+ update_WhenFirstPulseArrives_WillCalculateDistanceButNotSpeed)
195200{
196201 unsigned long firstPulse = 2000 ;
197202 EXPECT_CALL (mRuntime , currentTimeMicros ()).WillOnce (Return (firstPulse));
@@ -202,7 +207,8 @@ TEST_F(DirectionlessOdometerAttachedTest, update_WhenFirstPulseArrives_WillCalcu
202207 EXPECT_FLOAT_EQ (mDirectionlessOdometer .getSpeed (), 0 );
203208}
204209
205- TEST_F (DirectionlessOdometerAttachedTest, update_WhenFirstPulseArrivesFast_WillCalculateDistanceButNotSpeed)
210+ TEST_F (DirectionlessOdometerAttachedTest,
211+ update_WhenFirstPulseArrivesFast_WillCalculateDistanceButNotSpeed)
206212{
207213 unsigned long firstPulse = kMinimumPulseGap - 1 ;
208214 EXPECT_CALL (mRuntime , currentTimeMicros ()).WillOnce (Return (firstPulse));
0 commit comments