Changeset 10061 in josm


Ignore:
Timestamp:
2016-03-28T00:00:48+02:00 (8 years ago)
Author:
Don-vip
Message:

see #11924 - reduce double precision in unit tests to avoid tiny differences with JDK9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java

    r10060 r10061  
    112112    }
    113113
     114    private static EastNorth getRoundedToOsmPrecision(double east, double north) {
     115        return new EastNorth(LatLon.roundToOsmPrecision(east), LatLon.roundToOsmPrecision(north));
     116    }
     117
    114118    private static List<TestData> readData() throws IOException, FileNotFoundException {
    115119        try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(PROJECTION_DATA_FILE),
     
    133137                if (TestUtils.getJavaVersion() >= 9) {
    134138                    next.ll = next.ll.getRoundedToOsmPrecision();
    135                     next.en = new EastNorth(LatLon.roundToOsmPrecision(en.a), LatLon.roundToOsmPrecision(en.b));
     139                    next.en = getRoundedToOsmPrecision(en.a, en.b);
    136140                    next.ll2 = next.ll2.getRoundedToOsmPrecision();
    137141                }
     
    187191            }
    188192            EastNorth en = proj.latlon2eastNorth(data.ll);
     193            if (TestUtils.getJavaVersion() >= 9) {
     194                en = getRoundedToOsmPrecision(en.east(), en.north());
     195            }
    189196            if (!en.equals(data.en)) {
    190197                String error = String.format("%s (%s): Projecting latlon(%s,%s):%n" +
     
    195202            }
    196203            LatLon ll2 = proj.eastNorth2latlon(data.en);
     204            if (TestUtils.getJavaVersion() >= 9) {
     205                ll2 = ll2.getRoundedToOsmPrecision();
     206            }
    197207            if (!ll2.equals(data.ll2)) {
    198208                String error = String.format("%s (%s): Inverse projecting eastnorth(%s,%s):%n" +
Note: See TracChangeset for help on using the changeset viewer.