Skip to content
Snippets Groups Projects
Commit b893b980 authored by Powers, Peter M.'s avatar Powers, Peter M.
Browse files

updated location tests

parent 0db9c4d7
No related branches found
No related tags found
1 merge request!139Lib work
......@@ -134,18 +134,29 @@ class LocationListTests {
LocationList sl0 = subLists.get(0);
assertEquals(sl0.first(), loc1);
assertEquals(sl0.last(), Location.create(0.1, 0.0));
// TODO revisit: this changed when we removed
// 5 decimal rounding in Locations
// assertEquals(sl0.last(), Location.create(0.1, 0.0));
assertEquals(sl0.last(), Location.create(0.09999999999999999, 6.1232308869976715E-18));
LocationList sl3 = subLists.get(3);
assertEquals(sl3.first(), Location.create(0.3, 0.0));
assertEquals(sl3.last(), Location.create(0.4, 0.0));
// assertEquals(sl3.first(), Location.create(0.3, 0.0));
assertEquals(sl3.first(), Location.create(0.3, 1.8369664682372418E-17));
// assertEquals(sl3.last(), Location.create(0.4, 0.0));
assertEquals(sl3.last(), Location.create(0.39999999999999997, 2.4492867590777903E-17));
LocationList sl6 = subLists.get(6);
assertEquals(sl6.first(), Location.create(0.6, 0.0));
assertEquals(sl6.last(), Location.create(0.7, 0.0));
// assertEquals(sl6.first(), Location.create(0.6, 0.0));
assertEquals(sl6.first(), Location.create(0.6000000000000001, 6.123230886997674E-18));
// assertEquals(sl6.last(), Location.create(0.7, 0.0));
assertEquals(sl6.last(), Location.create(0.7, 1.2246452447783745E-17));
LocationList sl9 = subLists.get(9);
assertEquals(sl9.first(), Location.create(0.9, 0.0));
// assertEquals(sl9.first(), Location.create(0.9, 0.0));
assertEquals(sl9.first(), Location.create(0.8999999999999999, 2.449286759077791E-17));
assertEquals(sl9.last(), loc3);
// length greater than list
......@@ -176,8 +187,11 @@ class LocationListTests {
assertSame(resampled.first(), pp1);
assertSame(resampled.last(), pp2);
Location mid = resampled.get(7);
assertEquals(mid.longitude, 0.49997, 0.0);
assertEquals(mid.latitude, 0.50002, 0.0);
// TODO revisit: this changed when we removed
// 5 decimal rounding in Locations
assertEquals(0.49996509384838933, mid.longitude, 0.0); // was 0.49997
assertEquals(0.5000222122727477, mid.latitude, 0.0); // 0.50002
// singleton
locs = LocationList.of(pp1);
......@@ -282,9 +296,14 @@ class LocationListTests {
LocationList locs = LocationList.of(pp1, pp2);
LocationVector v = LocationVector.create(135 * Maths.TO_RADIANS, 5.0, 5.0);
LocationList transLoc = locs.translate(v);
Location pp1trans = Location.create(0.0318, -0.0318, 5.0);
Location pp2trans = Location.create(1.0318, 0.9682, 5.0);
// Location pp1trans = Location.create(0.0318, -0.0318, 5.0);
// Location pp2trans = Location.create(1.0318, 0.9682, 5.0);
Location pp1trans = Location.create(0.031795787631496104, -0.03179578273558637, 5.0);
Location pp2trans = Location.create(1.031800322985746, 0.9682040632704144, 5.0);
// TODO revisit: this changed when we removed
// 5 decimal rounding in Locations
assertEquals(pp1trans, transLoc.get(0));
assertEquals(pp2trans, transLoc.get(1));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment