Changeset 7068 in josm for trunk/test/unit/org/openstreetmap/josm/data/coor
- Timestamp:
- 2014-05-06T01:24:41+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java
r6226 r7068 6 6 import org.junit.Test; 7 7 8 /**9 * @author Vincent10 *11 */12 8 public class LatLonTest { 13 9 14 p rotected static final double[] sampleValues= new double[]{10 public static final double[] SAMPLE_VALUES = new double[]{ 15 11 -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 12 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 16 100.12, 100.123, 100.1234, 100.12345, 100.123456, 100.1234567 21 17 }; 22 18 23 19 /** 24 20 * Test of {@link LatLon#roundToOsmPrecisionStrict} … … 26 22 @Test 27 23 public void testRoundToOsmPrecisionStrict() { 28 29 for (double value : sampleValues) {24 25 for (double value : SAMPLE_VALUES) { 30 26 assertEquals(LatLon.roundToOsmPrecisionStrict(value), value, 0); 31 27 } 32 28 33 29 assertEquals(LatLon.roundToOsmPrecisionStrict(0.0), 0.0, 0); 34 30 assertEquals(LatLon.roundToOsmPrecisionStrict(-0.0), 0.0, 0); 35 31 36 32 assertEquals(LatLon.roundToOsmPrecisionStrict(0.12345678), 0.1234568, 0); 37 33 assertEquals(LatLon.roundToOsmPrecisionStrict(0.123456789), 0.1234568, 0); … … 76 72 assertEquals(LatLon.roundToOsmPrecisionStrict(99.9999999), 99.9999999, 0); 77 73 } 78 74 79 75 /** 80 76 * Test of {@link LatLon#toIntervalLon} … … 107 103 @Test 108 104 public void testEquals() { 109 for (int i = 1; i < sampleValues.length; i++) {110 LatLon a = new LatLon( sampleValues[i-1], sampleValues[i]);111 LatLon b = new LatLon( sampleValues[i-1], sampleValues[i]);105 for (int i = 1; i < SAMPLE_VALUES.length; i++) { 106 LatLon a = new LatLon(SAMPLE_VALUES[i-1], SAMPLE_VALUES[i]); 107 LatLon b = new LatLon(SAMPLE_VALUES[i-1], SAMPLE_VALUES[i]); 112 108 assertEquals(a, b); 113 109 } … … 119 115 @Test 120 116 public void testHashCode() { 121 for (int i = 1; i < sampleValues.length; i++) {122 LatLon a = new LatLon( sampleValues[i-1], sampleValues[i]);123 LatLon b = new LatLon( sampleValues[i-1], sampleValues[i]);117 for (int i = 1; i < SAMPLE_VALUES.length; i++) { 118 LatLon a = new LatLon(SAMPLE_VALUES[i-1], SAMPLE_VALUES[i]); 119 LatLon b = new LatLon(SAMPLE_VALUES[i-1], SAMPLE_VALUES[i]); 124 120 assertEquals(a.hashCode(), b.hashCode()); 125 121 }
Note: See TracChangeset
for help on using the changeset viewer.