diff --git a/mc/gen/spline_test.go b/mc/gen/spline_test.go index 7d14f4e..882ef6c 100644 --- a/mc/gen/spline_test.go +++ b/mc/gen/spline_test.go @@ -1,10 +1,14 @@ package gen -import "testing" +import ( + "math" + "testing" +) func TestSpline(t *testing.T) { - v := BiomeDepthSpline.Sample([]float32{0.236413047, 0.220234469, 0.139604524, -0.339296669}) - if v != 0.025035858154296875 { - t.Errorf("bad value: %f", v) + v := BiomeDepthSpline.Sample([]float32{0.236413047, 0.139604524, -0.339296669, 0.220234469}) + var e float32 = 0.025035858154296875 - 0.015 + if math.Abs(float64(e-v)) > 1e-8 { // float impercision + t.Errorf("bad value: %f != %f", v, e) } }