2019-08-25 23:55:59 -04:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2020-09-27 13:27:53 -07:00
|
|
|
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
2019-08-25 23:55:59 -04:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
2020-09-27 13:27:53 -07:00
|
|
|
#include <frc/simulation/SimHooks.h>
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
#include "CommandTestBase.h"
|
|
|
|
|
#include "frc2/command/WaitCommand.h"
|
|
|
|
|
#include "frc2/command/WaitUntilCommand.h"
|
|
|
|
|
|
|
|
|
|
using namespace frc2;
|
|
|
|
|
class WaitCommandTest : public CommandTestBase {};
|
|
|
|
|
|
|
|
|
|
TEST_F(WaitCommandTest, WaitCommandScheduleTest) {
|
2020-09-27 13:27:53 -07:00
|
|
|
frc::sim::PauseTiming();
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
CommandScheduler scheduler = GetScheduler();
|
|
|
|
|
|
2019-11-20 21:48:16 -08:00
|
|
|
WaitCommand command(100_ms);
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
scheduler.Schedule(&command);
|
|
|
|
|
scheduler.Run();
|
|
|
|
|
EXPECT_TRUE(scheduler.IsScheduled(&command));
|
2020-09-27 13:27:53 -07:00
|
|
|
frc::sim::StepTiming(110_ms);
|
2019-08-25 23:55:59 -04:00
|
|
|
scheduler.Run();
|
|
|
|
|
EXPECT_FALSE(scheduler.IsScheduled(&command));
|
2020-09-27 13:27:53 -07:00
|
|
|
|
|
|
|
|
frc::sim::ResumeTiming();
|
2019-08-25 23:55:59 -04:00
|
|
|
}
|