[Git][debian-gis-team/proj-rdnap][master] 2 commits: Further improve PROJ 6 support in test script.

Bas Couwenberg gitlab at salsa.debian.org
Mon May 6 20:40:36 BST 2019



Bas Couwenberg pushed to branch master at Debian GIS Project / proj-rdnap


Commits:
458b365d by Bas Couwenberg at 2019-05-06T19:13:05Z
Further improve PROJ 6 support in test script.

- - - - -
b73814e1 by Bas Couwenberg at 2019-05-06T19:40:22Z
Replace tabs with spaces in test script.

- - - - -


2 changed files:

- debian/changelog
- debian/patches/add-test.patch


Changes:

=====================================
debian/changelog
=====================================
@@ -3,6 +3,7 @@ proj-rdnap (2008-9) UNRELEASED; urgency=medium
   * Bump Standards-Version to 4.3.0, no changes.
   * Add support for PROJ 6.0.0.
   * Remove package name from lintian overrides.
+  * Replace tabs with spaces in test script.
 
  -- Bas Couwenberg <sebastic at debian.org>  Thu, 05 Jul 2018 10:57:23 +0200
 


=====================================
debian/patches/add-test.patch
=====================================
@@ -62,7 +62,7 @@ Author: Bas Couwenberg <sebastic at debian.org>
 +<rd> +proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +nadgrids=rdtrans2008.gsb +units=m +no_defs <>
 --- /dev/null
 +++ b/testrdtrans2008.json
