Changeset 4573 in josm for trunk/test/unit/org/openstreetmap/josm/data/coor
- Timestamp:
- 2011-11-03T23:23:34+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java
r4541 r4573 12 12 public class LatLonTest { 13 13 14 protected static final double[] sampleValues = new double[]{ 15 -180.0, -179.9, -179.6, -179.5, -179.4, -179.1, -179.0, -100.0, -99.9, -10.0, -9.9, -1.0, -0.1, 16 180.0, 179.9, 179.6, 179.5, 179.4, 179.1, 179.0, 100.0, 99.9, 10.0, 9.9, 1.0, 0.1, 17 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 18 1.12, 1.123, 1.1234, 1.12345, 1.123456, 1.1234567, 19 10.12, 10.123, 10.1234, 10.12345, 10.123456, 10.1234567, 20 100.12, 100.123, 100.1234, 100.12345, 100.123456, 100.1234567 21 }; 22 14 23 @Test 15 24 public void roundingTests() { 16 25 17 for (double value : new double[]{ 18 -180.0, -179.9, -179.6, -179.5, -179.4, -179.1, -179.0, -100.0, -99.9, -10.0, -9.9, -1.0, -0.1, 19 180.0, 179.9, 179.6, 179.5, 179.4, 179.1, 179.0, 100.0, 99.9, 10.0, 9.9, 1.0, 0.1, 20 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 21 1.12, 1.123, 1.1234, 1.12345, 1.123456, 1.1234567, 22 10.12, 10.123, 10.1234, 10.12345, 10.123456, 10.1234567, 23 100.12, 100.123, 100.1234, 100.12345, 100.123456, 100.1234567 24 }) { 26 for (double value : sampleValues) { 25 27 assertEquals(LatLon.roundToOsmPrecision(value), value, 0); 26 28 } … … 40 42 assertEquals(LatLon.roundToOsmPrecision(100.12345678), 100.1234568, 0); 41 43 assertEquals(LatLon.roundToOsmPrecision(100.123456789), 100.1234568, 0); 44 45 assertEquals(LatLon.roundToOsmPrecision(100.00000001), 100.0000000, 0); 46 assertEquals(LatLon.roundToOsmPrecision(100.000000001), 100.0000000, 0); 47 assertEquals(LatLon.roundToOsmPrecision(100.0000000001), 100.0000000, 0); 48 assertEquals(LatLon.roundToOsmPrecision(100.00000000001), 100.0000000, 0); 49 assertEquals(LatLon.roundToOsmPrecision(100.000000000001), 100.0000000, 0); 50 assertEquals(LatLon.roundToOsmPrecision(100.0000000000001), 100.0000000, 0); 51 assertEquals(LatLon.roundToOsmPrecision(100.00000000000001), 100.0000000, 0); 52 assertEquals(LatLon.roundToOsmPrecision(100.000000000000001), 100.0000000, 0); 53 assertEquals(LatLon.roundToOsmPrecision(100.0000000000000001), 100.0000000, 0); 54 assertEquals(LatLon.roundToOsmPrecision(100.00000000000000001), 100.0000000, 0); 55 assertEquals(LatLon.roundToOsmPrecision(100.000000000000000001), 100.0000000, 0); 56 assertEquals(LatLon.roundToOsmPrecision(100.0000000000000000001), 100.0000000, 0); 57 assertEquals(LatLon.roundToOsmPrecision(100.00000000000000000001), 100.0000000, 0); 58 59 assertEquals(LatLon.roundToOsmPrecision(99.999999999999999999999), 100.0000000, 0); 60 assertEquals(LatLon.roundToOsmPrecision(99.99999999999999999999), 100.0000000, 0); 61 assertEquals(LatLon.roundToOsmPrecision(99.9999999999999999999), 100.0000000, 0); 62 assertEquals(LatLon.roundToOsmPrecision(99.999999999999999999), 100.0000000, 0); 63 assertEquals(LatLon.roundToOsmPrecision(99.99999999999999999), 100.0000000, 0); 64 assertEquals(LatLon.roundToOsmPrecision(99.9999999999999999), 100.0000000, 0); 65 assertEquals(LatLon.roundToOsmPrecision(99.999999999999999), 100.0000000, 0); 66 assertEquals(LatLon.roundToOsmPrecision(99.99999999999999), 100.0000000, 0); 67 assertEquals(LatLon.roundToOsmPrecision(99.9999999999999), 100.0000000, 0); 68 assertEquals(LatLon.roundToOsmPrecision(99.999999999999), 100.0000000, 0); 69 assertEquals(LatLon.roundToOsmPrecision(99.99999999999), 100.0000000, 0); 70 assertEquals(LatLon.roundToOsmPrecision(99.9999999999), 100.0000000, 0); 71 assertEquals(LatLon.roundToOsmPrecision(99.999999999), 100.0000000, 0); 72 assertEquals(LatLon.roundToOsmPrecision(99.99999999), 100.0000000, 0); 73 assertEquals(LatLon.roundToOsmPrecision(99.9999999), 99.9999999, 0); 42 74 } 43 75 }
Note:
See TracChangeset
for help on using the changeset viewer.