From d2d65f2f65eefbcf36125681b9d66620f2cc0afb Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Thu, 12 Jan 2012 16:59:43 +0200 Subject: [PATCH] add test marker on the class as well --- .../unit/index/search/geo/GeoUtilsTests.java | 143 +++++++++--------- 1 file changed, 72 insertions(+), 71 deletions(-) diff --git a/src/test/java/org/elasticsearch/test/unit/index/search/geo/GeoUtilsTests.java b/src/test/java/org/elasticsearch/test/unit/index/search/geo/GeoUtilsTests.java index 430142712d8..50c37e7a29d 100644 --- a/src/test/java/org/elasticsearch/test/unit/index/search/geo/GeoUtilsTests.java +++ b/src/test/java/org/elasticsearch/test/unit/index/search/geo/GeoUtilsTests.java @@ -29,6 +29,7 @@ import static org.hamcrest.Matchers.not; /** * */ +@Test public class GeoUtilsTests { /** @@ -45,8 +46,8 @@ public class GeoUtilsTests { assertThat(0.0, not(equalTo(-0.0))); assertThat(GeoUtils.normalizeLon(-0.0), equalTo(0.0)); assertThat(GeoUtils.normalizeLat(-0.0), equalTo(0.0)); - assertThat(GeoUtils.normalizeLon( 0.0), equalTo(0.0)); - assertThat(GeoUtils.normalizeLat( 0.0), equalTo(0.0)); + assertThat(GeoUtils.normalizeLon(0.0), equalTo(0.0)); + assertThat(GeoUtils.normalizeLat(0.0), equalTo(0.0)); } /** @@ -56,13 +57,13 @@ public class GeoUtilsTests { public void testBounds() { assertThat(GeoUtils.normalizeLon(-360.0), equalTo(0.0)); assertThat(GeoUtils.normalizeLat(-180.0), equalTo(0.0)); - assertThat(GeoUtils.normalizeLon( 360.0), equalTo(0.0)); - assertThat(GeoUtils.normalizeLat( 180.0), equalTo(0.0)); + assertThat(GeoUtils.normalizeLon(360.0), equalTo(0.0)); + assertThat(GeoUtils.normalizeLat(180.0), equalTo(0.0)); // and halves assertThat(GeoUtils.normalizeLon(-180.0), equalTo(180.0)); - assertThat(GeoUtils.normalizeLat(- 90.0), equalTo( 90.0)); - assertThat(GeoUtils.normalizeLon( 180.0), equalTo(180.0)); - assertThat(GeoUtils.normalizeLat( 90.0), equalTo( 90.0)); + assertThat(GeoUtils.normalizeLat(-90.0), equalTo(90.0)); + assertThat(GeoUtils.normalizeLon(180.0), equalTo(180.0)); + assertThat(GeoUtils.normalizeLat(90.0), equalTo(90.0)); } /** @@ -73,73 +74,73 @@ public class GeoUtilsTests { // Near bounds assertThat(GeoUtils.normalizeLon(-360.5), equalTo(-0.5)); assertThat(GeoUtils.normalizeLat(-180.5), equalTo(-0.5)); - assertThat(GeoUtils.normalizeLon( 360.5), equalTo( 0.5)); - assertThat(GeoUtils.normalizeLat( 180.5), equalTo( 0.5)); + assertThat(GeoUtils.normalizeLon(360.5), equalTo(0.5)); + assertThat(GeoUtils.normalizeLat(180.5), equalTo(0.5)); // and near halves - assertThat(GeoUtils.normalizeLon(-180.5), equalTo( 179.5)); - assertThat(GeoUtils.normalizeLat(- 90.5), equalTo( 89.5)); - assertThat(GeoUtils.normalizeLon( 180.5), equalTo(-179.5)); - assertThat(GeoUtils.normalizeLat( 90.5), equalTo(- 89.5)); + assertThat(GeoUtils.normalizeLon(-180.5), equalTo(179.5)); + assertThat(GeoUtils.normalizeLat(-90.5), equalTo(89.5)); + assertThat(GeoUtils.normalizeLon(180.5), equalTo(-179.5)); + assertThat(GeoUtils.normalizeLat(90.5), equalTo(-89.5)); // Every 10-units, multiple full turns - for (int shift = -20 ; shift <= 20 ; ++shift) { - assertThat(GeoUtils.normalizeLon(shift*360.0+ 0.0), equalTo( 0.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 10.0), equalTo( 10.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 20.0), equalTo( 20.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 30.0), equalTo( 30.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 40.0), equalTo( 40.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 50.0), equalTo( 50.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 60.0), equalTo( 60.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 70.0), equalTo( 70.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 80.0), equalTo( 80.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 90.0), equalTo( 90.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 100.0), equalTo( 100.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 110.0), equalTo( 110.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 120.0), equalTo( 120.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 130.0), equalTo( 130.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 140.0), equalTo( 140.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 150.0), equalTo( 150.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 160.0), equalTo( 160.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 170.0), equalTo( 170.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 180.0), equalTo( 180.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 190.0), equalTo(-170.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 200.0), equalTo(-160.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 210.0), equalTo(-150.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 220.0), equalTo(-140.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 230.0), equalTo(-130.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 240.0), equalTo(-120.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 250.0), equalTo(-110.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 260.0), equalTo(-100.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 270.0), equalTo(- 90.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 280.0), equalTo(- 80.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 290.0), equalTo(- 70.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 300.0), equalTo(- 60.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 310.0), equalTo(- 50.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 320.0), equalTo(- 40.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 330.0), equalTo(- 30.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 340.0), equalTo(- 20.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 350.0), equalTo(- 10.0)); - assertThat(GeoUtils.normalizeLon(shift*360.0+ 360.0), equalTo( 0.0)); + for (int shift = -20; shift <= 20; ++shift) { + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 0.0), equalTo(0.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 10.0), equalTo(10.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 20.0), equalTo(20.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 30.0), equalTo(30.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 40.0), equalTo(40.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 50.0), equalTo(50.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 60.0), equalTo(60.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 70.0), equalTo(70.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 80.0), equalTo(80.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 90.0), equalTo(90.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 100.0), equalTo(100.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 110.0), equalTo(110.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 120.0), equalTo(120.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 130.0), equalTo(130.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 140.0), equalTo(140.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 150.0), equalTo(150.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 160.0), equalTo(160.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 170.0), equalTo(170.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 180.0), equalTo(180.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 190.0), equalTo(-170.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 200.0), equalTo(-160.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 210.0), equalTo(-150.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 220.0), equalTo(-140.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 230.0), equalTo(-130.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 240.0), equalTo(-120.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 250.0), equalTo(-110.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 260.0), equalTo(-100.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 270.0), equalTo(-90.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 280.0), equalTo(-80.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 290.0), equalTo(-70.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 300.0), equalTo(-60.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 310.0), equalTo(-50.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 320.0), equalTo(-40.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 330.0), equalTo(-30.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 340.0), equalTo(-20.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 350.0), equalTo(-10.0)); + assertThat(GeoUtils.normalizeLon(shift * 360.0 + 360.0), equalTo(0.0)); } - for (int shift = -20 ; shift <= 20 ; ++shift) { - assertThat(GeoUtils.normalizeLat(shift*180.0+ 0.0), equalTo( 0.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 10.0), equalTo( 10.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 20.0), equalTo( 20.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 30.0), equalTo( 30.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 40.0), equalTo( 40.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 50.0), equalTo( 50.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 60.0), equalTo( 60.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 70.0), equalTo( 70.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 80.0), equalTo( 80.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 90.0), equalTo( 90.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 100.0), equalTo(-80.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 110.0), equalTo(-70.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 120.0), equalTo(-60.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 130.0), equalTo(-50.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 140.0), equalTo(-40.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 150.0), equalTo(-30.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 160.0), equalTo(-20.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 170.0), equalTo(-10.0)); - assertThat(GeoUtils.normalizeLat(shift*180.0+ 180.0), equalTo( 0.0)); + for (int shift = -20; shift <= 20; ++shift) { + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 0.0), equalTo(0.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 10.0), equalTo(10.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 20.0), equalTo(20.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 30.0), equalTo(30.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 40.0), equalTo(40.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 50.0), equalTo(50.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 60.0), equalTo(60.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 70.0), equalTo(70.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 80.0), equalTo(80.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 90.0), equalTo(90.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 100.0), equalTo(-80.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 110.0), equalTo(-70.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 120.0), equalTo(-60.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 130.0), equalTo(-50.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 140.0), equalTo(-40.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 150.0), equalTo(-30.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 160.0), equalTo(-20.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 170.0), equalTo(-10.0)); + assertThat(GeoUtils.normalizeLat(shift * 180.0 + 180.0), equalTo(0.0)); } }