-@@ -0,0 +1,179 @@
+@@ -0,0 +1,180 @@
 +[
 +  {
 +    "number"  : "01",
@@ -168,7 +168,8 @@ Author: Bas Couwenberg <sebastic at debian.org>
 +                  "height"    : "^-?(\\d+\\.\\d+|inf)$",
 +                  "x"         : "*",
 +                  "y"         : "*",
-+                  "nap"       : "^-?(\\d+\\.\\d+|inf)$"
++                  "nap"       : "^-?(\\d+\\.\\d+|inf)$",
++                  "margin"    : "ignore"
 +                }
 +  },
 +  {
@@ -263,32 +264,32 @@ Author: Bas Couwenberg <sebastic at debian.org>
 +$|=1;
 +
 +my %cfg = (
-+	    tests   => 'testrdtrans2008.json',
-+	    verbose => 0,
-+	    help    => 0,
-+	  );
++            tests   => 'testrdtrans2008.json',
++            verbose => 0,
++            help    => 0,
++          );
 +
 +my $result = GetOptions(
-+			 'v|verbose' => \$cfg{verbose},
-+			 'h|help'    => \$cfg{help},
-+		       );
++                         'v|verbose' => \$cfg{verbose},
++                         'h|help'    => \$cfg{help},
++                       );
 +
 +if(!$result || $cfg{help}) {
-+	print STDERR "\n" if(!$result);
++    print STDERR "\n" if(!$result);
 +
-+	print "Usage: ". basename($0). " [OPTIONS]\n\n";
-+	print "Options:\n";
-+	print "-v, --verbose   Enable verbose output\n";
-+	print "-h, --help      Display this usage information\n";
++    print "Usage: ". basename($0). " [OPTIONS]\n\n";
++    print "Options:\n";
++    print "-v, --verbose   Enable verbose output\n";
++    print "-h, --help      Display this usage information\n";
 +
-+	exit 1;
++    exit 1;
 +}
 +
 +$cfg{verbose} = 1 if($ENV{VERBOSE});
 +
 +if(!-r $cfg{tests}) {
-+	print "Error: Cannot read tests file: $cfg{tests}\n";
-+	exit 1;
++    print "Error: Cannot read tests file: $cfg{tests}\n";
++    exit 1;
 +}
 +
 +if($ENV{PROJ_LIB}) {
@@ -307,388 +308,388 @@ Author: Bas Couwenberg <sebastic at debian.org>
 +# Rel. 5.2.0, September 15th, 2018
 +# Rel. 6.0.0, March 1st, 2019
 +if($err =~ /^Rel\. (\d+)\.(\d+)\.(\d+)(\S*?), /) {
-+	%proj_version = (
-+                          major => $1,
-+                          minor => $2,
-+                          patch => $3,
-+                          extra => $4,
-+                        );
-+
-+        print "PROJ version: $1.$2.$3$4\n" if($cfg{verbose});
++    %proj_version = (
++                      major => $1,
++                      minor => $2,
++                      patch => $3,
++                      extra => $4,
++                    );
++
++    print "PROJ version: $1.$2.$3$4\n" if($cfg{verbose});
 +}
 +else {
-+	print "Error: Failed to extract version from cs2cs!\n";
-+	exit 1;
++    print "Error: Failed to extract version from cs2cs!\n";
++    exit 1;
 +}
 +
 +if($proj_version{major} >= 6) {
-+	my $old = 'epsg';
-+	my $new = 'epsg.bak';
++    my $old = 'epsg';
++    my $new = 'epsg.bak';
 +
-+	print "Renaming: $old to: $new\n" if($cfg{verbose});
++    print "Renaming: $old to: $new\n" if($cfg{verbose});
 +
-+	rename($old, $new) || die "Error: Failed to rename: $old -> $new ($!)";
++    rename($old, $new) || die "Error: Failed to rename: $old -> $new ($!)";
 +
-+	print "\n" if($cfg{verbose});
++    print "\n" if($cfg{verbose});
 +}
 +
 +my $json  = read_file($cfg{tests});
 +my $tests = from_json($json);
 +
 +my %proj = (
-+	     etrs89 => {
-+		         init   => '+init=epsg:4258',
-+		         args   => '-r',
-+		         format => '%.9f',
-+		       },
-+	     rdnap  => {
-+		         init   => '+init=rdnap:rdnap',
-+		         args   => '-s',
-+		         format => '%.4f',
-+		       },
-+	   );
++             etrs89 => {
++                         init   => '+init=epsg:4258',
++                         args   => '-r',
++                         format => '%.9f',
++                       },
++             rdnap  => {
++                         init   => '+init=rdnap:rdnap',
++                         args   => '-s',
++                         format => '%.4f',
++                       },
++           );
 +
 +if($proj_version{major} >= 6) {
-+	$proj{etrs89}{init} = 'EPSG:4937';
-+	$proj{etrs89}{args} = '';
++    $proj{etrs89}{init} = 'EPSG:4937';
++    $proj{etrs89}{args} = '';
 +
-+	$proj{rdnap}{init} = 'EPSG:28992+5709';
-+	$proj{rdnap}{args} = '';
++    $proj{rdnap}{init} = 'EPSG:7415';
++    $proj{rdnap}{args} = '';
 +}
 +
 +my @directions = (
-+		   {
-+		     name => 'From ETRS89 to RD/NAP',
-+		     src  => 'etrs89',
-+		     dst  => 'rdnap',
-+		   },
-+		   {
-+		     name => 'From RD/NAP to ETRS89',
-+		     src  => 'rdnap',
-+		     dst  => 'etrs89',
-+		   },
-+		 );
++                   {
++                     name => 'From ETRS89 to RD/NAP',
++                     src  => 'etrs89',
++                     dst  => 'rdnap',
++                   },
++                   {
++                     name => 'From RD/NAP to ETRS89',
++                     src  => 'rdnap',
++                     dst  => 'etrs89',
++                   },
++                 );
 +
 +my $errors = 0;
 +
 +foreach my $direction (@directions) {
-+	print "Direction: $direction->{name}\n\n" if($cfg{verbose});
-+
-+	foreach my $test (@{$tests}) {
-+		print "Test:   $test->{number} $test->{name}\n" if($cfg{verbose});
-+
-+		my @cmd = ('cs2cs');
-+
-+		if($proj{ $direction->{src} }->{args}) {
-+			push @cmd, $proj{ $direction->{src} }->{args},
-+		}
-+
-+		push @cmd, (
-+			     $proj{ $direction->{src} }->{init},
-+			     '+to',
-+			     $proj{ $direction->{dst} }->{init},
-+			     '-f', $proj{ $direction->{dst} }->{format},
-+			   );
-+
-+		my ($in, $out, $err) = '';
-+
-+		if($direction->{src} eq 'etrs89') {
-+			$in  = $test->{etrs89}->{latitude}." ".$test->{etrs89}->{longitude};
-+			$in .= " ".$test->{etrs89}->{height} if($test->{etrs89}->{height});
-+			$in .= "\n";
-+		}
-+		elsif($direction->{src} eq 'rdnap') {
-+			$in  = $test->{rdnap}->{x}." ".$test->{rdnap}->{y};
-+			$in .= " ".$test->{rdnap}->{nap} if($test->{rdnap}->{nap});
-+			$in .= "\n";
-+		}
-+		else {
-+			print "Warning: Unsupported source: $direction->{src}, skipping test\n";
-+			next;
-+		}
-+
-+		my $expect = '';
-+
-+		if($direction->{dst} eq 'etrs89') {
-+			$expect  = $test->{etrs89}->{latitude}."\t".$test->{etrs89}->{longitude};
-+			$expect .= " ".$test->{etrs89}->{height} if($test->{etrs89}->{height});
-+			$expect .= "\n";
-+		}
-+		elsif($direction->{dst} eq 'rdnap') {
-+			$expect  = $test->{rdnap}->{x}."\t".$test->{rdnap}->{y};
-+			$expect .= " ".$test->{rdnap}->{nap} if($test->{rdnap}->{nap});
-+			$expect .= "\n";
-+		}
-+		else {
-+			print "Warning: Unsupported destination: $direction->{dst}, skipping test\n";
-+			next;
-+		}
-+
-+		if($cfg{verbose}) {
-+			print "Exec:   @cmd\n";
-+			print "Input:  $in";
-+		}
-+
-+		run \@cmd, \$in, \$out, \$err || die "Error: Command failed: @cmd ($?)";
-+
-+		if($cfg{verbose}) {
-+			print "STDERR: $err" if($err);
-+			print "Output: $out";
-+			print "Expect: $expect";
-+		}
-+
-+		my $ok  = 1;
-+		my $msg = '';
-+
-+		if($out ne $expect) {
-+			chomp($out);
-+			chomp($expect);
-+
-+			my @out_parts    = split /[\t ]/, $out;
-+			my @expect_parts = split /[\t ]/, $expect;
-+
-+			my $output_override = 0;
-+			my $margin_override = 0;
-+
-+			if($direction->{dst} eq 'etrs89') {
-+				if($out_parts[0] =~ /^\d+\.\d+$/) {
-+					my $diff = 0;
-+					my $max  = 0.00000001;
-+
-+					if($out_parts[0] > $expect_parts[0]) {
-+						$diff = $out_parts[0] - $expect_parts[0];
-+					}
-+					elsif($out_parts[0] < $expect_parts[0]) {
-+						$diff = $expect_parts[0] - $out_parts[0];
-+					}
-+
-+					if($diff > $max) {
-+						print "Latitude exceeds $max degrees: $diff\n" if($cfg{verbose});
-+						if($test->{override} && $test->{override}->{margin} && $test->{override}->{margin} eq 'ignore') {
-+							$margin_override = 1;
-+						}
-+						else {
-+							$ok = 0;
-+						}
-+					}
-+				}
-+				elsif($test->{override} && $test->{override}->{latitude}) {
-+				       	if($out_parts[0] ne $test->{override}->{latitude}) {
-+						print "Latitude not expected: $out_parts[0], expected: $test->{override}->{latitude}\n" if($cfg{verbose});
-+						$ok = 0;
-+					}
-+
-+					$output_override = 1;
-+				}
-+
-+				if($out_parts[1] =~ /^\d+\.\d+$/) {
-+					my $diff = 0;
-+					my $max  = 0.00000001;
-+
-+					if($out_parts[1] > $expect_parts[1]) {
-+						$diff = $out_parts[1] - $expect_parts[1];
-+					}
-+					elsif($out_parts[1] < $expect_parts[1]) {
-+						$diff = $expect_parts[1] - $out_parts[1];
-+					}
-+
-+					if($diff > $max) {
-+						print "Longitude exceeds $max degrees: $diff\n" if($cfg{verbose});
-+						if($test->{override} && $test->{override}->{margin} && $test->{override}->{margin} eq 'ignore') {
-+							$margin_override = 1;
-+						}
-+						else {
-+							$ok = 0;
-+						}
-+					}
-+				}
-+				elsif($test->{override} && $test->{override}->{longitude}) {
-+				       	if($out_parts[1] ne $test->{override}->{longitude}) {
-+						print "Longitude not expected: $out_parts[1], expected: $test->{override}->{longitude}\n" if($cfg{verbose});
-+						$ok = 0;
-+					}
-+
-+					$output_override = 1;
-+				}
-+
-+				if($out_parts[2]    && $out_parts[2]    =~ /^\d+\.\d+$/ &&
-+				   $expect_parts[2] && $expect_parts[2] =~ /^\d+\.\d+$/
-+			  	) {
-+					my $diff = 0;
-+					my $max  = 0.001;
-+
-+					if($out_parts[2] > $expect_parts[2]) {
-+						$diff = $out_parts[2] - $expect_parts[2];
-+					}
-+					elsif($out_parts[2] < $expect_parts[2]) {
-+						$diff = $expect_parts[2] - $out_parts[2];
-+					}
-+
-+					if($diff > $max) {
-+						print "Height exceeds $max meters: $diff\n" if($cfg{verbose});
-+						if($test->{override} && $test->{override}->{margin} && $test->{override}->{margin} eq 'ignore') {
-+							$margin_override = 1;
-+						}
-+						else {
-+							$ok = 0;
-+						}
-+					}
-+				}
-+				elsif($test->{override} && $test->{override}->{height}) {
-+				       	if($out_parts[2] !~ /$test->{override}->{height}/) {
-+						print "Height not expected: $out_parts[2], expected: $test->{override}->{height}\n" if($cfg{verbose});
-+						$ok = 0;
-+					}
-+
-+					$output_override = 1;
-+				}
-+			}
-+			elsif($direction->{dst} eq 'rdnap') {
-+				if($out_parts[0] =~ /^\d+\.\d+$/) {
-+					my $diff = 0;
-+					my $max  = 0.001;
-+
-+					if($out_parts[0] > $expect_parts[0]) {
-+						$diff = $out_parts[0] - $expect_parts[0];
-+					}
-+					elsif($out_parts[0] < $expect_parts[0]) {
-+						$diff = $expect_parts[0] - $out_parts[0];
-+					}
-+
-+					if($diff > $max) {
-+						print "x coordinate exceeds $max meters: $diff\n" if($cfg{verbose});
-+						if($test->{override} && $test->{override}->{margin} && $test->{override}->{margin} eq 'ignore') {
-+							$margin_override = 1;
-+						}
-+						else {
-+							$ok = 0;
-+						}
-+					}
-+				}
-+				elsif($test->{override} && $test->{override}->{x}) {
-+					if($out_parts[0] ne $test->{override}->{x}) {
-+						print "x coordinate not expected: $out_parts[0], expected: $test->{override}->{x}\n" if($cfg{verbose});
-+						$ok = 0;
-+					}
-+
-+					$output_override = 1;
-+				}
-+
-+				if($out_parts[1] =~ /^\d+\.\d+$/) {
-+					my $diff = 0;
-+					my $max  = 0.001;
-+
-+					if($out_parts[1] > $expect_parts[1]) {
-+						$diff = $out_parts[1] - $expect_parts[1];
-+					}
-+					elsif($out_parts[1] < $expect_parts[1]) {
-+						$diff = $expect_parts[1] - $out_parts[1];
-+					}
-+
-+					if($diff > $max) {
-+						print "y coordinate exceeds $max meters: $diff\n" if($cfg{verbose});
-+						if($test->{override} && $test->{override}->{margin} && $test->{override}->{margin} eq 'ignore') {
-+							$margin_override = 1;
-+						}
-+						else {
-+							$ok = 0;
-+						}
-+					}
-+				}
-+				elsif($test->{override} && $test->{override}->{y}) {
-+				       	if($out_parts[1] ne $test->{override}->{y}) {
-+						print "y coordinate not expected: $out_parts[1], expected: $test->{override}->{y}\n" if($cfg{verbose});
-+						$ok = 0;
-+					}
-+
-+					$output_override = 1;
-+				}
-+
-+				if($out_parts[2]    && $out_parts[2]    =~ /^\d+\.\d+$/ &&
-+				   $expect_parts[2] && $expect_parts[2] =~ /^\d+\.\d+$/
-+			  	) {
-+					my $diff = 0;
-+					my $max  = 0.001;
-+
-+					if($out_parts[2] > $expect_parts[2]) {
-+						$diff = $out_parts[2] - $expect_parts[2];
-+					}
-+					elsif($out_parts[2] < $expect_parts[2]) {
-+						$diff = $expect_parts[2] - $out_parts[2];
-+					}
-+
-+					if($diff > $max) {
-+						print "NAP exceeds $max meters: $diff\n" if($cfg{verbose});
-+						if($test->{override} && $test->{override}->{margin} && $test->{override}->{margin} eq 'ignore') {
-+							$margin_override = 1;
-+						}
-+						else {
-+							$ok = 0;
-+						}
-+					}
-+				}
-+				elsif($test->{override} && $test->{override}->{nap}) {
-+				       	if($out_parts[2] !~ /$test->{override}->{nap}/) {
-+						print "NAP not expected: $out_parts[2], expected: $test->{override}->{nap}\n" if($cfg{verbose});
-+						$ok = 0;
-+					}
-+
-+					$output_override = 1;
-+				}
-+			}
-+
-+			$msg = "Not identical, but within margin" if($ok);
-+
-+			if($margin_override) {
-+				$msg = "Not identical, but margin ignored";
-+			}
-+			elsif($output_override) {
-+				$msg = "Expected output overriden";
-+
-+				if($direction->{dst} eq 'etrs89'  &&
-+				   $test->{override}->{latitude}  &&
-+				   $test->{override}->{longitude} &&
-+				   $test->{override}->{height}
-+				) {
-+					$msg .= ": $test->{override}->{latitude}\t$test->{override}->{longitude} $test->{override}->{height}";
-+				}
-+
-+				if($direction->{dst} eq 'rdnap' &&
-+				   $test->{override}->{x}       &&
-+				   $test->{override}->{y}       &&
-+				   $test->{override}->{nap}
-+				) {
-+					$msg .= ": $test->{override}->{x}\t$test->{override}->{y} $test->{override}->{nap}";
-+				}
-+			}
-+		}
-+
-+		if($ok) {
-+			print "Test OK: $direction->{name} - $test->{number} $test->{name}";
-+			print " ($msg)" if($msg);
-+			print "\n";
-+		}
-+		else {
-+			print "Test FAILED: $direction->{name} - $test->{number} $test->{name}";
-+			print " ($msg)" if($msg);
-+			print "\n";
-+
-+			$errors++;
-+		}
-+
-+		print "\n" if($cfg{verbose});
-+	}
++    print "Direction: $direction->{name}\n\n" if($cfg{verbose});
++
++    foreach my $test (@{$tests}) {
++        print "Test:   $test->{number} $test->{name}\n" if($cfg{verbose});
++
++        my @cmd = ('cs2cs');
++
++        if($proj{ $direction->{src} }->{args}) {
++            push @cmd, $proj{ $direction->{src} }->{args},
++        }
++
++        push @cmd, (
++                     $proj{ $direction->{src} }->{init},
++                     '+to',
++                     $proj{ $direction->{dst} }->{init},
++                     '-f', $proj{ $direction->{dst} }->{format},
++                   );
++
++        my ($in, $out, $err) = '';
++
++        if($direction->{src} eq 'etrs89') {
++            $in  = $test->{etrs89}->{latitude}." ".$test->{etrs89}->{longitude};
++            $in .= " ".$test->{etrs89}->{height} if($test->{etrs89}->{height});
++            $in .= "\n";
++        }
++        elsif($direction->{src} eq 'rdnap') {
++            $in  = $test->{rdnap}->{x}." ".$test->{rdnap}->{y};
++            $in .= " ".$test->{rdnap}->{nap} if($test->{rdnap}->{nap});
++            $in .= "\n";
++        }
++        else {
++            print "Warning: Unsupported source: $direction->{src}, skipping test\n";
++            next;
++        }
++
++        my $expect = '';
++
++        if($direction->{dst} eq 'etrs89') {
++            $expect  = $test->{etrs89}->{latitude}."\t".$test->{etrs89}->{longitude};
++            $expect .= " ".$test->{etrs89}->{height} if($test->{etrs89}->{height});
++            $expect .= "\n";
++        }
++        elsif($direction->{dst} eq 'rdnap') {
++            $expect  = $test->{rdnap}->{x}."\t".$test->{rdnap}->{y};
++            $expect .= " ".$test->{rdnap}->{nap} if($test->{rdnap}->{nap});
++            $expect .= "\n";
++        }
++        else {
++            print "Warning: Unsupported destination: $direction->{dst}, skipping test\n";
++            next;
++        }
++
++        if($cfg{verbose}) {
++            print "Exec:   @cmd\n";
++            print "Input:  $in";
++        }
++
++        run \@cmd, \$in, \$out, \$err || die "Error: Command failed: @cmd ($?)";
++
++        if($cfg{verbose}) {
++            print "STDERR: $err" if($err);
++            print "Output: $out";
++            print "Expect: $expect";
++        }
++
++        my $ok  = 1;
++        my $msg = '';
++
++        if($out ne $expect) {
++            chomp($out);
++            chomp($expect);
++
++            my @out_parts    = split /[\t ]/, $out;
++            my @expect_parts = split /[\t ]/, $expect;
++
++            my $output_override = 0;
++            my $margin_override = 0;
++
++            if($direction->{dst} eq 'etrs89') {
++                if($out_parts[0] =~ /^\d+\.\d+$/) {
++                    my $diff = 0;
++                    my $max  = 0.00000001;
++
++                    if($out_parts[0] > $expect_parts[0]) {
++                        $diff = $out_parts[0] - $expect_parts[0];
++                    }
++                    elsif($out_parts[0] < $expect_parts[0]) {
++                        $diff = $expect_parts[0] - $out_parts[0];
++                    }
++
++                    if($diff > $max) {
++                        print "Latitude exceeds $max degrees: $diff\n" if($cfg{verbose});
++                        if($test->{override} && $test->{override}->{margin} && $test->{override}->{margin} eq 'ignore') {
++                            $margin_override = 1;
++                        }
++                        else {
++                            $ok = 0;
++                        }
++                    }
++                }
++                elsif($test->{override} && $test->{override}->{latitude}) {
++                    if($out_parts[0] ne $test->{override}->{latitude}) {
++                        print "Latitude not expected: $out_parts[0], expected: $test->{override}->{latitude}\n" if($cfg{verbose});
++                        $ok = 0;
++                    }
++
++                    $output_override = 1;
++                }
++
++                if($out_parts[1] =~ /^\d+\.\d+$/) {
++                    my $diff = 0;
++                    my $max  = 0.00000001;
++
++                    if($out_parts[1] > $expect_parts[1]) {
++                        $diff = $out_parts[1] - $expect_parts[1];
++                    }
++                    elsif($out_parts[1] < $expect_parts[1]) {
++                        $diff = $expect_parts[1] - $out_parts[1];
++                    }
++
++                    if($diff > $max) {
++                        print "Longitude exceeds $max degrees: $diff\n" if($cfg{verbose});
++                        if($test->{override} && $test->{override}->{margin} && $test->{override}->{margin} eq 'ignore') {
++                            $margin_override = 1;
++                        }
++                        else {
++                            $ok = 0;
++                        }
++                    }
++                }
++                elsif($test->{override} && $test->{override}->{longitude}) {
++                    if($out_parts[1] ne $test->{override}->{longitude}) {
++                        print "Longitude not expected: $out_parts[1], expected: $test->{override}->{longitude}\n" if($cfg{verbose});
++                        $ok = 0;
++                    }
++
++                    $output_override = 1;
++                }
++
++                if($out_parts[2]    && $out_parts[2]    =~ /^\d+\.\d+$/ &&
++                   $expect_parts[2] && $expect_parts[2] =~ /^\d+\.\d+$/
++                ) {
++                    my $diff = 0;
++                    my $max  = 0.001;
++
++                    if($out_parts[2] > $expect_parts[2]) {
++                        $diff = $out_parts[2] - $expect_parts[2];
++                    }
++                    elsif($out_parts[2] < $expect_parts[2]) {
++                        $diff = $expect_parts[2] - $out_parts[2];
++                    }
++
++                    if($diff > $max) {
++                        print "Height exceeds $max meters: $diff\n" if($cfg{verbose});
++                        if($test->{override} && $test->{override}->{margin} && $test->{override}->{margin} eq 'ignore') {
++                            $margin_override = 1;
++                        }
++                        else {
++                            $ok = 0;
++                        }
++                    }
++                }
++                elsif($test->{override} && $test->{override}->{height}) {
++                    if($out_parts[2] !~ /$test->{override}->{height}/) {
++                        print "Height not expected: $out_parts[2], expected: $test->{override}->{height}\n" if($cfg{verbose});
++                        $ok = 0;
++                    }
++
++                    $output_override = 1;
++                }
++            }
++            elsif($direction->{dst} eq 'rdnap') {
++                if($out_parts[0] =~ /^\d+\.\d+$/) {
++                    my $diff = 0;
++                    my $max  = 0.001;
++
++                    if($out_parts[0] > $expect_parts[0]) {
++                        $diff = $out_parts[0] - $expect_parts[0];
++                    }
++                    elsif($out_parts[0] < $expect_parts[0]) {
++                        $diff = $expect_parts[0] - $out_parts[0];
++                    }
++
++                    if($diff > $max) {
++                        print "x coordinate exceeds $max meters: $diff\n" if($cfg{verbose});
++                        if($test->{override} && $test->{override}->{margin} && $test->{override}->{margin} eq 'ignore') {
++                            $margin_override = 1;
++                        }
++                        else {
++                            $ok = 0;
++                        }
++                    }
++                }
++                elsif($test->{override} && $test->{override}->{x}) {
++                    if($out_parts[0] ne $test->{override}->{x}) {
++                        print "x coordinate not expected: $out_parts[0], expected: $test->{override}->{x}\n" if($cfg{verbose});
++                        $ok = 0;
++                    }
++
++                    $output_override = 1;
++                }
++
++                if($out_parts[1] =~ /^\d+\.\d+$/) {
++                    my $diff = 0;
++                    my $max  = 0.001;
++
++                    if($out_parts[1] > $expect_parts[1]) {
++                        $diff = $out_parts[1] - $expect_parts[1];
++                    }
++                    elsif($out_parts[1] < $expect_parts[1]) {
++                        $diff = $expect_parts[1] - $out_parts[1];
++                    }
++
++                    if($diff > $max) {
++                        print "y coordinate exceeds $max meters: $diff\n" if($cfg{verbose});
++                        if($test->{override} && $test->{override}->{margin} && $test->{override}->{margin} eq 'ignore') {
++                            $margin_override = 1;
++                        }
++                        else {
++                            $ok = 0;
++                        }
++                    }
++                }
++                elsif($test->{override} && $test->{override}->{y}) {
++                    if($out_parts[1] ne $test->{override}->{y}) {
++                        print "y coordinate not expected: $out_parts[1], expected: $test->{override}->{y}\n" if($cfg{verbose});
++                        $ok = 0;
++                    }
++
++                    $output_override = 1;
++                }
++
++                if($out_parts[2]    && $out_parts[2]    =~ /^\d+\.\d+$/ &&
++                   $expect_parts[2] && $expect_parts[2] =~ /^\d+\.\d+$/
++                ) {
++                    my $diff = 0;
++                    my $max  = 0.001;
++
++                    if($out_parts[2] > $expect_parts[2]) {
++                        $diff = $out_parts[2] - $expect_parts[2];
++                    }
++                    elsif($out_parts[2] < $expect_parts[2]) {
++                        $diff = $expect_parts[2] - $out_parts[2];
++                    }
++
++                    if($diff > $max) {
++                        print "NAP exceeds $max meters: $diff\n" if($cfg{verbose});
++                        if($test->{override} && $test->{override}->{margin} && $test->{override}->{margin} eq 'ignore') {
++                            $margin_override = 1;
++                        }
++                        else {
++                            $ok = 0;
++                        }
++                    }
++                }
++                elsif($test->{override} && $test->{override}->{nap}) {
++                    if($out_parts[2] !~ /$test->{override}->{nap}/) {
++                        print "NAP not expected: $out_parts[2], expected: $test->{override}->{nap}\n" if($cfg{verbose});
++                        $ok = 0;
++                    }
++
++                    $output_override = 1;
++                }
++            }
++
++            $msg = "Not identical, but within margin" if($ok);
++
++            if($margin_override) {
++                $msg = "Not identical, but margin ignored";
++            }
++            elsif($output_override) {
++                $msg = "Expected output overriden";
++
++                if($direction->{dst} eq 'etrs89'  &&
++                   $test->{override}->{latitude}  &&
++                   $test->{override}->{longitude} &&
++                   $test->{override}->{height}
++                ) {
++                    $msg .= ": $test->{override}->{latitude}\t$test->{override}->{longitude} $test->{override}->{height}";
++                }
++
++                if($direction->{dst} eq 'rdnap' &&
++                   $test->{override}->{x}       &&
++                   $test->{override}->{y}       &&
++                   $test->{override}->{nap}
++                ) {
++                    $msg .= ": $test->{override}->{x}\t$test->{override}->{y} $test->{override}->{nap}";
++                }
++            }
++        }
++
++        if($ok) {
++            print "Test OK: $direction->{name} - $test->{number} $test->{name}";
++            print " ($msg)" if($msg);
++            print "\n";
++        }
++        else {
++            print "Test FAILED: $direction->{name} - $test->{number} $test->{name}";
++            print " ($msg)" if($msg);
++            print "\n";
++
++            $errors++;
++        }
++
++        print "\n" if($cfg{verbose});
++    }
 +}
 +
 +if($proj_version{major} >= 6) {
-+	print "\n" if($cfg{verbose});
++    print "\n" if($cfg{verbose});
 +
-+	my $old = 'epsg.bak';
-+	my $new = 'epsg';
++    my $old = 'epsg.bak';
++    my $new = 'epsg';
 +
-+	print "Renaming: $old to: $new\n" if($cfg{verbose});
++    print "Renaming: $old to: $new\n" if($cfg{verbose});
 +
-+	rename($old, $new) || die "Error: Failed to rename: $old -> $new ($!)";
++    rename($old, $new) || die "Error: Failed to rename: $old -> $new ($!)";
 +}
 +
 +exit $errors;



View it on GitLab: https://salsa.debian.org/debian-gis-team/proj-rdnap/compare/8dec62a42f1f11ed95eb850bb40bd119bbdcfeef...b73814e14e843a32ce4db12524858b0f651af96e

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/proj-rdnap/compare/8dec62a42f1f11ed95eb850bb40bd119bbdcfeef...b73814e14e843a32ce4db12524858b0f651af96e
You're receiving this email because of your account on salsa.debian.org.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20190506/4d3838b2/attachment-0001.html>


More information about the Pkg-grass-devel mailing list