Time for action - unit testing during maintenance
Our client has come to us with a change request: they don't want the
PID class to accept negative gain values in its constructor, because negative gains make its output push things further away from the
setpoint, instead of pulling them toward it.
- We add new tests that describe what should happen when negative gains are passed to the constructor. We're testing something that the old tests don't describe, so we get to leave the old tests alone and just add new tests. That's a good thing, because it means that the old tests will be certain to catch any regressions that we might introduce while we're working on this.
It's important that the P, I and D gains not be negative. >>> pid = reload(pid) >>> ...