From 0cb3190ea577f59cc6baf2eda82b66485b8bdf22 Mon Sep 17 00:00:00 2001 From: Prashant Khoje Date: Tue, 24 May 2022 11:19:11 +0000 Subject: [PATCH 1/3] 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) }) } From 4fafba71b9cdca4ad7a3a01ae7e37824eff64eee Mon Sep 17 00:00:00 2001 From: Prashant Khoje <98951798+prashantkhoje@users.noreply.github.com> Date: Thu, 26 May 2022 16:56:10 +0530 Subject: [PATCH 2/3] Fixed indentation --- pkg/geo/bbox_test.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pkg/geo/bbox_test.go b/pkg/geo/bbox_test.go index e8547f4d8ac8..611ebdf89caf 100644 --- a/pkg/geo/bbox_test.go +++ b/pkg/geo/bbox_test.go @@ -12,7 +12,7 @@ package geo import ( "fmt" - "math" + "math" "strconv" "testing" @@ -185,22 +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 - } - } + // 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) }) } From 78dd74f0a527199d0fae680c6a0ac9809c8fb25e Mon Sep 17 00:00:00 2001 From: Prashant Khoje <98951798+prashantkhoje@users.noreply.github.com> Date: Thu, 26 May 2022 17:23:38 +0530 Subject: [PATCH 3/3] fix indentation --- pkg/geo/bbox_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/geo/bbox_test.go b/pkg/geo/bbox_test.go index 611ebdf89caf..0ef94e9d7e6b 100644 --- a/pkg/geo/bbox_test.go +++ b/pkg/geo/bbox_test.go @@ -185,7 +185,7 @@ 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 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 {