Skip to content

Commit

Permalink
Revised to use is/is_deeply() in t/transform instead of ok()
Browse files Browse the repository at this point in the history
  • Loading branch information
fpl committed Dec 19, 2023
1 parent 8dcabda commit fe8c8d0
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions t/transform.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,44 @@ if(1) {
my @lr = ($extent[2], $extent[3]);
my @ur = ($lr[0],$ul[1]);
my @ll = ($ul[0],$lr[1]);
my $result = "3358768.81711923 3391240.32068776 3348976.84626544 3401215.87353221 2019470.50927319 2094945.30821076 2088830.64307375 2025411.23009774";
my @result = qw/3358768.81711923 3391240.32068776 3348976.84626544 3401215.87353221 2019470.50927319 2094945.30821076 2088830.64307375 2025411.23009774/;

my @x = ($ul[0], $lr[0], $ur[0], $ll[0]);
my @y = ($ul[1], $lr[1], $ur[1], $ll[1]);
my $z = undef;
ok(Geo::GDAL::FFI::OCTTransform($ct, 4, \@x, \@y, \@$z), "Coordinate transformation 3D worked");
ok(qq/@x @y/ eq $result, "Resulting coordinates");
my $res = Geo::GDAL::FFI::OCTTransform($ct, 4, \@x, \@y, \@$z);
is($res, 1, "Coordinate transformation 3D worked");
is_deeply([@x, @y], \@result, "Checking resulting coordinates");

@x = ($ul[0], $lr[0], $ur[0], $ll[0]);
@y = ($ul[1], $lr[1], $ur[1], $ll[1]);
$z = undef;
my @ps = (0,0,0,0);
ok(Geo::GDAL::FFI::OCTTransformEx($ct, 4, \@x, \@y, \@$z, \@ps), "Coordinate transformation 3D with pabSuccess worked");
ok(qq/@x @y/ eq $result, "Resulting coordinates");
ok(scalar @ps == 4 && qq/@ps/ eq qq/1 1 1 1/, "Resulting pabSuccess is TRUE x 4" );
$res = Geo::GDAL::FFI::OCTTransformEx($ct, 4, \@x, \@y, \@$z, \@ps);
is($res, 1, "Coordinate transformation 3D with pabSuccess worked");
is_deeply([@x, @y], \@result, "Checking resulting coordinates");
is(scalar @ps, 4, "Resulting pabSuccess is an array of size 4");
is_deeply(\@ps, [1, 1, 1, 1], "Resulting pabSuccess is TRUE x 4" );

@x = ($ul[0], $lr[0], $ur[0], $ll[0]);
@y = ($ul[1], $lr[1], $ur[1], $ll[1]);
$z = undef;
my $t = undef;
@ps = (0,0,0,0);
ok(Geo::GDAL::FFI::OCTTransform4D($ct, 4, \@x, \@y, \@$z, \@$t, \@ps), "Coordinate transformation 4D worked");
ok(qq/@x @y/ eq $result && qq/@ps/ eq qq/1 1 1 1/, "Resulting coordinates");
$res = Geo::GDAL::FFI::OCTTransform4D($ct, 4, \@x, \@y, \@$z, \@$t, \@ps);
is($res, 1, "Coordinate transformation 4D worked");
is_deeply([@x, @y, @ps], [@result, 1, 1, 1, 1], "Checking resulting coordinates");

@x = ($ul[0], $lr[0], $ur[0], $ll[0]);
@y = ($ul[1], $lr[1], $ur[1], $ll[1]);
$z = undef;
$t = undef;
@ps = (0,0,0,0);
ok(Geo::GDAL::FFI::OCTTransform4DWithErrorCodes($ct, 4, \@x, \@y, \@$z, \@$t, \@ps), "Coordinate transformation 4D worked");
ok(qq/@x @y/ eq $result, "Resulting coordinates");
ok(scalar @ps == 4 && qq/@ps/ eq qq/0 0 0 0/, "Resulting pabSuccess is SUCCESS(i.e. 0) x 4" );
$res = Geo::GDAL::FFI::OCTTransform4DWithErrorCodes($ct, 4, \@x, \@y, \@$z, \@$t, \@ps);
is($res, 1, "Coordinate transformation 4D worked");
is_deeply([@x, @y], \@result, "Checking resulting coordinates");
is(scalar @ps, 4, "Resulting pabSuccess is an array of size 4");
is_deeply(\@ps, [0, 0, 0, 0], "Resulting pabSuccess is SUCCESS(i.e. 0) x 4" );
}

done_testing();

0 comments on commit fe8c8d0

Please sign in to comment.