mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[hal, wpilib] Rewrite CAN APIs (#7798)
This commit is contained in:
@@ -22,14 +22,14 @@ TEST(CTREPCMSimTest, InitializedCallback) {
|
||||
BooleanCallback callback;
|
||||
auto cb = sim.RegisterInitializedCallback(callback.GetCallback(), false);
|
||||
|
||||
PneumaticsControlModule pcm;
|
||||
PneumaticsControlModule pcm{0};
|
||||
EXPECT_TRUE(sim.GetInitialized());
|
||||
EXPECT_TRUE(callback.WasTriggered());
|
||||
EXPECT_TRUE(callback.GetLastValue());
|
||||
}
|
||||
|
||||
TEST(CTREPCMSimTest, SolenoidOutput) {
|
||||
PneumaticsControlModule pcm;
|
||||
PneumaticsControlModule pcm{0};
|
||||
CTREPCMSim sim(pcm);
|
||||
sim.ResetData();
|
||||
|
||||
@@ -80,7 +80,7 @@ TEST(CTREPCMSimTest, SolenoidOutput) {
|
||||
}
|
||||
|
||||
TEST(CTREPCMSimTest, SetCompressorOn) {
|
||||
PneumaticsControlModule pcm;
|
||||
PneumaticsControlModule pcm{0};
|
||||
CTREPCMSim sim(pcm);
|
||||
sim.ResetData();
|
||||
|
||||
@@ -97,7 +97,7 @@ TEST(CTREPCMSimTest, SetCompressorOn) {
|
||||
}
|
||||
|
||||
TEST(CTREPCMSimTest, SetEnableDigital) {
|
||||
PneumaticsControlModule pcm;
|
||||
PneumaticsControlModule pcm{0};
|
||||
CTREPCMSim sim(pcm);
|
||||
sim.ResetData();
|
||||
|
||||
@@ -116,7 +116,7 @@ TEST(CTREPCMSimTest, SetEnableDigital) {
|
||||
}
|
||||
|
||||
TEST(CTREPCMSimTest, SetPressureSwitchEnabled) {
|
||||
PneumaticsControlModule pcm;
|
||||
PneumaticsControlModule pcm{0};
|
||||
CTREPCMSim sim(pcm);
|
||||
sim.ResetData();
|
||||
|
||||
@@ -133,7 +133,7 @@ TEST(CTREPCMSimTest, SetPressureSwitchEnabled) {
|
||||
}
|
||||
|
||||
TEST(CTREPCMSimTest, SetCompressorCurrent) {
|
||||
PneumaticsControlModule pcm;
|
||||
PneumaticsControlModule pcm{0};
|
||||
CTREPCMSim sim(pcm);
|
||||
sim.ResetData();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ TEST(PowerDistributionSimTest, Initialize) {
|
||||
BooleanCallback callback;
|
||||
|
||||
auto cb = sim.RegisterInitializedCallback(callback.GetCallback(), false);
|
||||
PowerDistribution pdp(2, frc::PowerDistribution::ModuleType::kCTRE);
|
||||
PowerDistribution pdp(0, 2, frc::PowerDistribution::ModuleType::kCTRE);
|
||||
EXPECT_TRUE(sim.GetInitialized());
|
||||
EXPECT_TRUE(callback.WasTriggered());
|
||||
EXPECT_TRUE(callback.GetLastValue());
|
||||
@@ -35,7 +35,7 @@ TEST(PowerDistributionSimTest, Initialize) {
|
||||
|
||||
TEST(PowerDistributionSimTest, SetTemperature) {
|
||||
HAL_Initialize(500, 0);
|
||||
PowerDistribution pdp{2, frc::PowerDistribution::ModuleType::kCTRE};
|
||||
PowerDistribution pdp{0, 2, frc::PowerDistribution::ModuleType::kCTRE};
|
||||
PowerDistributionSim sim(pdp);
|
||||
|
||||
DoubleCallback callback;
|
||||
@@ -50,7 +50,7 @@ TEST(PowerDistributionSimTest, SetTemperature) {
|
||||
|
||||
TEST(PowerDistributionSimTest, SetVoltage) {
|
||||
HAL_Initialize(500, 0);
|
||||
PowerDistribution pdp{2, frc::PowerDistribution::ModuleType::kCTRE};
|
||||
PowerDistribution pdp{0, 2, frc::PowerDistribution::ModuleType::kCTRE};
|
||||
PowerDistributionSim sim(pdp);
|
||||
|
||||
DoubleCallback callback;
|
||||
@@ -65,7 +65,7 @@ TEST(PowerDistributionSimTest, SetVoltage) {
|
||||
|
||||
TEST(PowerDistributionSimTest, SetCurrent) {
|
||||
HAL_Initialize(500, 0);
|
||||
PowerDistribution pdp{2, frc::PowerDistribution::ModuleType::kCTRE};
|
||||
PowerDistribution pdp{0, 2, frc::PowerDistribution::ModuleType::kCTRE};
|
||||
PowerDistributionSim sim(pdp);
|
||||
|
||||
for (int channel = 0; channel < HAL_GetNumCTREPDPChannels(); ++channel) {
|
||||
@@ -84,7 +84,7 @@ TEST(PowerDistributionSimTest, SetCurrent) {
|
||||
|
||||
TEST(PowerDistributionSimTest, GetAllCurrents) {
|
||||
HAL_Initialize(500, 0);
|
||||
PowerDistribution pdp{2, frc::PowerDistribution::ModuleType::kRev};
|
||||
PowerDistribution pdp{0, 2, frc::PowerDistribution::ModuleType::kRev};
|
||||
PowerDistributionSim sim(pdp);
|
||||
|
||||
// setup
|
||||
|
||||
@@ -22,18 +22,18 @@ TEST(REVPHSimTest, InitializedCallback) {
|
||||
BooleanCallback callback;
|
||||
auto cb = sim.RegisterInitializedCallback(callback.GetCallback(), false);
|
||||
|
||||
PneumaticHub ph;
|
||||
PneumaticHub ph{0};
|
||||
EXPECT_TRUE(sim.GetInitialized());
|
||||
EXPECT_TRUE(callback.WasTriggered());
|
||||
EXPECT_TRUE(callback.GetLastValue());
|
||||
}
|
||||
|
||||
TEST(REVPHSimTest, SolenoidOutput) {
|
||||
PneumaticHub ph;
|
||||
PneumaticHub ph{0};
|
||||
REVPHSim sim(ph);
|
||||
sim.ResetData();
|
||||
|
||||
DoubleSolenoid doubleSolenoid{1, frc::PneumaticsModuleType::REVPH, 3, 4};
|
||||
DoubleSolenoid doubleSolenoid{0, 1, frc::PneumaticsModuleType::REVPH, 3, 4};
|
||||
|
||||
BooleanCallback callback3;
|
||||
BooleanCallback callback4;
|
||||
@@ -80,7 +80,7 @@ TEST(REVPHSimTest, SolenoidOutput) {
|
||||
}
|
||||
|
||||
TEST(REVPHSimTest, SetCompressorOn) {
|
||||
PneumaticHub ph;
|
||||
PneumaticHub ph{0};
|
||||
REVPHSim sim(ph);
|
||||
sim.ResetData();
|
||||
|
||||
@@ -97,7 +97,7 @@ TEST(REVPHSimTest, SetCompressorOn) {
|
||||
}
|
||||
|
||||
TEST(REVPHSimTest, SetEnableDigital) {
|
||||
PneumaticHub ph;
|
||||
PneumaticHub ph{0};
|
||||
REVPHSim sim(ph);
|
||||
sim.ResetData();
|
||||
|
||||
@@ -118,7 +118,7 @@ TEST(REVPHSimTest, SetEnableDigital) {
|
||||
}
|
||||
|
||||
TEST(REVPHSimTest, SetEnableAnalog) {
|
||||
PneumaticHub ph;
|
||||
PneumaticHub ph{0};
|
||||
REVPHSim sim(ph);
|
||||
sim.ResetData();
|
||||
|
||||
@@ -139,7 +139,7 @@ TEST(REVPHSimTest, SetEnableAnalog) {
|
||||
}
|
||||
|
||||
TEST(REVPHSimTest, SetEnableHybrid) {
|
||||
PneumaticHub ph;
|
||||
PneumaticHub ph{0};
|
||||
REVPHSim sim(ph);
|
||||
sim.ResetData();
|
||||
|
||||
@@ -160,7 +160,7 @@ TEST(REVPHSimTest, SetEnableHybrid) {
|
||||
}
|
||||
|
||||
TEST(REVPHSimTest, SetPressureSwitchEnabled) {
|
||||
PneumaticHub ph;
|
||||
PneumaticHub ph{0};
|
||||
REVPHSim sim(ph);
|
||||
sim.ResetData();
|
||||
|
||||
@@ -177,7 +177,7 @@ TEST(REVPHSimTest, SetPressureSwitchEnabled) {
|
||||
}
|
||||
|
||||
TEST(REVPHSimTest, SetCompressorCurrent) {
|
||||
PneumaticHub ph;
|
||||
PneumaticHub ph{0};
|
||||
REVPHSim sim(ph);
|
||||
sim.ResetData();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user