mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[wpilib] Add Timer.isRunning() method (#7220)
This commit is contained in:
@@ -35,18 +35,22 @@ class TimerTest {
|
||||
|
||||
// Verify timer is initialized as stopped
|
||||
assertEquals(timer.get(), 0.0);
|
||||
assertFalse(timer.isRunning());
|
||||
SimHooks.stepTiming(0.5);
|
||||
assertEquals(timer.get(), 0.0);
|
||||
assertFalse(timer.isRunning());
|
||||
|
||||
// Verify timer increments after it's started
|
||||
timer.start();
|
||||
SimHooks.stepTiming(0.5);
|
||||
assertEquals(timer.get(), 0.5, 1e-9);
|
||||
assertTrue(timer.isRunning());
|
||||
|
||||
// Verify timer stops incrementing after it's stopped
|
||||
timer.stop();
|
||||
SimHooks.stepTiming(0.5);
|
||||
assertEquals(timer.get(), 0.5, 1e-9);
|
||||
assertFalse(timer.isRunning());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user