mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpilibc] Clean up integration tests (#3400)
The command and shuffleboard integration tests were removed because their unit tests counterparts already provide adequate coverage. Java already removed these.
This commit is contained in:
@@ -9,35 +9,15 @@
|
||||
|
||||
#include "TestBench.h"
|
||||
#include "frc/Timer.h"
|
||||
#include "frc/motorcontrol/Jaguar.h"
|
||||
#include "frc/motorcontrol/Talon.h"
|
||||
#include "frc/motorcontrol/Victor.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
static constexpr auto kMotorTime = 0.25_s;
|
||||
|
||||
class PowerDistributionPanelTest : public testing::Test {
|
||||
protected:
|
||||
PowerDistributionPanel* m_pdp;
|
||||
Talon* m_talon;
|
||||
Victor* m_victor;
|
||||
Jaguar* m_jaguar;
|
||||
|
||||
void SetUp() override {
|
||||
m_pdp = new PowerDistributionPanel();
|
||||
m_talon = new Talon(TestBench::kTalonChannel);
|
||||
m_victor = new Victor(TestBench::kVictorChannel);
|
||||
m_jaguar = new Jaguar(TestBench::kJaguarChannel);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
delete m_pdp;
|
||||
delete m_talon;
|
||||
delete m_victor;
|
||||
delete m_jaguar;
|
||||
}
|
||||
frc::PowerDistributionPanel m_pdp;
|
||||
frc::Talon m_talon{TestBench::kTalonChannel};
|
||||
};
|
||||
|
||||
TEST_F(PowerDistributionPanelTest, CheckRepeatedCalls) {
|
||||
@@ -45,28 +25,28 @@ TEST_F(PowerDistributionPanelTest, CheckRepeatedCalls) {
|
||||
// 1 second
|
||||
for (int i = 0; i < 50; i++) {
|
||||
for (int j = 0; j < numChannels; j++) {
|
||||
m_pdp->GetCurrent(j);
|
||||
m_pdp.GetCurrent(j);
|
||||
}
|
||||
m_pdp->GetVoltage();
|
||||
m_pdp.GetVoltage();
|
||||
}
|
||||
Wait(20_ms);
|
||||
frc::Wait(20_ms);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the current changes when the motor is driven using a talon
|
||||
*/
|
||||
TEST_F(PowerDistributionPanelTest, CheckCurrentTalon) {
|
||||
Wait(kMotorTime);
|
||||
frc::Wait(kMotorTime);
|
||||
|
||||
/* The Current should be 0 */
|
||||
EXPECT_FLOAT_EQ(0, m_pdp->GetCurrent(TestBench::kTalonPDPChannel))
|
||||
EXPECT_FLOAT_EQ(0, m_pdp.GetCurrent(TestBench::kTalonPDPChannel))
|
||||
<< "The Talon current was non-zero";
|
||||
|
||||
/* Set the motor to full forward */
|
||||
m_talon->Set(1.0);
|
||||
Wait(kMotorTime);
|
||||
m_talon.Set(1.0);
|
||||
frc::Wait(kMotorTime);
|
||||
|
||||
/* The current should now be positive */
|
||||
ASSERT_GT(m_pdp->GetCurrent(TestBench::kTalonPDPChannel), 0)
|
||||
ASSERT_GT(m_pdp.GetCurrent(TestBench::kTalonPDPChannel), 0)
|
||||
<< "The Talon current was not positive";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user