Skip to content

Commit

Permalink
ppc64le - fix test failures of TestBoundingBoxFromGeomT/GeographyType
Browse files Browse the repository at this point in the history
  • Loading branch information
prashantkhoje committed May 24, 2022
1 parent 48e48db commit 0cb3190
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pkg/geo/bbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package geo

import (
"fmt"
"math"
"strconv"
"testing"

Expand Down Expand Up @@ -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)
})
}
Expand Down

0 comments on commit 0cb3190

Please sign in to comment.