From 0cb3190ea577f59cc6baf2eda82b66485b8bdf22 Mon Sep 17 00:00:00 2001 From: Prashant Khoje Date: Tue, 24 May 2022 11:19:11 +0000 Subject: [PATCH] ppc64le - fix test failures of TestBoundingBoxFromGeomT/GeographyType --- pkg/geo/bbox_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/geo/bbox_test.go b/pkg/geo/bbox_test.go index 6220ecc76ef1..e8547f4d8ac8 100644 --- a/pkg/geo/bbox_test.go +++ b/pkg/geo/bbox_test.go @@ -12,6 +12,7 @@ package geo import ( "fmt" + "math" "strconv" "testing" @@ -184,6 +185,22 @@ func TestBoundingBoxFromGeomT(t *testing.T) { t.Run(fmt.Sprintf("%s: %#v", tc.soType, tc.g), func(t *testing.T) { bbox, err := boundingBoxFromGeomT(tc.g, tc.soType) require.NoError(t, err) + // If bbox is within a small epsilon of expected, use the same values. + if bbox != nil && tc.expected != nil { + const epsilon = 0.000001 + if math.Abs(bbox.LoX-tc.expected.LoX) < epsilon { + bbox.LoX = tc.expected.LoX + } + if math.Abs(bbox.HiX-tc.expected.HiX) < epsilon { + bbox.HiX = tc.expected.HiX + } + if math.Abs(bbox.LoY-tc.expected.LoY) < epsilon { + bbox.LoY = tc.expected.LoY + } + if math.Abs(bbox.HiY-tc.expected.HiY) < epsilon { + bbox.HiY = tc.expected.HiY + } + } require.Equal(t, tc.expected, bbox) }) }