mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpilib] Add Timer.isRunning() method (#7220)
This commit is contained in:
@@ -28,18 +28,22 @@ TEST_F(TimerTest, StartStop) {
|
||||
|
||||
// Verify timer is initialized as stopped
|
||||
EXPECT_EQ(timer.Get(), 0_s);
|
||||
EXPECT_FALSE(timer.IsRunning());
|
||||
frc::sim::StepTiming(500_ms);
|
||||
EXPECT_EQ(timer.Get(), 0_s);
|
||||
EXPECT_FALSE(timer.IsRunning());
|
||||
|
||||
// Verify timer increments after it's started
|
||||
timer.Start();
|
||||
frc::sim::StepTiming(500_ms);
|
||||
EXPECT_EQ(timer.Get(), 500_ms);
|
||||
EXPECT_TRUE(timer.IsRunning());
|
||||
|
||||
// Verify timer stops incrementing after it's stopped
|
||||
timer.Stop();
|
||||
frc::sim::StepTiming(500_ms);
|
||||
EXPECT_EQ(timer.Get(), 500_ms);
|
||||
EXPECT_FALSE(timer.IsRunning());
|
||||
}
|
||||
|
||||
TEST_F(TimerTest, Reset) {
|
||||
|
||||
Reference in New Issue
Block a user