### ----------------------------------------------------
### -- Geo::Ellipsoid
### -- Licenses: Artistic-2.0
### -- Authors: Tom Browder <tbrowder@acm.org> (translator Perl 5 to Raku, current maintainer), Jim Gibson (CPAN Perl 5 author, v1.12)
### -- File: t/07-location.t
### ----------------------------------------------------
### -- Chunk 1 of 3
#!/usr/bin/env perl6
# Test Geo::Ellipsoid location

use v6;
use Test;

plan 400;

use Geo::Ellipsoid;

# This original Perl 5 test used the following test functions (the
# resulting Perl 6 versions are shown after the fat comma):
#
#   delta_ok     => is-approx($a, $b, :$rel-tol)
#
#  From the Perl 5 test file:
#    use Test::Number::Delta relative => 1e-6;
#  which translates to:
my $rel-tol = 1e-6;

my $e1 = Geo::Ellipsoid.new(units=>'degrees');
#my $e2 = Geo::Ellipsoid.new(units=>'degrees',longitude=>1);
my $e2 = Geo::Ellipsoid.new(units=>'degrees',longitude_sym=>True);
my ($lat1,$lon1,$lat2,$lon2,$x,$y);

($lat1, $lon1) = $e1.location(-38.369163,190.874558,533.491111,393.690590);
($lat2, $lon2) = $e2.location(-38.369163,190.874558,533.491111,393.690590);
is-approx($lat1, -38.3656166574817, :$rel-tol);
is-approx($lon1, 190.880662670944, :$rel-tol);
is-approx($lat2, -38.3656166574817, :$rel-tol);
is-approx($lon2, -169.119337329056, :$rel-tol);

#say "DEBUG exit"; exit;

($lat1, $lon1) = $e1.location(-14.608137,30.094655,650.150163,6357.798657);
($lat2, $lon2) = $e2.location(-14.608137,30.094655,650.150163,6357.798657);
is-approx($lat1, -14.5506757312212, :$rel-tol);
is-approx($lon1, 30.1006878108632, :$rel-tol);
is-approx($lat2, -14.5506757312212, :$rel-tol);
is-approx($lon2, 30.1006878108632, :$rel-tol);

($lat1, $lon1) = $e1.location(-41.623677,208.834416,1603.258290,-147.740698);
($lat2, $lon2) = $e2.location(-41.623677,208.834416,1603.258290,-147.740698);
is-approx($lat1, -41.6250052190667, :$rel-tol);
is-approx($lon1, 208.853654884741, :$rel-tol);
is-approx($lat2, -41.6250052190667, :$rel-tol);
is-approx($lon2, -151.146345115259, :$rel-tol);

($lat1, $lon1) = $e1.location(-67.726400,52.964864,685.045725,541.410394);
($lat2, $lon2) = $e2.location(-67.726400,52.964864,685.045725,541.410394);
is-approx($lat1, -67.72154487153, :$rel-tol);
is-approx($lon1, 52.9810494838027, :$rel-tol);
is-approx($lat2, -67.72154487153, :$rel-tol);
is-approx($lon2, 52.9810494838027, :$rel-tol);

($lat1, $lon1) = $e1.location(-5.158991,259.931626,-1709.088383,-4457.450145);
($lat2, $lon2) = $e2.location(-5.158991,259.931626,-1709.088383,-4457.450145);
is-approx($lat1, -5.19929911014967, :$rel-tol);
is-approx($lon1, 259.916209822012, :$rel-tol);
is-approx($lat2, -5.19929911014967, :$rel-tol);
is-approx($lon2, -100.083790177988, :$rel-tol);

($lat1, $lon1) = $e1.location(-0.582762,29.118576,2827.367632,-828.182160);
($lat2, $lon2) = $e2.location(-0.582762,29.118576,2827.367632,-828.182160);
is-approx($lat1, -0.590251306822743, :$rel-tol);
is-approx($lon1, 29.1439759994689, :$rel-tol);
is-approx($lat2, -0.590251306822743, :$rel-tol);
is-approx($lon2, 29.1439759994689, :$rel-tol);

