[commands] Merge CommandBase into Command and SubsystemBase into Subsystem (#5392)

Moves all CommandBase functionality into Command and deprecates CommandBase for removal.
Moves all SubsystemBase functionality into Subsystem and deprecates SubsystemBase for removal.
Adds a function to CommandScheduler to remove all registered Subsystems.
This commit is contained in:
Ryan Blue
2023-07-14 01:12:01 -04:00
committed by GitHub
parent 7ac932996a
commit aaea85ff16
176 changed files with 887 additions and 910 deletions

View File

@@ -12,14 +12,14 @@
#include "frc2/command/CommandHelper.h"
#include "frc2/command/CommandScheduler.h"
#include "frc2/command/SetUtilities.h"
#include "frc2/command/SubsystemBase.h"
#include "frc2/command/Subsystem.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "make_vector.h"
namespace frc2 {
class TestSubsystem : public SubsystemBase {
class TestSubsystem : public Subsystem {
public:
explicit TestSubsystem(std::function<void()> periodic = [] {})
: m_periodic{periodic} {}
@@ -32,7 +32,7 @@ class TestSubsystem : public SubsystemBase {
/**
* NOTE: Moving mock objects causes EXPECT_CALL to not work correctly!
*/
class MockCommand : public CommandHelper<CommandBase, MockCommand> {
class MockCommand : public CommandHelper<Command, MockCommand> {
public:
MOCK_CONST_METHOD0(GetRequirements, wpi::SmallSet<Subsystem*, 4>());
MOCK_METHOD0(IsFinished, bool());
@@ -107,12 +107,14 @@ class CommandTestBaseWithParam : public ::testing::TestWithParam<T> {
scheduler.CancelAll();
scheduler.Enable();
scheduler.GetActiveButtonLoop()->Clear();
scheduler.UnregisterAllSubsystems();
SetDSEnabled(true);
}
~CommandTestBaseWithParam() override {
CommandScheduler::GetInstance().GetActiveButtonLoop()->Clear();
CommandScheduler::GetInstance().UnregisterAllSubsystems();
}
protected: