Changeset 10910 in josm for trunk/test/unit
- Timestamp:
- 2016-08-28T19:00:16+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/BoundsTest.java
r10758 r10910 5 5 import static org.junit.Assert.assertFalse; 6 6 import static org.junit.Assert.assertTrue; 7 8 import java.awt.geom.Rectangle2D; 7 9 8 10 import org.junit.Test; … … 47 49 assertEquals(b3, new Bounds(0, 0, 90, -170)); 48 50 } 51 52 private static void doTestConstructorNominal(Bounds b) { 53 double eps = 1e-7; 54 assertEquals(1d, b.getMinLat(), eps); 55 assertEquals(2d, b.getMinLon(), eps); 56 assertEquals(3d, b.getMaxLat(), eps); 57 assertEquals(4d, b.getMaxLon(), eps); 58 } 59 60 private static void doTestConstructorPoint(Bounds b) { 61 double eps = 1e-7; 62 assertEquals(1d, b.getMinLat(), eps); 63 assertEquals(2d, b.getMinLon(), eps); 64 assertEquals(1d, b.getMaxLat(), eps); 65 assertEquals(2d, b.getMaxLon(), eps); 66 } 67 68 /** 69 * Unit tests for {@link Bounds#Bounds} - nominal cases. 70 */ 71 @Test 72 public void testConstructorNominalCases() { 73 doTestConstructorNominal(new Bounds(new LatLon(1d, 2d), new LatLon(3d, 4d))); 74 doTestConstructorNominal(new Bounds(new LatLon(1d, 2d), new LatLon(3d, 4d), true)); 75 doTestConstructorNominal(new Bounds(1d, 2d, 3d, 4d)); 76 doTestConstructorNominal(new Bounds(1d, 2d, 3d, 4d, true)); 77 doTestConstructorNominal(new Bounds(new double[]{1d, 2d, 3d, 4d})); 78 doTestConstructorNominal(new Bounds(new double[]{1d, 2d, 3d, 4d}, true)); 79 doTestConstructorNominal(new Bounds(new Bounds(1d, 2d, 3d, 4d))); 80 doTestConstructorNominal(new Bounds(new Rectangle2D.Double(2d, 1d, 2d, 2d))); 81 } 82 83 /** 84 * Unit tests for {@link Bounds#Bounds} - single point cases. 85 */ 86 @Test 87 public void testConstructorSinglePointCases() { 88 doTestConstructorPoint(new Bounds(new LatLon(1d, 2d))); 89 doTestConstructorPoint(new Bounds(new LatLon(1d, 2d), true)); 90 doTestConstructorPoint(new Bounds(1d, 2d, true)); 91 } 49 92 }
Note:
See TracChangeset
for help on using the changeset viewer.