($lat1, $lon1) = $e1.location(-26.934636,30.474042,947.389493,291.952216);
($lat2, $lon2) = $e2.location(-26.934636,30.474042,947.389493,291.952216);
is-approx($lat1, -26.9320006429192, :$rel-tol);
is-approx($lon1, 30.4835810246334, :$rel-tol);
is-approx($lat2, -26.9320006429192, :$rel-tol);
is-approx($lon2, 30.4835810246334, :$rel-tol);

($lat1, $lon1) = $e1.location(-62.773742,62.342057,-7400.407449,3875.891848);
($lat2, $lon2) = $e2.location(-62.773742,62.342057,-7400.407449,3875.891848);
is-approx($lat1, -62.738893257913, :$rel-tol);
is-approx($lon1, 62.197305731553, :$rel-tol);
is-approx($lat2, -62.738893257913, :$rel-tol);
is-approx($lon2, 62.197305731553, :$rel-tol);

($lat1, $lon1) = $e1.location(68.057252,192.858027,-4489.419161,-1429.203025);
($lat2, $lon2) = $e2.location(68.057252,192.858027,-4489.419161,-1429.203025);
is-approx($lat1, 68.0444035490457, :$rel-tol);
is-approx($lon1, 192.750473587802, :$rel-tol);
is-approx($lat2, 68.0444035490457, :$rel-tol);
is-approx($lon2, -167.249526412198, :$rel-tol);

($lat1, $lon1) = $e1.location(1.348841,276.378914,2224.789779,-9574.419452);
($lat2, $lon2) = $e2.location(1.348841,276.378914,2224.789779,-9574.419452);
is-approx($lat1, 1.26225340172628, :$rel-tol);
is-approx($lon1, 276.398904775364, :$rel-tol);
is-approx($lat2, 1.26225340172628, :$rel-tol);
is-approx($lon2, -83.6010952246363, :$rel-tol);

($lat1, $lon1) = $e1.location(27.335146,320.699240,-8535.150724,157.936548);
($lat2, $lon2) = $e2.location(27.335146,320.699240,-8535.150724,157.936548);
is-approx($lat1, 27.336544790133, :$rel-tol);
is-approx($lon1, 320.612989777828, :$rel-tol);
is-approx($lat2, 27.336544790133, :$rel-tol);
is-approx($lon2, -39.3870102221718, :$rel-tol);

($lat1, $lon1) = $e1.location(34.623205,31.357288,5664.823875,-5632.708719);
($lat2, $lon2) = $e2.location(34.623205,31.357288,5664.823875,-5632.708719);
is-approx($lat1, 34.5724140545376, :$rel-tol);
is-approx($lon1, 31.4190231012302, :$rel-tol);
is-approx($lat2, 34.5724140545376, :$rel-tol);
is-approx($lon2, 31.4190231012302, :$rel-tol);

($lat1, $lon1) = $e1.location(-6.856999,130.887597,-4447.965929,-6362.641019);
($lat2, $lon2) = $e2.location(-6.856999,130.887597,-4447.965929,-6362.641019);
is-approx($lat1, -6.91453101371976, :$rel-tol);
is-approx($lon1, 130.847349224089, :$rel-tol);
is-approx($lat2, -6.91453101371976, :$rel-tol);
is-approx($lon2, 130.847349224089, :$rel-tol);

($lat1, $lon1) = $e1.location(-70.754141,43.777574,-4660.663331,-3114.520427);
($lat2, $lon2) = $e2.location(-70.754141,43.777574,-4660.663331,-3114.520427);
is-approx($lat1, -70.7820124418521, :$rel-tol);
is-approx($lon1, 43.6507601360177, :$rel-tol);
is-approx($lat2, -70.7820124418521, :$rel-tol);
is-approx($lon2, 43.6507601360177, :$rel-tol);

($lat1, $lon1) = $e1.location(-69.865357,188.114494,7057.333326,4623.928963);
($lat2, $lon2) = $e2.location(-69.865357,188.114494,7057.333326,4623.928963);
is-approx($lat1, -69.8238139675753, :$rel-tol);
is-approx($lon1, 188.297759634022, :$rel-tol);
is-approx($lat2, -69.8238139675753, :$rel-tol);
is-approx($lon2, -171.702240365978, :$rel-tol);

