23 lines
390 B
Go
23 lines
390 B
Go
package textex
|
|
|
|
import (
|
|
"math"
|
|
"testing"
|
|
)
|
|
|
|
func Close2(t *testing.T, left, right, epsilon float64) bool {
|
|
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)
|
|
return false
|
|
} else {
|
|
return true
|
|
}
|
|
}
|
|
|
|
func Close(t *testing.T, left, right float64) bool {
|
|
return Close2(t, left, right, 1e-9)
|
|
}
|