mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[commands] Test no-op behavior of scheduling a scheduled command (#4806)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "CommandTestBase.h"
|
||||
#include "frc2/command/InstantCommand.h"
|
||||
#include "frc2/command/RunCommand.h"
|
||||
#include "frc2/command/StartEndCommand.h"
|
||||
|
||||
using namespace frc2;
|
||||
class SchedulerTest : public CommandTestBase {};
|
||||
@@ -69,3 +70,16 @@ TEST_F(SchedulerTest, SchedulerCancelAll) {
|
||||
|
||||
EXPECT_EQ(counter, 2);
|
||||
}
|
||||
|
||||
TEST_F(SchedulerTest, ScheduleScheduledNoOp) {
|
||||
CommandScheduler scheduler = GetScheduler();
|
||||
|
||||
int counter = 0;
|
||||
|
||||
StartEndCommand command([&counter] { counter++; }, [] {});
|
||||
|
||||
scheduler.Schedule(&command);
|
||||
scheduler.Schedule(&command);
|
||||
|
||||
EXPECT_EQ(counter, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user