($lat1, $lon1) = $e1.location(-79.523730,324.065787,2004.841971,835.056246);
($lat2, $lon2) = $e2.location(-79.523730,324.065787,2004.841971,835.056246);
is-approx($lat1, -79.5162359949416, :$rel-tol);
is-approx($lon1, 324.164444728713, :$rel-tol);
is-approx($lat2, -79.5162359949416, :$rel-tol);
is-approx($lon2, -35.8355552712871, :$rel-tol);

($lat1, $lon1) = $e1.location(74.606774,294.646962,-3726.786136,-6044.735429);
($lat2, $lon2) = $e2.location(74.606774,294.646962,-3726.786136,-6044.735429);
is-approx($lat1, 74.552581484185, :$rel-tol);
is-approx($lon1, 294.521662695934, :$rel-tol);
is-approx($lat2, 74.552581484185, :$rel-tol);
is-approx($lon2, -65.4783373040659, :$rel-tol);

($lat1, $lon1) = $e1.location(28.972667,278.549276,2282.396343,457.952283);
($lat2, $lon2) = $e2.location(28.972667,278.549276,2282.396343,457.952283);
is-approx($lat1, 28.9767972109023, :$rel-tol);
is-approx($lon1, 278.572694719835, :$rel-tol);
is-approx($lat2, 28.9767972109023, :$rel-tol);
is-approx($lon2, -81.4273052801652, :$rel-tol);

($lat1, $lon1) = $e1.location(-20.359063,296.599967,-1055.268135,-1240.723925);
($lat2, $lon2) = $e2.location(-20.359063,296.599967,-1055.268135,-1240.723925);
is-approx($lat1, -20.3702696544288, :$rel-tol);
is-approx($lon1, 296.589859316515, :$rel-tol);
is-approx($lat2, -20.3702696544288, :$rel-tol);
is-approx($lon2, -63.4101406834851, :$rel-tol);

($lat1, $lon1) = $e1.location(-60.365048,156.813021,-1.250697,-10.735742);
($lat2, $lon2) = $e2.location(-60.365048,156.813021,-1.250697,-10.735742);
is-approx($lat1, -60.3651441594277, :$rel-tol);
is-approx($lon1, 156.812997908757, :$rel-tol);
is-approx($lat2, -60.3651441594277, :$rel-tol);
is-approx($lon2, 156.812997908757, :$rel-tol);

($lat1, $lon1) = $e1.location(-6.203945,247.684632,182.386266,-268.728800);
($lat2, $lon2) = $e2.location(-6.203945,247.684632,182.386266,-268.728800);
is-approx($lat1, -6.20637500756398, :$rel-tol);
is-approx($lon1, 247.686280489375, :$rel-tol);
is-approx($lat2, -6.20637500756398, :$rel-tol);
is-approx($lon2, -112.313719510625, :$rel-tol);

($lat1, $lon1) = $e1.location(0.611947,100.746342,7512.264392,-6560.959753);
($lat2, $lon2) = $e2.location(0.611947,100.746342,7512.264392,-6560.959753);
is-approx($lat1, 0.55261091016823, :$rel-tol);
is-approx($lon1, 100.813828549171, :$rel-tol);
is-approx($lat2, 0.55261091016823, :$rel-tol);
is-approx($lon2, 100.813828549171, :$rel-tol);

($lat1, $lon1) = $e1.location(-20.725615,342.386744,-538.867522,-614.748871);
($lat2, $lon2) = $e2.location(-20.725615,342.386744,-538.867522,-614.748871);
is-approx($lat1, -20.7311674916701, :$rel-tol);
is-approx($lon1, 342.381570767838, :$rel-tol);
is-approx($lat2, -20.7311674916701, :$rel-tol);
is-approx($lon2, -17.6184292321621, :$rel-tol);

($lat1, $lon1) = $e1.location(46.911457,128.191393,8859.825337,3981.362304);
($lat2, $lon2) = $e2.location(46.911457,128.191393,8859.825337,3981.362304);
is-approx($lat1, 46.9472109419573, :$rel-tol);
is-approx($lon1, 128.307769547944, :$rel-tol);
is-approx($lat2, 46.9472109419573, :$rel-tol);
is-approx($lon2, 128.307769547944, :$rel-tol);

