Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sciencewhiz committed Jan 7, 2023
1 parent 1f94532 commit 8ea0fe6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,4 @@ void derivativeGainOutputTest() {

assertEquals(-0.01 / m_controller.getPeriod(), m_controller.calculate(0.0025, 0), 1e-5);
}

@Test
void atSetpointTest() {
m_controller.reset();
assertFalse(m_controller.atSetpoint());
m_controller.setTolerance(2);
assertFalse(m_controller.atSetpoint());
m_controller.setSetpoint(0);
assertFalse(m_controller.atSetpoint());
m_controller.calculate(0);
assertTrue(m_controller.atSetpoint());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void initialToleranceTest() {
try (var controller = new PIDController(0.05, 0.0, 0.0)) {
controller.enableContinuousInput(-kRange / 2, kRange / 2);

assertTrue(controller.atSetpoint());
assertFalse(controller.atSetpoint());
}
}

Expand All @@ -28,10 +28,7 @@ void absoluteToleranceTest() {
try (var controller = new PIDController(0.05, 0.0, 0.0)) {
controller.enableContinuousInput(-kRange / 2, kRange / 2);

assertTrue(
controller.atSetpoint(),
"Error was not in tolerance when it should have been. Error was "
+ controller.getPositionError());
assertFalse(controller.atSetpoint());

controller.setTolerance(kTolerance);
controller.setSetpoint(kSetpoint);
Expand Down

0 comments on commit 8ea0fe6

Please sign in to comment.