### ----------------------------------------------------
### -- 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/10-displacement.t
### ----------------------------------------------------
### -- Chunk 1 of 3
# Test Geo::Ellipsoid displacement

use v6;
use Test;

plan 200;

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_within => is-approx($a, $b, :abs-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 ($lat1,$lon1,$lat2,$lon2,$x,$y);

($x, $y) = $e1.displacement(-38.369163,190.874558,-38.365617,190.880663);
is-approx($x, 533.491110769497, :abs-tol<1.0>); #delta_within($x, 533.491110769497, 1.0);
is-approx($y, 393.690589875639, :abs-tol<1.0>); #delta_within($y, 393.690589875639, 1.0);

($x, $y) = $e1.displacement(-14.608137,30.094655,-14.550676,30.100688);
is-approx($x, 650.150163064452, :abs-tol<1.0>); #delta_within($x, 650.150163064452, 1.0);
is-approx($y, 6357.79865738339, :abs-tol<1.0>); #delta_within($y, 6357.79865738339, 1.0);

#say "DEBUG exit"; exit;

($x, $y) = $e1.displacement(-41.623677,208.834416,-41.625005,208.853655);
is-approx($x, 1603.25828998005, :abs-tol<1.0>); #delta_within($x, 1603.25828998005, 1.0);
is-approx($y, -147.740698437479, :abs-tol<1.0>); #delta_within($y, -147.740698437479, 1.0);

($x, $y) = $e1.displacement(-67.726400,52.964864,-67.721545,52.981049);
is-approx($x, 685.045724508064, :abs-tol<1.0>); #delta_within($x, 685.045724508064, 1.0);
is-approx($y, 541.410394037656, :abs-tol<1.0>); #delta_within($y, 541.410394037656, 1.0);

($x, $y) = $e1.displacement(-5.158991,259.931626,-5.199299,259.916210);
is-approx($x, -1709.08838296383, :abs-tol<1.0>); #delta_within($x, -1709.08838296383, 1.0);
is-approx($y, -4457.45014453906, :abs-tol<1.0>); #delta_within($y, -4457.45014453906, 1.0);

($x, $y) = $e1.displacement(-0.582762,29.118576,-0.590251,29.143976);
is-approx($x, 2827.36763205086, :abs-tol<1.0>); #delta_within($x, 2827.36763205086, 1.0);
is-approx($y, -828.182160065303, :abs-tol<1.0>); #delta_within($y, -828.182160065303, 1.0);

($x, $y) = $e1.displacement(-26.934636,30.474042,-26.932001,30.483581);
is-approx($x, 947.389492534065, :abs-tol<1.0>); #delta_within($x, 947.389492534065, 1.0);
is-approx($y, 291.952216203425, :abs-tol<1.0>); #delta_within($y, 291.952216203425, 1.0);

($x, $y) = $e1.displacement(-62.773742,62.342057,-62.738893,62.197306);
is-approx($x, -7400.40744853875, :abs-tol<1.0>); #delta_within($x, -7400.40744853875, 1.0);
is-approx($y, 3875.89184805293, :abs-tol<1.0>); #delta_within($y, 3875.89184805293, 1.0);

($x, $y) = $e1.displacement(68.057252,192.858027,68.044404,192.750474);
is-approx($x, -4489.41916103631, :abs-tol<1.0>); #delta_within($x, -4489.41916103631, 1.0);
is-approx($y, -1429.20302514897, :abs-tol<1.0>); #delta_within($y, -1429.20302514897, 1.0);

($x, $y) = $e1.displacement(1.348841,276.378914,1.262253,276.398905);
is-approx($x, 2224.78977865537, :abs-tol<1.0>); #delta_within($x, 2224.78977865537, 1.0);
is-approx($y, -9574.41945175545, :abs-tol<1.0>); #delta_within($y, -9574.41945175545, 1.0);

($x, $y) = $e1.displacement(27.335146,320.699240,27.336545,320.612990);
is-approx($x, -8535.15072425152, :abs-tol<1.0>); #delta_within($x, -8535.15072425152, 1.0);
is-approx($y, 157.936548304324, :abs-tol<1.0>); #delta_within($y, 157.936548304324, 1.0);

($x, $y) = $e1.displacement(34.623205,31.357288,34.572414,31.419023);
is-approx($x, 5664.82387546623, :abs-tol<1.0>); #delta_within($x, 5664.82387546623, 1.0);
is-approx($y, -5632.70871934966, :abs-tol<1.0>); #delta_within($y, -5632.70871934966, 1.0);

($x, $y) = $e1.displacement(-6.856999,130.887597,-6.914531,130.847349);
is-approx($x, -4447.96592912093, :abs-tol<1.0>); #delta_within($x, -4447.96592912093, 1.0);
is-approx($y, -6362.64101921225, :abs-tol<1.0>); #delta_within($y, -6362.64101921225, 1.0);

($x, $y) = $e1.displacement(-70.754141,43.777574,-70.782012,43.650760);
is-approx($x, -4660.6633308173, :abs-tol<1.0>); #delta_within($x, -4660.6633308173, 1.0);
is-approx($y, -3114.52042676547, :abs-tol<1.0>); #delta_within($y, -3114.52042676547, 1.0);

($x, $y) = $e1.displacement(-69.865357,188.114494,-69.823814,188.297760);
is-approx($x, 7057.33332640236, :abs-tol<1.0>); #delta_within($x, 7057.33332640236, 1.0);
is-approx($y, 4623.9289633724, :abs-tol<1.0>); #delta_within($y, 4623.9289633724, 1.0);

($x, $y) = $e1.displacement(-79.523730,324.065787,-79.516236,324.164445);
is-approx($x, 2004.84197135811, :abs-tol<1.0>); #delta_within($x, 2004.84197135811, 1.0);
is-approx($y, 835.056245995803, :abs-tol<1.0>); #delta_within($y, 835.056245995803, 1.0);

($x, $y) = $e1.displacement(74.606774,294.646962,74.552581,294.521663);
is-approx($x, -3726.78613552502, :abs-tol<1.0>); #delta_within($x, -3726.78613552502, 1.0);
is-approx($y, -6044.73542923351, :abs-tol<1.0>); #delta_within($y, -6044.73542923351, 1.0);

($x, $y) = $e1.displacement(28.972667,278.549276,28.976797,278.572695);
is-approx($x, 2282.39634325838, :abs-tol<1.0>); #delta_within($x, 2282.39634325838, 1.0);
is-approx($y, 457.952282732985, :abs-tol<1.0>); #delta_within($y, 457.952282732985, 1.0);

($x, $y) = $e1.displacement(-20.359063,296.599967,-20.370270,296.589859);
is-approx($x, -1055.2681349475, :abs-tol<1.0>); #delta_within($x, -1055.2681349475, 1.0);
is-approx($y, -1240.72392529637, :abs-tol<1.0>); #delta_within($y, -1240.72392529637, 1.0);

($x, $y) = $e1.displacement(-60.365048,156.813021,-60.365144,156.812998);
is-approx($x, -1.25069744996408, :abs-tol<1.0>); #delta_within($x, -1.25069744996408, 1.0);
is-approx($y, -10.7357421111002, :abs-tol<1.0>); #delta_within($y, -10.7357421111002, 1.0);

($x, $y) = $e1.displacement(-6.203945,247.684632,-6.206375,247.686280);
is-approx($x, 182.386266388312, :abs-tol<1.0>); #delta_within($x, 182.386266388312, 1.0);
is-approx($y, -268.728800218561, :abs-tol<1.0>); #delta_within($y, -268.728800218561, 1.0);

($x, $y) = $e1.displacement(0.611947,100.746342,0.552611,100.813829);
is-approx($x, 7512.26439232481, :abs-tol<1.0>); #delta_within($x, 7512.26439232481, 1.0);
is-approx($y, -6560.95975342741, :abs-tol<1.0>); #delta_within($y, -6560.95975342741, 1.0);

($x, $y) = $e1.displacement(-20.725615,342.386744,-20.731167,342.381571);
is-approx($x, -538.867521997165, :abs-tol<1.0>); #delta_within($x, -538.867521997165, 1.0);
is-approx($y, -614.74887090871, :abs-tol<1.0>); #delta_within($y, -614.74887090871, 1.0);

($x, $y) = $e1.displacement(46.911457,128.191393,46.947211,128.307770);
is-approx($x, 8859.82533662809, :abs-tol<1.0>); #delta_within($x, 8859.82533662809, 1.0);
is-approx($y, 3981.36230426399, :abs-tol<1.0>); #delta_within($y, 3981.36230426399, 1.0);

($x, $y) = $e1.displacement(-11.235004,282.756437,-11.245390,282.754171);
is-approx($x, -247.423508180174, :abs-tol<1.0>); #delta_within($x, -247.423508180174, 1.0);
is-approx($y, -1148.83285898168, :abs-tol<1.0>); #delta_within($y, -1148.83285898168, 1.0);

($x, $y) = $e1.displacement(-41.167125,221.956378,-41.138589,222.040926);
is-approx($x, 7098.52944501954, :abs-tol<1.0>); #delta_within($x, 7098.52944501954, 1.0);
is-approx($y, 3165.70460706995, :abs-tol<1.0>); #delta_within($y, 3165.70460706995, 1.0);

($x, $y) = $e1.displacement(-1.549886,336.466532,-1.568002,336.488389);
is-approx($x, 2432.16438177744, :abs-tol<1.0>); #delta_within($x, 2432.16438177744, 1.0);
is-approx($y, -2003.1968843645, :abs-tol<1.0>); #delta_within($y, -2003.1968843645, 1.0);

($x, $y) = $e1.displacement(-63.776699,134.057987,-63.713580,133.947510);
is-approx($x, -5461.07109624642, :abs-tol<1.0>); #delta_within($x, -5461.07109624642, 1.0);
is-approx($y, 7031.39991023507, :abs-tol<1.0>); #delta_within($y, 7031.39991023507, 1.0);

($x, $y) = $e1.displacement(77.940951,38.523563,77.953242,38.498324);
is-approx($x, -588.2817189244, :abs-tol<1.0>); #delta_within($x, -588.2817189244, 1.0);
is-approx($y, 1372.29108955997, :abs-tol<1.0>); #delta_within($y, 1372.29108955997, 1.0);

($x, $y) = $e1.displacement(45.339403,315.409130,45.355920,315.432956);
is-approx($x, 1866.95131432594, :abs-tol<1.0>); #delta_within($x, 1866.95131432594, 1.0);
is-approx($y, 1836.02860724827, :abs-tol<1.0>); #delta_within($y, 1836.02860724827, 1.0);

($x, $y) = $e1.displacement(6.190847,124.992089,6.166990,125.017473);
is-approx($x, 2809.54258182171, :abs-tol<1.0>); #delta_within($x, 2809.54258182171, 1.0);
is-approx($y, -2638.1854171307, :abs-tol<1.0>); #delta_within($y, -2638.1854171307, 1.0);

($x, $y) = $e1.displacement(-4.121498,262.769582,-4.205652,262.771793);
is-approx($x, 245.486246709282, :abs-tol<1.0>); #delta_within($x, 245.486246709282, 1.0);
is-approx($y, -9305.72947322172, :abs-tol<1.0>); #delta_within($y, -9305.72947322172, 1.0);

($x, $y) = $e1.displacement(-4.285155,344.319438,-4.310738,344.328106);
is-approx($x, 962.149187035998, :abs-tol<1.0>); #delta_within($x, 962.149187035998, 1.0);
is-approx($y, -2828.96060386992, :abs-tol<1.0>); #delta_within($y, -2828.96060386992, 1.0);

($x, $y) = $e1.displacement(51.523602,137.628739,51.485778,137.714167);
is-approx($x, 5934.07068830833, :abs-tol<1.0>); #delta_within($x, 5934.07068830833, 1.0);
is-approx($y, -4204.71851784455, :abs-tol<1.0>); #delta_within($y, -4204.71851784455, 1.0);

($x, $y) = $e1.displacement(25.726049,310.324628,25.746353,310.262255);
is-approx($x, -6257.92811146551, :abs-tol<1.0>); #delta_within($x, -6257.92811146551, 1.0);
is-approx($y, 2250.85411079545, :abs-tol<1.0>); #delta_within($y, 2250.85411079545, 1.0);

($x, $y) = $e1.displacement(68.128342,115.791221,68.089490,115.743185);
is-approx($x, -2001.18083908742, :abs-tol<1.0>); #delta_within($x, -2001.18083908742, 1.0);
is-approx($y, -4332.66868442188, :abs-tol<1.0>); #delta_within($y, -4332.66868442188, 1.0);

($x, $y) = $e1.displacement(-11.919645,340.641713,-11.926844,340.645394);
is-approx($x, 400.975086576748, :abs-tol<1.0>); #delta_within($x, 400.975086576748, 1.0);
is-approx($y, -796.364783668748, :abs-tol<1.0>); #delta_within($y, -796.364783668748, 1.0);

($x, $y) = $e1.displacement(-30.550903,251.787663,-30.582047,251.779583);
is-approx($x, -775.012580393561, :abs-tol<1.0>); #delta_within($x, -775.012580393561, 1.0);
is-approx($y, -3452.63873401591, :abs-tol<1.0>); #delta_within($y, -3452.63873401591, 1.0);

($x, $y) = $e1.displacement(-61.797586,265.384439,-61.744275,265.519702);
is-approx($x, 7146.86789641309, :abs-tol<1.0>); #delta_within($x, 7146.86789641309, 1.0);
is-approx($y, 5933.55596563271, :abs-tol<1.0>); #delta_within($y, 5933.55596563271, 1.0);

($x, $y) = $e1.displacement(71.112709,8.834545,71.123788,8.940371);
is-approx($x, 3822.76720145874, :abs-tol<1.0>); #delta_within($x, 3822.76720145874, 1.0);
is-approx($y, 1239.54643522283, :abs-tol<1.0>); #delta_within($y, 1239.54643522283, 1.0);

($x, $y) = $e1.displacement(-63.553064,13.025588,-63.587233,13.054037);
is-approx($x, 1412.58459089997, :abs-tol<1.0>); #delta_within($x, 1412.58459089997, 1.0);
is-approx($y, -3809.1234586709, :abs-tol<1.0>); #delta_within($y, -3809.1234586709, 1.0);

($x, $y) = $e1.displacement(29.289568,92.918510,29.349021,92.967234);
is-approx($x, 4731.59651044237, :abs-tol<1.0>); #delta_within($x, 4731.59651044237, 1.0);
is-approx($y, 6590.78621372814, :abs-tol<1.0>); #delta_within($y, 6590.78621372814, 1.0);

($x, $y) = $e1.displacement(23.630668,183.960989,23.655943,184.001554);
is-approx($x, 4138.46502323554, :abs-tol<1.0>); #delta_within($x, 4138.46502323554, 1.0);
is-approx($y, 2799.85919268482, :abs-tol<1.0>); #delta_within($y, 2799.85919268482, 1.0);

($x, $y) = $e1.displacement(21.323022,38.682180,21.337607,38.668693);
is-approx($x, -1399.05734418193, :abs-tol<1.0>); #delta_within($x, -1399.05734418193, 1.0);
is-approx($y, 1614.9381747213, :abs-tol<1.0>); #delta_within($y, 1614.9381747213, 1.0);

($x, $y) = $e1.displacement(77.751666,6