($lat1, $lon1) = $e1.location(-11.235004,282.756437,-247.423508,-1148.832859);
($lat2, $lon2) = $e2.location(-11.235004,282.756437,-247.423508,-1148.832859);
is-approx($lat1, -11.2453901777647, :$rel-tol);
is-approx($lon1, 282.754171348951, :$rel-tol);
is-approx($lat2, -11.2453901777647, :$rel-tol);
is-approx($lon2, -77.2458286510488, :$rel-tol);

($lat1, $lon1) = $e1.location(-41.167125,221.956378,7098.529445,3165.704607);
($lat2, $lon2) = $e2.location(-41.167125,221.956378,7098.529445,3165.704607);
is-approx($lat1, -41.1385887169891, :$rel-tol);
is-approx($lon1, 222.040925759323, :$rel-tol);
is-approx($lat2, -41.1385887169891, :$rel-tol);
is-approx($lon2, -137.959074240677, :$rel-tol);

($lat1, $lon1) = $e1.location(-1.549886,336.466532,2432.164382,-2003.196884);
($lat2, $lon2) = $e2.location(-1.549886,336.466532,2432.164382,-2003.196884);
is-approx($lat1, -1.56800166865689, :$rel-tol);
is-approx($lon1, 336.48838856866, :$rel-tol);
is-approx($lat2, -1.56800166865689, :$rel-tol);
is-approx($lon2, -23.5116114313395, :$rel-tol);

($lat1, $lon1) = $e1.location(-63.776699,134.057987,-5461.071096,7031.399910);
($lat2, $lon2) = $e2.location(-63.776699,134.057987,-5461.071096,7031.399910);
is-approx($lat1, -63.7135798907925, :$rel-tol);
is-approx($lon1, 133.947510160671, :$rel-tol);
is-approx($lat2, -63.7135798907925, :$rel-tol);
is-approx($lon2, 133.947510160671, :$rel-tol);

($lat1, $lon1) = $e1.location(77.940951,38.523563,-588.281719,1372.291090);
($lat2, $lon2) = $e2.location(77.940951,38.523563,-588.281719,1372.291090);
is-approx($lat1, 77.9532419255974, :$rel-tol);
is-approx($lon1, 38.4983240629321, :$rel-tol);
is-approx($lat2, 77.9532419255974, :$rel-tol);
is-approx($lon2, 38.4983240629321, :$rel-tol);

($lat1, $lon1) = $e1.location(45.339403,315.409130,1866.951314,1836.028607);
($lat2, $lon2) = $e2.location(45.339403,315.409130,1866.951314,1836.028607);
is-approx($lat1, 45.3559203918087, :$rel-tol);
is-approx($lon1, 315.432955775137, :$rel-tol);
is-approx($lat2, 45.3559203918087, :$rel-tol);
is-approx($lon2, -44.5670442248635, :$rel-tol);

($lat1, $lon1) = $e1.location(6.190847,124.992089,2809.542582,-2638.185417);
($lat2, $lon2) = $e2.location(6.190847,124.992089,2809.542582,-2638.185417);
is-approx($lat1, 6.16698993482276, :$rel-tol);
is-approx($lon1, 125.017473198902, :$rel-tol);
is-approx($lat2, 6.16698993482276, :$rel-tol);
is-approx($lon2, 125.017473198902, :$rel-tol);

($lat1, $lon1) = $e1.location(-4.121498,262.769582,245.486247,-9305.729473);
($lat2, $lon2) = $e2.location(-4.121498,262.769582,245.486247,-9305.729473);
is-approx($lat1, -4.205651784836, :$rel-tol);
is-approx($lon1, 262.771793465594, :$rel-tol);
is-approx($lat2, -4.205651784836, :$rel-tol);
is-approx($lon2, -97.2282065344056, :$rel-tol);

($lat1, $lon1) = $e1.location(-4.285155,344.319438,962.149187,-2828.960604);
($lat2, $lon2) = $e2.location(-4.285155,344.319438,962.149187,-2828.960604);
is-approx($lat1, -4.31073788511537, :$rel-tol);
is-approx($lon1, 344.328105973954, :$rel-tol);
is-approx($lat2, -4.31073788511537, :$rel-tol);
is-approx($lon2, -15.6718940260457, :$rel-tol);

($lat1, $lon1) = $