Files
allwpilib/commandsv2/src/test/native/cpp/wpi/command/RunCommandTest.cpp

27 lines
672 B
C++
Raw Normal View History

// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/commands2/RunCommand.hpp"
2025-11-07 19:56:21 -05:00
#include "CommandTestBase.hpp"
2025-11-07 19:57:55 -05:00
#include "wpi/commands2/Commands.hpp"
2025-11-07 20:00:05 -05:00
using namespace wpi::cmd;
class RunCommandTest : public CommandTestBase {};
TEST_F(RunCommandTest, RunCommandSchedule) {
CommandScheduler scheduler = GetScheduler();
int counter = 0;
auto command = cmd::Run([&counter] { counter++; });
scheduler.Schedule(command);
scheduler.Run();
scheduler.Run();
scheduler.Run();
EXPECT_EQ(3, counter);
}