From 9460ef252a7c12475ec83d914d06a970c98bc569 Mon Sep 17 00:00:00 2001 From: Francesco Paolo Lovergine Date: Sat, 18 Nov 2023 17:04:37 +0100 Subject: [PATCH 1/6] Close #53 with simple tests. --- lib/Geo/GDAL/FFI.pm | 16 ++++++------- t/00.t | 5 +++++ t/transform.t | 55 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 8 deletions(-) create mode 100644 t/transform.t diff --git a/lib/Geo/GDAL/FFI.pm b/lib/Geo/GDAL/FFI.pm index 55bb80e..871ab25 100644 --- a/lib/Geo/GDAL/FFI.pm +++ b/lib/Geo/GDAL/FFI.pm @@ -536,9 +536,9 @@ $ffi->attach('GDALInitGCPs' => [qw/int opaque/] => 'void'); $ffi->attach('GDALDeinitGCPs' => [qw/int opaque/] => 'void'); $ffi->attach('GDALDuplicateGCPs' => [qw/int opaque/] => 'opaque'); $ffi->attach('GDALGCPsToGeoTransform' => [qw/int opaque double* int/] => 'int'); -$ffi->attach('GDALInvGeoTransform' => [qw/double* double*/] => 'int'); -$ffi->attach('GDALApplyGeoTransform' => [qw/double* double double double* double*/] => 'void'); -$ffi->attach('GDALComposeGeoTransforms' => [qw/double* double* double*/] => 'void'); +$ffi->attach('GDALInvGeoTransform' => [qw/double[] double[]/] => 'int'); +$ffi->attach('GDALApplyGeoTransform' => [qw/double[6] double double double* double*/] => 'void'); +$ffi->attach('GDALComposeGeoTransforms' => [qw/double[6] double[6] double[6]/] => 'void'); $ffi->attach('GDALGetMetadataDomainList' => [qw/opaque/] => 'opaque'); $ffi->attach('GDALGetMetadata' => [qw/opaque string/] => 'opaque'); $ffi->attach('GDALSetMetadata' => [qw/opaque opaque string/] => 'int'); @@ -1509,11 +1509,11 @@ $ffi->attach('OCTGetSourceCS' => [qw/opaque/] => 'opaque'); $ffi->attach('OCTGetTargetCS' => [qw/opaque/] => 'opaque'); $ffi->attach('OCTGetInverse' => [qw/opaque/] => 'opaque'); $ffi->attach('OCTDestroyCoordinateTransformation' => [qw/opaque/] => 'void'); -$ffi->attach('OCTTransform' => [qw/opaque int double* double* double*/] => 'int'); -$ffi->attach('OCTTransformEx' => [qw/opaque int double* double* double* int*/] => 'int'); -$ffi->attach('OCTTransform4D' => [qw/opaque int double* double* double* double* int*/] => 'int'); -$ffi->attach('OCTTransform4DWithErrorCodes' => [qw/opaque int double* double* double* double* int*/] => 'int'); -$ffi->attach('OCTTransformBounds' => [qw/opaque double double double double double* double* double* double* int/] => 'int'); +$ffi->attach('OCTTransform' => [qw/opaque int double[] double[] double[]/] => 'int'); +$ffi->attach('OCTTransformEx' => [qw/opaque int double[] double[] double[] int[]/] => 'int'); +$ffi->attach('OCTTransform4D' => [qw/opaque int double[] double[] double[] double[] int[]/] => 'int'); +$ffi->attach('OCTTransform4DWithErrorCodes' => [qw/opaque int double[] double[] double[] double[] int[]/] => 'int'); +$ffi->attach('OCTTransformBounds' => [qw/opaque double double double double double[] double[] double[] double[] int/] => 'int'); # from apps/gdal_utils.h $ffi->attach('GDALInfoOptionsNew' => [qw/opaque opaque/] => 'opaque'); $ffi->attach('GDALInfoOptionsFree' => [qw/opaque/] => 'void'); diff --git a/t/00.t b/t/00.t index 56e3612..4f57c03 100644 --- a/t/00.t +++ b/t/00.t @@ -210,6 +210,11 @@ if(1){ is($p, $ogc_wkt, "Set/get projection string"); my $transform = [10,2,0,20,0,3]; $ds->SetGeoTransform($transform); + my $inv = [0,0,0,0,0,0]; + ok(Geo::GDAL::FFI::GDALInvGeoTransform($transform, $inv) && "@$inv" eq "-5 0.5 0 -6.66666666666667 0 0.333333333333333", "Invert geotransform"); + my ($x, $y); + Geo::GDAL::FFI::GDALApplyGeoTransform($transform,5,5,\$x,\$y); + ok($x == 20 && $y == 35, "Applied geotransform to pixel coords"); my $t = $ds->GetGeoTransform; is_deeply($t, $transform, "Set/get geotransform"); diff --git a/t/transform.t b/t/transform.t new file mode 100644 index 0000000..3e726e5 --- /dev/null +++ b/t/transform.t @@ -0,0 +1,55 @@ +use v5.10; +use strict; +use warnings; +use Carp; +use Geo::GDAL::FFI; +use Test::More; + +# test about SRS transformations API by using a simple extent (4 points) in UTM33 -> WGS84 + +if(1) { + my $source_srs = Geo::GDAL::FFI::SpatialReference->new( EPSG => 4326 ); + my $target_srs = Geo::GDAL::FFI::SpatialReference->new( EPSG => 32633 ); + my $ct = Geo::GDAL::FFI::OCTNewCoordinateTransformation($$source_srs, $$target_srs); + + my @extent = (16.509888, 41.006911, 17.084248, 41.370581); + + my @ul = ($extent[0], $extent[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 @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"); + + @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" ); + + @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"); + + @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" ); +} + +done_testing(); From a0af979de47d352eed9c809b9d57e4892af6e091 Mon Sep 17 00:00:00 2001 From: shawnlaffan Date: Sat, 18 Nov 2023 12:07:21 +1100 Subject: [PATCH 2/6] vsistdout.t: write method needs to return 1 Also generate two features to ensure the write works properly. Otherwise a single feature was being written but followed by a failure. --- t/vsistdout.t | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/t/vsistdout.t b/t/vsistdout.t index 02be848..61ff542 100644 --- a/t/vsistdout.t +++ b/t/vsistdout.t @@ -19,9 +19,10 @@ use JSON; sub write { my $line = shift; push @output, $line; + return 1; } sub close { - push @output, "end"; + return 1; } sub output { my $output = join '', @output; @@ -33,14 +34,17 @@ use JSON; # test vsistdout redirection if(1){ # create a small layer and copy it to vsistdout with redirection - my $layer = GetDriver('Memory')->Create->CreateLayer({GeometryType => 'None'}); + my $ds = GetDriver('Memory')->Create; + my $layer = $ds->CreateLayer({GeometryType => 'None'}); $layer->CreateField(value => 'Integer'); $layer->CreateGeomField(geom => 'Point'); - my $feature = Geo::GDAL::FFI::Feature->new($layer->GetDefn); - $feature->SetField(value => 12); - $feature->SetGeomField(geom => [WKT => 'POINT(1 1)']); - $layer->CreateFeature($feature); - + for my $i (1..2) { + my $feature = Geo::GDAL::FFI::Feature->new($layer->GetDefn); + $feature->SetField(value => 12); + $feature->SetGeomField(geom => [WKT => "POINT(1 $i)"]); + $layer->CreateFeature($feature); + } + $ds->FlushCache; my $output = Output->new; my $gdal = Geo::GDAL::FFI->get_instance; $gdal->SetWriter($output); @@ -48,16 +52,18 @@ if(1){ $gdal->CloseWriter; my $ret = $output->output; - ok($ret eq - '{"type": "FeatureCollection",'. - '"features": '. - '[{ "type": "Feature", "id": 0, "properties": '. - '{ "value": 12 }, "geometry": { "type": "Point", '. - '"coordinates": [ 1.0, 1.0 ] } }]}end', + my $exp = <<'EODATA' +{"type": "FeatureCollection","features": [{ "type": "Feature", "id": 0, "properties": { "value": 12 }, "geometry": { "type": "Point", "coordinates": [ 1.0, 1.0 ] } },{ "type": "Feature", "id": 1, "properties": { "value": 12 }, "geometry": { "type": "Point", "coordinates": [ 1.0, 2.0 ] } }]} +EODATA + ; + $exp =~ s/\n$//; + + is($ret, $exp, "Redirect vsistdout to write/close methods of a class."); } + # test Translate if(1){ my $ds = GetDriver('GTiff')->Create('/vsimem/test.tiff', 10); From d0c33d08e0a7130e2a589c5e9c73aaf36c4c6462 Mon Sep 17 00:00:00 2001 From: shawnlaffan Date: Sat, 18 Nov 2023 12:22:03 +1100 Subject: [PATCH 3/6] t/vsistdout.t: decode JSON and use is_deeply for test Refactor the expected structure in the process. --- t/vsistdout.t | 45 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/t/vsistdout.t b/t/vsistdout.t index 61ff542..8159f92 100644 --- a/t/vsistdout.t +++ b/t/vsistdout.t @@ -52,13 +52,11 @@ if(1){ $gdal->CloseWriter; my $ret = $output->output; - my $exp = <<'EODATA' -{"type": "FeatureCollection","features": [{ "type": "Feature", "id": 0, "properties": { "value": 12 }, "geometry": { "type": "Point", "coordinates": [ 1.0, 1.0 ] } },{ "type": "Feature", "id": 1, "properties": { "value": 12 }, "geometry": { "type": "Point", "coordinates": [ 1.0, 2.0 ] } }]} -EODATA - ; - $exp =~ s/\n$//; + $ret = decode_json $ret; - is($ret, $exp, + my $exp = decode_json (get_expected_json_data()); + + is_deeply ($ret, $exp, "Redirect vsistdout to write/close methods of a class."); } @@ -72,3 +70,38 @@ if(1){ } done_testing(); + + +sub get_expected_json_data { + my $json = <<'EOJSON' +{ + "type": "FeatureCollection", + "features": [{ + "type": "Feature", + "id": 0, + "properties": { + "value": 12 + }, + "geometry": { + "type": "Point", + "coordinates": [1.0, 1.0] + } + }, { + "type": "Feature", + "id": 1, + "properties": { + "value": 12 + }, + "geometry": { + "type": "Point", + "coordinates": [1.0, 2.0] + } + } + ] +} +EOJSON + ; + return $json; +} + + From 40bebd9cd546abd7250a0b2d4c9789f8c5fc2729 Mon Sep 17 00:00:00 2001 From: Ari Jolma Date: Tue, 19 Dec 2023 07:27:00 +0200 Subject: [PATCH 4/6] Release version 0.11 --- Changes | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 93bf026..41eda02 100644 --- a/Changes +++ b/Changes @@ -1,7 +1,11 @@ Revision history for Perl extension Geo::GDAL::FFI -0.11 unreleased +0.12 unreleased + +0.11 December 19, 2023 - Removed use of to FFI::Platypus::Declare, now discouraged. + - Add Layer::GetFeatureCount method + - Bugfixes 0.10 July 10, 2023 - Add dependency to FFI::Platypus::Declare From 8dcabdad9c1b645648b1b51e3132e740bad1557c Mon Sep 17 00:00:00 2001 From: Ari Jolma Date: Tue, 19 Dec 2023 07:32:08 +0200 Subject: [PATCH 5/6] Set version to 0.12 --- lib/Geo/GDAL/FFI.pm | 2 +- lib/Geo/GDAL/FFI/Band.pm | 2 +- lib/Geo/GDAL/FFI/Dataset.pm | 2 +- lib/Geo/GDAL/FFI/Driver.pm | 2 +- lib/Geo/GDAL/FFI/Feature.pm | 2 +- lib/Geo/GDAL/FFI/FeatureDefn.pm | 2 +- lib/Geo/GDAL/FFI/FieldDefn.pm | 2 +- lib/Geo/GDAL/FFI/GeomFieldDefn.pm | 2 +- lib/Geo/GDAL/FFI/Geometry.pm | 2 +- lib/Geo/GDAL/FFI/Layer.pm | 2 +- lib/Geo/GDAL/FFI/Object.pm | 2 +- lib/Geo/GDAL/FFI/SpatialReference.pm | 2 +- lib/Geo/GDAL/FFI/VSI.pm | 2 +- lib/Geo/GDAL/FFI/VSI/File.pm | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/Geo/GDAL/FFI.pm b/lib/Geo/GDAL/FFI.pm index 871ab25..a00ed5a 100644 --- a/lib/Geo/GDAL/FFI.pm +++ b/lib/Geo/GDAL/FFI.pm @@ -26,7 +26,7 @@ use Geo::GDAL::FFI::GeomFieldDefn; use Geo::GDAL::FFI::Feature; use Geo::GDAL::FFI::Geometry; -our $VERSION = 0.1100; +our $VERSION = 0.1200; our $DEBUG = 0; our @ISA = qw(Exporter); diff --git a/lib/Geo/GDAL/FFI/Band.pm b/lib/Geo/GDAL/FFI/Band.pm index a95bf8f..0297d9b 100644 --- a/lib/Geo/GDAL/FFI/Band.pm +++ b/lib/Geo/GDAL/FFI/Band.pm @@ -6,7 +6,7 @@ use Carp; use FFI::Platypus::Buffer; use base 'Geo::GDAL::FFI::Object'; -our $VERSION = 0.1100; +our $VERSION = 0.1200; sub DESTROY { my $self = shift; diff --git a/lib/Geo/GDAL/FFI/Dataset.pm b/lib/Geo/GDAL/FFI/Dataset.pm index 226aa59..68f9286 100644 --- a/lib/Geo/GDAL/FFI/Dataset.pm +++ b/lib/Geo/GDAL/FFI/Dataset.pm @@ -6,7 +6,7 @@ use Carp; use base 'Geo::GDAL::FFI::Object'; use Scalar::Util qw /blessed/; -our $VERSION = 0.1100; +our $VERSION = 0.1200; sub DESTROY { my $self = shift; diff --git a/lib/Geo/GDAL/FFI/Driver.pm b/lib/Geo/GDAL/FFI/Driver.pm index 4900122..3ae7fe0 100644 --- a/lib/Geo/GDAL/FFI/Driver.pm +++ b/lib/Geo/GDAL/FFI/Driver.pm @@ -5,7 +5,7 @@ use warnings; use Carp; use base 'Geo::GDAL::FFI::Object'; -our $VERSION = 0.1100; +our $VERSION = 0.1200; sub GetName { my $self = shift; diff --git a/lib/Geo/GDAL/FFI/Feature.pm b/lib/Geo/GDAL/FFI/Feature.pm index ac454af..36b37cd 100644 --- a/lib/Geo/GDAL/FFI/Feature.pm +++ b/lib/Geo/GDAL/FFI/Feature.pm @@ -7,7 +7,7 @@ use Carp; use Encode qw(decode encode); use FFI::Platypus::Buffer; -our $VERSION = 0.1100; +our $VERSION = 0.1200; sub new { my ($class, $defn) = @_; diff --git a/lib/Geo/GDAL/FFI/FeatureDefn.pm b/lib/Geo/GDAL/FFI/FeatureDefn.pm index f87ef74..e490465 100644 --- a/lib/Geo/GDAL/FFI/FeatureDefn.pm +++ b/lib/Geo/GDAL/FFI/FeatureDefn.pm @@ -4,7 +4,7 @@ use strict; use warnings; use Carp; -our $VERSION = 0.1100; +our $VERSION = 0.1200; sub new { my ($class, $args) = @_; diff --git a/lib/Geo/GDAL/FFI/FieldDefn.pm b/lib/Geo/GDAL/FFI/FieldDefn.pm index c4fc20b..96e5c5b 100644 --- a/lib/Geo/GDAL/FFI/FieldDefn.pm +++ b/lib/Geo/GDAL/FFI/FieldDefn.pm @@ -4,7 +4,7 @@ use strict; use warnings; use Carp; -our $VERSION = 0.1100; +our $VERSION = 0.1200; sub new { my ($class, $args) = @_; diff --git a/lib/Geo/GDAL/FFI/GeomFieldDefn.pm b/lib/Geo/GDAL/FFI/GeomFieldDefn.pm index d60b459..7eec3be 100644 --- a/lib/Geo/GDAL/FFI/GeomFieldDefn.pm +++ b/lib/Geo/GDAL/FFI/GeomFieldDefn.pm @@ -4,7 +4,7 @@ use strict; use warnings; use Carp; -our $VERSION = 0.1100; +our $VERSION = 0.1200; sub new { my ($class, $args) = @_; diff --git a/lib/Geo/GDAL/FFI/Geometry.pm b/lib/Geo/GDAL/FFI/Geometry.pm index 771b4ac..ce9a455 100644 --- a/lib/Geo/GDAL/FFI/Geometry.pm +++ b/lib/Geo/GDAL/FFI/Geometry.pm @@ -4,7 +4,7 @@ use strict; use warnings; use Carp; -our $VERSION = 0.1100; +our $VERSION = 0.1200; my %ref; diff --git a/lib/Geo/GDAL/FFI/Layer.pm b/lib/Geo/GDAL/FFI/Layer.pm index aa32613..a37c5ed 100644 --- a/lib/Geo/GDAL/FFI/Layer.pm +++ b/lib/Geo/GDAL/FFI/Layer.pm @@ -5,7 +5,7 @@ use warnings; use Carp; use base 'Geo::GDAL::FFI::Object'; -our $VERSION = 0.1100; +our $VERSION = 0.1200; sub DESTROY { my $self = shift; diff --git a/lib/Geo/GDAL/FFI/Object.pm b/lib/Geo/GDAL/FFI/Object.pm index dff9286..a2e8c24 100644 --- a/lib/Geo/GDAL/FFI/Object.pm +++ b/lib/Geo/GDAL/FFI/Object.pm @@ -4,7 +4,7 @@ use strict; use warnings; use Carp; -our $VERSION = 0.1100; +our $VERSION = 0.1200; sub GetDescription { my $self = shift; diff --git a/lib/Geo/GDAL/FFI/SpatialReference.pm b/lib/Geo/GDAL/FFI/SpatialReference.pm index a466627..2bcce4d 100644 --- a/lib/Geo/GDAL/FFI/SpatialReference.pm +++ b/lib/Geo/GDAL/FFI/SpatialReference.pm @@ -4,7 +4,7 @@ use strict; use warnings; use Carp; -our $VERSION = 0.1100; +our $VERSION = 0.1200; sub new { my ($class, $arg, @arg) = @_; diff --git a/lib/Geo/GDAL/FFI/VSI.pm b/lib/Geo/GDAL/FFI/VSI.pm index ab6369b..9217bbc 100644 --- a/lib/Geo/GDAL/FFI/VSI.pm +++ b/lib/Geo/GDAL/FFI/VSI.pm @@ -7,7 +7,7 @@ use Carp; use FFI::Platypus::Buffer; require Exporter; -our $VERSION = 0.1100; +our $VERSION = 0.1200; our @ISA = qw(Exporter); our @EXPORT_OK = qw(Mkdir Rmdir ReadDir FOpen Unlink Rename); diff --git a/lib/Geo/GDAL/FFI/VSI/File.pm b/lib/Geo/GDAL/FFI/VSI/File.pm index 7b92c58..6f6982f 100644 --- a/lib/Geo/GDAL/FFI/VSI/File.pm +++ b/lib/Geo/GDAL/FFI/VSI/File.pm @@ -6,7 +6,7 @@ use Encode qw(decode encode); use Carp; use FFI::Platypus::Buffer; -our $VERSION = 0.1100; +our $VERSION = 0.1200; sub Open { my ($class, $path, $access) = @_; From fe8c8d0d1a6622d2c4e41f4d66facc0c3c23433c Mon Sep 17 00:00:00 2001 From: Francesco Paolo Lovergine Date: Tue, 19 Dec 2023 19:47:02 +0100 Subject: [PATCH 6/6] Revised to use is/is_deeply() in t/transform instead of ok() --- t/transform.t | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/t/transform.t b/t/transform.t index 3e726e5..613d991 100644 --- a/t/transform.t +++ b/t/transform.t @@ -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();