nppilot/rover/src/juju.net.nz/testex/testex.go
Michael Hope afa24fb872 Added mathex and testex packages.
Added a test target.
Switched the PID and anything else possible float32.
Changed TiLimit to be the total contribution.
Added a deadband.
2014-01-14 20:56:42 +01:00

28 lines
576 B
Go

package textex
import (
"math"
"testing"
)
func CheckClose2(t *testing.T, left, right, epsilon float64) {
err := math.Abs(left - right)
if err > epsilon {
t.Errorf("%v differs from %v by %v which is more than %v",
left, right, err, epsilon)
}
}
func CheckClose(t *testing.T, left, right float64) {
CheckClose2(t, left, right, 0.001)
}
func CheckClosef2(t *testing.T, left, right, epsilon float32) {
CheckClose2(t, float64(left), float64(right), float64(epsilon))
}
func CheckClosef(t *testing.T, left, right float32) {
CheckClosef2(t, left, right, 0.001)
}