Merge pull request #89 from gaspardle/floating-point-comparison

Safer float comparison in relation test
master
Oliver Tonnhofer 2016-03-10 18:19:40 +01:00
commit f4ff0b0d15
1 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@ package test
import (
"database/sql"
"math"
"testing"
"github.com/omniscale/imposm3/geom/geos"
@ -60,7 +60,7 @@ func TestRouteRelation_MemberGeomUpdated1(t *testing.T) {
t.Fatal(rows)
}
g := ts.g.FromWkt(rows[0]["wkt"])
if g.Length() != 111.32448543701321 {
if math.Abs(g.Length() - 111.32448543701321) > 0.00000001 {
t.Fatal(g.Length())
}
@ -87,7 +87,7 @@ func TestRouteRelation_MemberGeomUpdated2(t *testing.T) {
t.Fatal(rows)
}
g := ts.g.FromWkt(rows[0]["wkt"])
if g.Length() != 184.97560221624542 {
if math.Abs(g.Length() - 184.97560221624542) > 0.00000001 {
t.Fatal(g.Length())
}