aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--appveyor.yml10
-rw-r--r--src/Makefile.am2
-rw-r--r--src/PJ_aea.c3
-rw-r--r--src/PJ_aeqd.c1
-rw-r--r--src/PJ_airy.c1
-rw-r--r--src/PJ_aitoff.c2
-rw-r--r--src/PJ_august.c3
-rw-r--r--src/PJ_axisswap.c1
-rw-r--r--src/PJ_bacon.c3
-rw-r--r--src/PJ_bipc.c1
-rw-r--r--src/PJ_boggs.c1
-rw-r--r--src/PJ_bonne.c1
-rw-r--r--src/PJ_calcofi.c1
-rw-r--r--src/PJ_cart.c412
-rw-r--r--src/PJ_cass.c1
-rw-r--r--src/PJ_cc.c1
-rw-r--r--src/PJ_cea.c1
-rw-r--r--src/PJ_chamb.c1
-rw-r--r--src/PJ_collg.c1
-rw-r--r--src/PJ_comill.c1
-rw-r--r--src/PJ_crast.c1
-rw-r--r--src/PJ_deformation.c1
-rw-r--r--src/PJ_denoy.c1
-rw-r--r--src/PJ_eck1.c1
-rw-r--r--src/PJ_eck2.c1
-rw-r--r--src/PJ_eck3.c5
-rw-r--r--src/PJ_eck4.c2
-rw-r--r--src/PJ_eck5.c1
-rw-r--r--src/PJ_eqc.c1
-rw-r--r--src/PJ_eqdc.c1
-rw-r--r--src/PJ_fahey.c1
-rw-r--r--src/PJ_fouc_s.c1
-rw-r--r--src/PJ_gall.c1
-rw-r--r--src/PJ_geos.c1
-rw-r--r--src/PJ_gins8.c1
-rw-r--r--src/PJ_gn_sinu.c5
-rw-r--r--src/PJ_gnom.c2
-rw-r--r--src/PJ_goode.c1
-rw-r--r--src/PJ_gstmerc.c2
-rw-r--r--src/PJ_hammer.c2
-rw-r--r--src/PJ_hatano.c1
-rw-r--r--src/PJ_healpix.c3
-rw-r--r--src/PJ_helmert.c142
-rw-r--r--src/PJ_hgridshift.c50
-rw-r--r--src/PJ_horner.c83
-rw-r--r--src/PJ_igh.c1
-rw-r--r--src/PJ_imw_p.c2
-rw-r--r--src/PJ_isea.c2
-rw-r--r--src/PJ_krovak.c2
-rw-r--r--src/PJ_labrd.c2
-rw-r--r--src/PJ_laea.c2
-rw-r--r--src/PJ_lagrng.c2
-rw-r--r--src/PJ_larr.c2
-rw-r--r--src/PJ_lask.c1
-rw-r--r--src/PJ_latlong.c12
-rw-r--r--src/PJ_lcc.c2
-rw-r--r--src/PJ_lcca.c3
-rw-r--r--src/PJ_loxim.c2
-rw-r--r--src/PJ_lsat.c2
-rw-r--r--src/PJ_mbt_fps.c1
-rw-r--r--src/PJ_mbtfpp.c1
-rw-r--r--src/PJ_mbtfpq.c1
-rw-r--r--src/PJ_merc.c2
-rw-r--r--src/PJ_mill.c2
-rw-r--r--src/PJ_misrsom.c2
-rw-r--r--src/PJ_mod_ster.c6
-rw-r--r--src/PJ_moll.c3
-rw-r--r--src/PJ_molodensky.c80
-rw-r--r--src/PJ_natearth.c1
-rw-r--r--src/PJ_natearth2.c1
-rw-r--r--src/PJ_nell.c1
-rw-r--r--src/PJ_nell_h.c2
-rw-r--r--src/PJ_nocol.c1
-rw-r--r--src/PJ_nsper.c47
-rw-r--r--src/PJ_nzmg.c2
-rw-r--r--src/PJ_ob_tran.c37
-rw-r--r--src/PJ_ocea.c2
-rw-r--r--src/PJ_oea.c2
-rw-r--r--src/PJ_omerc.c2
-rw-r--r--src/PJ_ortho.c2
-rw-r--r--src/PJ_patterson.c2
-rw-r--r--src/PJ_pipeline.c124
-rw-r--r--src/PJ_poly.c2
-rw-r--r--src/PJ_putp2.c1
-rw-r--r--src/PJ_putp3.c2
-rw-r--r--src/PJ_putp4p.c3
-rw-r--r--src/PJ_putp5.c2
-rw-r--r--src/PJ_putp6.c3
-rw-r--r--src/PJ_qsc.c2
-rw-r--r--src/PJ_robin.c1
-rw-r--r--src/PJ_rpoly.c2
-rw-r--r--src/PJ_sch.c4
-rw-r--r--src/PJ_sconics.c8
-rw-r--r--src/PJ_somerc.c2
-rw-r--r--src/PJ_stere.c3
-rw-r--r--src/PJ_sterea.c2
-rw-r--r--src/PJ_sts.c6
-rw-r--r--src/PJ_tcc.c2
-rw-r--r--src/PJ_tcea.c2
-rw-r--r--src/PJ_times.c2
-rw-r--r--src/PJ_tmerc.c2
-rw-r--r--src/PJ_tpeqd.c2
-rw-r--r--src/PJ_unitconvert.c92
-rw-r--r--src/PJ_urm5.c2
-rw-r--r--src/PJ_urmfps.c3
-rw-r--r--src/PJ_vandg.c2
-rw-r--r--src/PJ_vandg2.c3
-rw-r--r--src/PJ_vandg4.c2
-rw-r--r--src/PJ_vgridshift.c61
-rw-r--r--src/PJ_wag2.c2
-rw-r--r--src/PJ_wag3.c2
-rw-r--r--src/PJ_wag7.c2
-rw-r--r--src/PJ_wink1.c2
-rw-r--r--src/PJ_wink2.c2
-rw-r--r--src/gie.c735
-rw-r--r--src/lib_proj.cmake2
-rw-r--r--src/makefile.vc3
-rw-r--r--src/pj_generic_selftest.c197
-rw-r--r--src/pj_geocent.c46
-rw-r--r--src/pj_list.c25
-rw-r--r--src/pj_run_selftests.c80
-rw-r--r--src/proj.c5
-rw-r--r--src/proj.def91
-rw-r--r--src/proj_api.h2
-rw-r--r--src/proj_etmerc.c102
-rw-r--r--src/proj_rouss.c44
-rw-r--r--src/projects.h24
-rw-r--r--test/gie/builtins.gie18
-rw-r--r--test/gie/more_builtins.gie264
-rwxr-xr-xtravis/install.sh2
130 files changed, 1065 insertions, 1923 deletions
diff --git a/appveyor.yml b/appveyor.yml
index 3e8980dc..9f66b22e 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -41,7 +41,7 @@ build_script:
- if "%BUILD_TYPE%" == "cmake" if "%platform%" == "x86" SET VS_FULL=%VS_VERSION%
- if "%BUILD_TYPE%" == "cmake" echo "%VS_FULL%"
# warning C4706: assignment within conditional expression
- - if "%BUILD_TYPE%" == "cmake" cmake -G "%VS_FULL%" . -DSELFTEST=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=../bin -DBUILD_LIBPROJ_SHARED=ON -DCMAKE_C_FLAGS="/W4 /wd4706 /WX /D_CRT_SECURE_NO_WARNINGS"
+ - if "%BUILD_TYPE%" == "cmake" cmake -G "%VS_FULL%" . -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=../bin -DBUILD_LIBPROJ_SHARED=ON -DCMAKE_C_FLAGS="/W4 /wd4706 /WX /D_CRT_SECURE_NO_WARNINGS"
- if "%BUILD_TYPE%" == "cmake" cmake --build . --config Release
test_script:
@@ -53,11 +53,15 @@ test_script:
- curl -O http://download.osgeo.org/proj/vdatum/egm96_15/egm96_15.gtx
- 7z e -aoa -y proj-datumgrid-1.6.zip
- dir
- - cd ..\bin
+ - cd ..
+ - dir
+ - cd bin
- echo "Contents of current directory:"
- dir
- - proj.exe -VC
- gie.exe ..\test\gie\builtins.gie
+ - gie.exe ..\test\gie\more_builtins.gie
+ - gie.exe ..\test\gie\deformation.gie
+ - gie.exe ..\test\gie\axisswap.gie
deploy: off
diff --git a/src/Makefile.am b/src/Makefile.am
index 7edc05b1..58514592 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -73,7 +73,7 @@ libproj_la_SOURCES = \
pj_factors.c pj_fwd.c pj_init.c pj_inv.c pj_fwd3d.c pj_inv3d.c\
pj_list.c pj_malloc.c pj_mlfn.c pj_msfn.c proj_mdist.c \
pj_open_lib.c pj_param.c pj_phi2.c pj_pr_list.c \
- pj_qsfn.c pj_generic_selftest.c pj_run_selftests.c pj_strerrno.c \
+ pj_qsfn.c pj_strerrno.c \
pj_tsfn.c pj_units.c pj_ctx.c pj_log.c pj_zpoly1.c rtodms.c \
vector1.c pj_release.c pj_gauss.c \
PJ_healpix.c PJ_natearth.c PJ_natearth2.c PJ_calcofi.c pj_fileapi.c \
diff --git a/src/PJ_aea.c b/src/PJ_aea.c
index f48d2e9b..74628f9a 100644
--- a/src/PJ_aea.c
+++ b/src/PJ_aea.c
@@ -218,6 +218,3 @@ PJ *PROJECTION(leac) {
return setup(P);
}
-
-int pj_aea_selftest (void) {return 10000;}
-int pj_leac_selftest (void) {return 10000;}
diff --git a/src/PJ_aeqd.c b/src/PJ_aeqd.c
index c089eed7..b627b438 100644
--- a/src/PJ_aeqd.c
+++ b/src/PJ_aeqd.c
@@ -320,4 +320,3 @@ PJ *PROJECTION(aeqd) {
}
-int pj_aeqd_selftest (void) {return 10000;}
diff --git a/src/PJ_airy.c b/src/PJ_airy.c
index f70e7f7a..c256a07f 100644
--- a/src/PJ_airy.c
+++ b/src/PJ_airy.c
@@ -149,4 +149,3 @@ PJ *PROJECTION(airy) {
}
-int pj_airy_selftest (void) {return 10000;}
diff --git a/src/PJ_aitoff.c b/src/PJ_aitoff.c
index 4e2f2092..8927d39c 100644
--- a/src/PJ_aitoff.c
+++ b/src/PJ_aitoff.c
@@ -194,5 +194,3 @@ PJ *PROJECTION(wintri) {
}
-int pj_aitoff_selftest (void) {return 10000;}
-int pj_wintri_selftest (void) {return 10000;}
diff --git a/src/PJ_august.c b/src/PJ_august.c
index c437ca2f..ba9ea5cd 100644
--- a/src/PJ_august.c
+++ b/src/PJ_august.c
@@ -1,5 +1,5 @@
#define PJ_LIB__
-#include <projects.h>
+#include "projects.h"
PROJ_HEAD(august, "August Epicycloidal") "\n\tMisc Sph, no inv.";
@@ -31,4 +31,3 @@ PJ *PROJECTION(august) {
return P;
}
-int pj_august_selftest (void) {return 0;}
diff --git a/src/PJ_axisswap.c b/src/PJ_axisswap.c
index 7215b9ce..53c93cc9 100644
--- a/src/PJ_axisswap.c
+++ b/src/PJ_axisswap.c
@@ -235,4 +235,3 @@ PJ *CONVERSION(axisswap,0) {
return P;
}
-int pj_axisswap_selftest (void) {return 10000;}
diff --git a/src/PJ_bacon.c b/src/PJ_bacon.c
index 930e9c07..802ddcb8 100644
--- a/src/PJ_bacon.c
+++ b/src/PJ_bacon.c
@@ -77,6 +77,3 @@ PJ *PROJECTION(ortel) {
}
-int pj_bacon_selftest (void) {return 10000;}
-int pj_apian_selftest (void) {return 10000;}
-int pj_ortel_selftest (void) {return 10000;}
diff --git a/src/PJ_bipc.c b/src/PJ_bipc.c
index 7dd8a30f..4247fc17 100644
--- a/src/PJ_bipc.c
+++ b/src/PJ_bipc.c
@@ -171,4 +171,3 @@ PJ *PROJECTION(bipc) {
}
-int pj_bipc_selftest (void) {return 10000;}
diff --git a/src/PJ_boggs.c b/src/PJ_boggs.c
index 8c35fcb3..fe17eaa6 100644
--- a/src/PJ_boggs.c
+++ b/src/PJ_boggs.c
@@ -42,4 +42,3 @@ PJ *PROJECTION(boggs) {
}
-int pj_boggs_selftest (void) {return 10000;}
diff --git a/src/PJ_bonne.c b/src/PJ_bonne.c
index 596610bb..4611c5d4 100644
--- a/src/PJ_bonne.c
+++ b/src/PJ_bonne.c
@@ -130,4 +130,3 @@ PJ *PROJECTION(bonne) {
}
-int pj_bonne_selftest (void) {return 10000;}
diff --git a/src/PJ_calcofi.c b/src/PJ_calcofi.c
index 2782b152..5c0b64ab 100644
--- a/src/PJ_calcofi.c
+++ b/src/PJ_calcofi.c
@@ -163,4 +163,3 @@ PJ *PROJECTION(calcofi) {
}
-int pj_calcofi_selftest (void) {return 10000;}
diff --git a/src/PJ_cart.c b/src/PJ_cart.c
index e2768c55..2bcf3b4b 100644
--- a/src/PJ_cart.c
+++ b/src/PJ_cart.c
@@ -219,415 +219,3 @@ PJ *CONVERSION(cart,1) {
return P;
}
-#ifndef PJ_SELFTEST
-/* selftest stub */
-int pj_cart_selftest (void) {return 0;}
-#else
-/* Testing quite a bit of the pj_obs_api as a side effect (inspired by pj_obs_api_test.c) */
-int pj_cart_selftest (void) {
- PJ_CONTEXT *ctx;
- PJ *P;
- PJ_COORD a, b, obs[2];
- PJ_COORD coord[2];
-
- PJ_INFO info;
- PJ_PROJ_INFO pj_info;
- PJ_GRID_INFO grid_info;
- PJ_INIT_INFO init_info;
-
- PJ_DERIVS derivs;
- PJ_FACTORS factors;
-
- const PJ_OPERATIONS *oper_list;
- const PJ_ELLPS *ellps_list;
- const PJ_UNITS *unit_list;
- const PJ_PRIME_MERIDIANS *pm_list;
-
- int err;
- size_t n, sz;
- double dist, h, t;
- char *args[3] = {"proj=utm", "zone=32", "ellps=GRS80"};
- char *arg = {"+proj=utm +zone=32 +ellps=GRS80"};
- char buf[40];
-
- /* An utm projection on the GRS80 ellipsoid */
- P = proj_create (PJ_DEFAULT_CTX, arg);
- if (0==P)
- return 1;
-
-
- /* Clean up */
- proj_destroy (P);
-
- /* Same projection, now using argc/argv style initialization */
- P = proj_create_argv (PJ_DEFAULT_CTX, 3, args);
- if (0==P)
- return 2;
-
- /* zero initialize everything, then set (longitude, latitude) to (12, 55) */
- a = proj_coord (0,0,0,0);
- /* a.lp: The coordinate part of a, interpreted as a classic LP pair */
- a.lp.lam = PJ_TORAD(12);
- a.lp.phi = PJ_TORAD(55);
-
- /* Forward projection */
- b = proj_trans (P, PJ_FWD, a);
-
- /* Inverse projection */
- a = proj_trans (P, PJ_INV, b);
-
- /* Null projection */
- a = proj_trans (P, PJ_IDENT, a);
-
- /* Forward again, to get two linear items for comparison */
- a = proj_trans (P, PJ_FWD, a);
-
- dist = proj_xy_dist (a.xy, b.xy);
- if (dist > 2e-9)
- return 3;
-
- /* Clear any previous error */
- proj_errno_set (P, 0);
-
- /* Invalid projection */
- a = proj_trans (P, 42, a);
- if (a.lpz.lam!=HUGE_VAL)
- return 4;
- err = proj_errno (P);
- if (0==err)
- return 5;
-
- /* Clear error again */
- proj_errno_set (P, 0);
-
- /* Clean up */
- proj_destroy (P);
-
- /* Now do some 3D transformations */
- P = proj_create (PJ_DEFAULT_CTX, "+proj=cart +ellps=GRS80");
- if (0==P)
- return 6;
-
- /* zero initialize everything, then set (longitude, latitude, height) to (12, 55, 100) */
- a = b = proj_coord (0,0,0,0);
- a.lpz.lam = PJ_TORAD(12);
- a.lpz.phi = PJ_TORAD(55);
- a.lpz.z = 100;
-
- /* Forward projection: 3D-Cartesian-to-Ellipsoidal */
- b = proj_trans (P, PJ_FWD, a);
-
- /* Check roundtrip precision for 10000 iterations each way */
- dist = proj_roundtrip (P, PJ_FWD, 10000, &a);
- dist = proj_roundtrip (P, PJ_INV, 10000, &b);
- if (dist > 2e-9)
- return 7;
-
-
- /* Test at the North Pole */
- a = b = proj_coord (0,0,0,0);
- a.lpz.lam = PJ_TORAD(0);
- a.lpz.phi = PJ_TORAD(90);
- a.lpz.z = 100;
-
- /* Forward projection: Ellipsoidal-to-3D-Cartesian */
- dist = proj_roundtrip (P, PJ_FWD, 1, &a);
- if (dist > 1e-12)
- return 8;
-
- /* Test at the South Pole */
- a = b = proj_coord (0,0,0,0);
- a.lpz.lam = PJ_TORAD(0);
- a.lpz.phi = PJ_TORAD(-90);
- a.lpz.z = 100;
- b = a;
-
- /* Forward projection: Ellipsoidal-to-3D-Cartesian */
- dist = proj_roundtrip (P, PJ_FWD, 1, &a);
- if (dist > 1e-12)
- return 9;
-
-
- /* Inverse projection: 3D-Cartesian-to-Ellipsoidal */
- b = proj_trans (P, PJ_INV, b);
-
- /* Move p to another context */
- ctx = proj_context_create ();
- if (ctx==pj_get_default_ctx())
- return 10;
- proj_context_set (P, ctx);
- if (ctx != P->ctx)
- return 11;
- b = proj_trans (P, PJ_FWD, b);
-
- /* Move it back to the default context */
- proj_context_set (P, 0);
- if (pj_get_default_ctx() != P->ctx)
- return 12;
- proj_context_destroy (ctx);
-
- /* We go on with the work - now back on the default context */
- b = proj_trans (P, PJ_INV, b);
- proj_destroy (P);
-
-
- /* Testing proj_trans_generic () */
-
- /* An utm projection on the GRS80 ellipsoid */
- P = proj_create (PJ_DEFAULT_CTX, "+proj=utm +zone=32 +ellps=GRS80");
- if (0==P)
- return 13;
-
- obs[0] = proj_coord (PJ_TORAD(12), PJ_TORAD(55), 45, 0);
- obs[1] = proj_coord (PJ_TORAD(12), PJ_TORAD(56), 50, 0);
- sz = sizeof (PJ_COORD);
-
- /* Forward projection */
- a = proj_trans (P, PJ_FWD, obs[0]);
- b = proj_trans (P, PJ_FWD, obs[1]);
-
- n = proj_trans_generic (
- P, PJ_FWD,
- &(obs[0].lpz.lam), sz, 2,
- &(obs[0].lpz.phi), sz, 2,
- &(obs[0].lpz.z), sz, 2,
- 0, sz, 0
- );
- if (2!=n)
- return 14;
- if (a.lpz.lam != obs[0].lpz.lam) return 15;
- if (a.lpz.phi != obs[0].lpz.phi) return 16;
- if (a.lpz.z != obs[0].lpz.z) return 17;
- if (b.lpz.lam != obs[1].lpz.lam) return 18;
- if (b.lpz.phi != obs[1].lpz.phi) return 19;
- if (b.lpz.z != obs[1].lpz.z) return 20;
-
- /* now test the case of constant z */
- obs[0] = proj_coord (PJ_TORAD(12), PJ_TORAD(55), 45, 0);
- obs[1] = proj_coord (PJ_TORAD(12), PJ_TORAD(56), 50, 0);
- h = 27;
- t = 33;
- n = proj_trans_generic (
- P, PJ_FWD,
- &(obs[0].lpz.lam), sz, 2,
- &(obs[0].lpz.phi), sz, 2,
- &h, 0, 1,
- &t, 0, 1
- );
- if (2!=n)
- return 21;
- if (a.lpz.lam != obs[0].lpz.lam) return 22;
- if (a.lpz.phi != obs[0].lpz.phi) return 23;
- if (45 != obs[0].lpz.z) return 24;
- if (b.lpz.lam != obs[1].lpz.lam) return 25;
- if (b.lpz.phi != obs[1].lpz.phi) return 26;
- if (50 != obs[1].lpz.z) return 27; /* NOTE: unchanged */
- if (50==h) return 28;
-
- /* test proj_trans_array () */
-
- coord[0] = proj_coord (PJ_TORAD(12), PJ_TORAD(55), 45, 0);
- coord[1] = proj_coord (PJ_TORAD(12), PJ_TORAD(56), 50, 0);
- if (proj_trans_array (P, PJ_FWD, 2, coord))
- return 40;
-
- if (a.lpz.lam != coord[0].lpz.lam) return 41;
- if (a.lpz.phi != coord[0].lpz.phi) return 42;
- if (a.lpz.z != coord[0].lpz.z) return 43;
- if (b.lpz.lam != coord[1].lpz.lam) return 44;
- if (b.lpz.phi != coord[1].lpz.phi) return 45;
- if (b.lpz.z != coord[1].lpz.z) return 46;
-
- /* Clean up after proj_trans_* tests */
- proj_destroy (P);
-
- /* test proj_create_crs_to_crs() */
- P = proj_create_crs_to_crs(PJ_DEFAULT_CTX, "epsg:25832", "epsg:25833", NULL);
- if (P==0)
- return 50;
-
- a.xy.x = 700000.0;
- a.xy.y = 6000000.0;
- b.xy.x = 307788.8761171057;
- b.xy.y = 5999669.3036037628;
-
- a = proj_trans(P, PJ_FWD, a);
- if (dist > 1e-7)
- return 51;
- proj_destroy(P);
-
- /* let's make sure that only entries in init-files results in a usable PJ */
- P = proj_create_crs_to_crs(PJ_DEFAULT_CTX, "proj=utm +zone=32 +datum=WGS84", "proj=utm +zone=33 +datum=WGS84", NULL);
- if (P != 0) {
- proj_destroy(P);
- return 52;
- }
- proj_destroy(P);
-
- /* ********************************************************************** */
- /* Test info functions */
- /* ********************************************************************** */
-
- /* proj_info() */
- /* this one is difficult to test, since the output changes with the setup */
- info = proj_info();
- if (info.version[0] != '\0' ) {
- char tmpstr[64];
- sprintf(tmpstr, "%d.%d.%d", info.major, info.minor, info.patch);
- if (strcmp(info.version, tmpstr)) return 55;
- }
- if (info.release[0] == '\0') return 56;
- if (info.searchpath[0] == '\0') return 57;
-
- /* proj_pj_info() */
- P = proj_create(PJ_DEFAULT_CTX, "+proj=august"); /* august has no inverse */
- if (proj_pj_info(P).has_inverse) { proj_destroy(P); return 60; }
- proj_destroy(P);
-
- P = proj_create(PJ_DEFAULT_CTX, arg);
- pj_info = proj_pj_info(P);
- if ( !pj_info.has_inverse ) { proj_destroy(P); return 61; }
- if ( strcmp(pj_info.definition, arg) ) { proj_destroy(P); return 62; }
- if ( strcmp(pj_info.id, "utm") ) { proj_destroy(P); return 63; }
- proj_destroy(P);
-
- /* proj_grid_info() */
- grid_info = proj_grid_info("egm96_15.gtx");
- if ( strlen(grid_info.filename) == 0 ) return 64;
- if ( strcmp(grid_info.gridname, "egm96_15.gtx") ) return 65;
- grid_info = proj_grid_info("nonexistinggrid");
- if ( strlen(grid_info.filename) > 0 ) return 66;
-
- /* proj_init_info() */
- init_info = proj_init_info("unknowninit");
- if ( strlen(init_info.filename) != 0 ) return 67;
-
- init_info = proj_init_info("epsg");
- /* Need to allow for "Unknown" until all commonly distributed EPSG-files comes with a metadata section */
- if ( strcmp(init_info.origin, "EPSG") && strcmp(init_info.origin, "Unknown") ) return 69;
- if ( strcmp(init_info.name, "epsg") ) return 68;
-
-
-
- /* test proj_rtodms() and proj_dmstor() */
- if (strcmp("180dN", proj_rtodms(buf, M_PI, 'N', 'S')))
- return 70;
-
- if (proj_dmstor(&buf[0], NULL) != M_PI)
- return 71;
-
- if (strcmp("114d35'29.612\"S", proj_rtodms(buf, -2.0, 'N', 'S')))
- return 72;
-
- /* we can't expect perfect numerical accuracy so testing with a tolerance */
- if (fabs(-2.0 - proj_dmstor(&buf[0], NULL)) > 1e-7)
- return 73;
-
-
- /* test proj_derivatives_retrieve() and proj_factors_retrieve() */
- P = proj_create(PJ_DEFAULT_CTX, "+proj=merc");
- a = proj_coord (0,0,0,0);
- a.lp.lam = PJ_TORAD(12);
- a.lp.phi = PJ_TORAD(55);
-
- derivs = proj_derivatives(P, a.lp);
- if (proj_errno(P))
- return 80; /* derivs not created correctly */
-
- if ( fabs(derivs.x_l - 1.0) > 1e-5 ) return 81;
- if ( fabs(derivs.x_p - 0.0) > 1e-5 ) return 82;
- if ( fabs(derivs.y_l - 0.0) > 1e-5 ) return 83;
- if ( fabs(derivs.y_p - 1.73959) > 1e-5 ) return 84;
-
-
- factors = proj_factors(P, a.lp);
- if (proj_errno(P))
- return 85; /* factors not created correctly */
-
- /* check a few key characteristics of the Mercator projection */
- if (factors.omega != 0.0) return 86; /* angular distortion should be 0 */
- if (factors.thetap != M_PI_2) return 87; /* Meridian/parallel angle should be 90 deg */
- if (factors.conv != 0.0) return 88; /* meridian convergence should be 0 */
-
-
- proj_destroy(P);
-
- /* Check that proj_list_* functions work by looping through them */
- n = 0;
- for (oper_list = proj_list_operations(); oper_list->id; ++oper_list) n++;
- if (n == 0) return 90;
-
- n = 0;
- for (ellps_list = proj_list_ellps(); ellps_list->id; ++ellps_list) n++;
- if (n == 0) return 91;
-
- n = 0;
- for (unit_list = proj_list_units(); unit_list->id; ++unit_list) n++;
- if (n == 0) return 92;
-
- n = 0;
- for (pm_list = proj_list_prime_meridians(); pm_list->id; ++pm_list) n++;
- if (n == 0) return 93;
-
-
- /* check io-predicates */
-
- /* angular in on fwd, linear out */
- P = proj_create (PJ_DEFAULT_CTX, "+proj=cart +ellps=GRS80");
- if (0==P) return 0;
- if (!proj_angular_input (P, PJ_FWD)) return 100;
- if ( proj_angular_input (P, PJ_INV)) return 101;
- if ( proj_angular_output (P, PJ_FWD)) return 102;
- if (!proj_angular_output (P, PJ_INV)) return 103;
- P->inverted = 1;
- if ( proj_angular_input (P, PJ_FWD)) return 104;
- if (!proj_angular_input (P, PJ_INV)) return 105;
- if (!proj_angular_output (P, PJ_FWD)) return 106;
- if ( proj_angular_output (P, PJ_INV)) return 107;
- proj_destroy(P);
-
- /* angular in and out */
- P = proj_create(PJ_DEFAULT_CTX,
- "+proj=molodensky +a=6378160 +rf=298.25 "
- "+da=-23 +df=-8.120449e-8 +dx=-134 +dy=-48 +dz=149 "
- "+abridged "
- );
- if (0==P) return 0;
- if (!proj_angular_input (P, PJ_FWD)) return 108;
- if (!proj_angular_input (P, PJ_INV)) return 109;
- if (!proj_angular_output (P, PJ_FWD)) return 110;
- if (!proj_angular_output (P, PJ_INV)) return 111;
- P->inverted = 1;
- if (!proj_angular_input (P, PJ_FWD)) return 112;
- if (!proj_angular_input (P, PJ_INV)) return 113;
- if (!proj_angular_output (P, PJ_FWD)) return 114;
- if (!proj_angular_output (P, PJ_INV)) return 115;
- proj_destroy(P);
-
- /* linear in and out */
- P = proj_create(PJ_DEFAULT_CTX,
- " +proj=helmert +ellps=GRS80"
- " +x=0.0127 +y=0.0065 +z=-0.0209 +s=0.00195"
- " +rx=-0.00039 +ry=0.00080 +rz=-0.00114"
- " +dx=-0.0029 +dy=-0.0002 +dz=-0.0006 +ds=0.00001"
- " +drx=-0.00011 +dry=-0.00019 +drz=0.00007"
- " +epoch=1988.0 +transpose"
- );
- if (0==P) return 0;
- if (proj_angular_input (P, PJ_FWD)) return 116;
- if (proj_angular_input (P, PJ_INV)) return 117;
- if (proj_angular_output (P, PJ_FWD)) return 118;
- if (proj_angular_output (P, PJ_INV)) return 119;
- P->inverted = 1;
- if (proj_angular_input (P, PJ_FWD)) return 120;
- if (proj_angular_input (P, PJ_INV)) return 121;
- if (proj_angular_output (P, PJ_FWD)) return 122;
- if (proj_angular_output (P, PJ_INV)) return 123;
- proj_destroy(P);
-
-
- return 0;
-}
-
-
-#endif
diff --git a/src/PJ_cass.c b/src/PJ_cass.c
index 603ce013..ddb3eaf3 100644
--- a/src/PJ_cass.c
+++ b/src/PJ_cass.c
@@ -118,4 +118,3 @@ PJ *PROJECTION(cass) {
}
-int pj_cass_selftest (void) {return 10000;}
diff --git a/src/PJ_cc.c b/src/PJ_cc.c
index a45eaf83..8a7da5b5 100644
--- a/src/PJ_cc.c
+++ b/src/PJ_cc.c
@@ -38,4 +38,3 @@ PJ *PROJECTION(cc) {
}
-int pj_cc_selftest (void) {return 10000;}
diff --git a/src/PJ_cea.c b/src/PJ_cea.c
index 0ffc2f4c..60ed3a37 100644
--- a/src/PJ_cea.c
+++ b/src/PJ_cea.c
@@ -98,4 +98,3 @@ PJ *PROJECTION(cea) {
}
-int pj_cea_selftest (void) {return 10000;}
diff --git a/src/PJ_chamb.c b/src/PJ_chamb.c
index de47c2d9..d0b9250e 100644
--- a/src/PJ_chamb.c
+++ b/src/PJ_chamb.c
@@ -136,4 +136,3 @@ PJ *PROJECTION(chamb) {
}
-int pj_chamb_selftest (void) {return 10000;}
diff --git a/src/PJ_collg.c b/src/PJ_collg.c
index 15e8354c..bf7d9f14 100644
--- a/src/PJ_collg.c
+++ b/src/PJ_collg.c
@@ -49,4 +49,3 @@ PJ *PROJECTION(collg) {
return P;
}
-int pj_collg_selftest (void) {return 10000;}
diff --git a/src/PJ_comill.c b/src/PJ_comill.c
index e1994478..a34762e8 100644
--- a/src/PJ_comill.c
+++ b/src/PJ_comill.c
@@ -81,4 +81,3 @@ PJ *PROJECTION(comill) {
}
-int pj_comill_selftest (void) {return 10000;}
diff --git a/src/PJ_crast.c b/src/PJ_crast.c
index 30f2e304..81182117 100644
--- a/src/PJ_crast.c
+++ b/src/PJ_crast.c
@@ -37,4 +37,3 @@ PJ *PROJECTION(crast) {
return P;
}
-int pj_crast_selftest (void) {return 10000;}
diff --git a/src/PJ_deformation.c b/src/PJ_deformation.c
index 62a24683..81dd602d 100644
--- a/src/PJ_deformation.c
+++ b/src/PJ_deformation.c
@@ -288,4 +288,3 @@ PJ *TRANSFORMATION(deformation,1) {
return P;
}
-int pj_deformation_selftest (void) {return 10000;}
diff --git a/src/PJ_denoy.c b/src/PJ_denoy.c
index aec78b40..d89a7e3e 100644
--- a/src/PJ_denoy.c
+++ b/src/PJ_denoy.c
@@ -29,4 +29,3 @@ PJ *PROJECTION(denoy) {
return P;
}
-int pj_denoy_selftest (void) {return 10000;}
diff --git a/src/PJ_eck1.c b/src/PJ_eck1.c
index 10fef421..4a9ac06b 100644
--- a/src/PJ_eck1.c
+++ b/src/PJ_eck1.c
@@ -39,4 +39,3 @@ PJ *PROJECTION(eck1) {
}
-int pj_eck1_selftest (void) {return 10000;}
diff --git a/src/PJ_eck2.c b/src/PJ_eck2.c
index f8adcc7a..b953b54f 100644
--- a/src/PJ_eck2.c
+++ b/src/PJ_eck2.c
@@ -53,4 +53,3 @@ PJ *PROJECTION(eck2) {
}
-int pj_eck2_selftest (void) {return 10000;}
diff --git a/src/PJ_eck3.c b/src/PJ_eck3.c
index 3e64e050..21353be2 100644
--- a/src/PJ_eck3.c
+++ b/src/PJ_eck3.c
@@ -106,8 +106,3 @@ PJ *PROJECTION(putp1) {
return setup(P);
}
-
-int pj_eck3_selftest (void) {return 10000;}
-int pj_kav7_selftest (void) {return 10000;}
-int pj_wag6_selftest (void) {return 10000;}
-int pj_putp1_selftest (void) {return 10000;}
diff --git a/src/PJ_eck4.c b/src/PJ_eck4.c
index 8c323656..c3e1b677 100644
--- a/src/PJ_eck4.c
+++ b/src/PJ_eck4.c
@@ -59,5 +59,3 @@ PJ *PROJECTION(eck4) {
return P;
}
-
-int pj_eck4_selftest (void) {return 10000;}
diff --git a/src/PJ_eck5.c b/src/PJ_eck5.c
index 69e83eda..34a258ee 100644
--- a/src/PJ_eck5.c
+++ b/src/PJ_eck5.c
@@ -36,4 +36,3 @@ PJ *PROJECTION(eck5) {
return P;
}
-int pj_eck5_selftest (void) {return 10000;}
diff --git a/src/PJ_eqc.c b/src/PJ_eqc.c
index 2b69788f..908147a2 100644
--- a/src/PJ_eqc.c
+++ b/src/PJ_eqc.c
@@ -49,4 +49,3 @@ PJ *PROJECTION(eqc) {
}
-int pj_eqc_selftest (void) {return 10000;}
diff --git a/src/PJ_eqdc.c b/src/PJ_eqdc.c
index 6e9d2c75..e1f8ea16 100644
--- a/src/PJ_eqdc.c
+++ b/src/PJ_eqdc.c
@@ -130,4 +130,3 @@ PJ *PROJECTION(eqdc) {
}
-int pj_eqdc_selftest (void) {return 10000;}
diff --git a/src/PJ_fahey.c b/src/PJ_fahey.c
index 4fcb7849..53606119 100644
--- a/src/PJ_fahey.c
+++ b/src/PJ_fahey.c
@@ -37,4 +37,3 @@ PJ *PROJECTION(fahey) {
return P;
}
-int pj_fahey_selftest (void) {return 10000;}
diff --git a/src/PJ_fouc_s.c b/src/PJ_fouc_s.c
index c581e690..b8ae4a0c 100644
--- a/src/PJ_fouc_s.c
+++ b/src/PJ_fouc_s.c
@@ -67,4 +67,3 @@ PJ *PROJECTION(fouc_s) {
}
-int pj_fouc_s_selftest (void) {return 10000;}
diff --git a/src/PJ_gall.c b/src/PJ_gall.c
index 8a003073..cb213e2d 100644
--- a/src/PJ_gall.c
+++ b/src/PJ_gall.c
@@ -41,4 +41,3 @@ PJ *PROJECTION(gall) {
}
-int pj_gall_selftest (void) {return 10000;}
diff --git a/src/PJ_geos.c b/src/PJ_geos.c
index 7d527409..a787db23 100644
--- a/src/PJ_geos.c
+++ b/src/PJ_geos.c
@@ -234,4 +234,3 @@ PJ *PROJECTION(geos) {
}
-int pj_geos_selftest (void) {return 10000;}
diff --git a/src/PJ_gins8.c b/src/PJ_gins8.c
index 26db4f31..ae0d4dee 100644
--- a/src/PJ_gins8.c
+++ b/src/PJ_gins8.c
@@ -31,4 +31,3 @@ PJ *PROJECTION(gins8) {
}
-int pj_gins8_selftest (void) {return 10000;}
diff --git a/src/PJ_gn_sinu.c b/src/PJ_gn_sinu.c
index bfe26b53..585d43ca 100644
--- a/src/PJ_gn_sinu.c
+++ b/src/PJ_gn_sinu.c
@@ -183,8 +183,3 @@ PJ *PROJECTION(gn_sinu) {
return P;
}
-
-int pj_sinu_selftest (void) {return 10000;}
-int pj_eck6_selftest (void) {return 10000;}
-int pj_mbtfps_selftest (void) {return 10000;}
-int pj_gn_sinu_selftest (void) {return 10000;}
diff --git a/src/PJ_gnom.c b/src/PJ_gnom.c
index e5822f4f..12774569 100644
--- a/src/PJ_gnom.c
+++ b/src/PJ_gnom.c
@@ -138,5 +138,3 @@ PJ *PROJECTION(gnom) {
return P;
}
-
-int pj_gnom_selftest (void) {return 10000;}
diff --git a/src/PJ_goode.c b/src/PJ_goode.c
index 3c5d172d..34312b3b 100644
--- a/src/PJ_goode.c
+++ b/src/PJ_goode.c
@@ -79,4 +79,3 @@ PJ *PROJECTION(goode) {
}
-int pj_goode_selftest (void) {return 10000;}
diff --git a/src/PJ_gstmerc.c b/src/PJ_gstmerc.c
index efb44b88..81ec4e17 100644
--- a/src/PJ_gstmerc.c
+++ b/src/PJ_gstmerc.c
@@ -68,5 +68,3 @@ PJ *PROJECTION(gstmerc) {
return P;
}
-
-int pj_gstmerc_selftest (void) {return 10000;}
diff --git a/src/PJ_hammer.c b/src/PJ_hammer.c
index 443ce247..4cdaba89 100644
--- a/src/PJ_hammer.c
+++ b/src/PJ_hammer.c
@@ -71,5 +71,3 @@ PJ *PROJECTION(hammer) {
return P;
}
-
-int pj_hammer_selftest (void) {return 10000;}
diff --git a/src/PJ_hatano.c b/src/PJ_hatano.c
index ea4bacf8..79f46a7d 100644
--- a/src/PJ_hatano.c
+++ b/src/PJ_hatano.c
@@ -79,4 +79,3 @@ PJ *PROJECTION(hatano) {
return P;
}
-int pj_hatano_selftest (void) {return 10000;}
diff --git a/src/PJ_healpix.c b/src/PJ_healpix.c
index 2d2af805..d8e1a921 100644
--- a/src/PJ_healpix.c
+++ b/src/PJ_healpix.c
@@ -668,6 +668,3 @@ PJ *PROJECTION(rhealpix) {
return P;
}
-
-int pj_healpix_selftest (void) {return 10000;}
-int pj_rhealpix_selftest (void) {return 10000;}
diff --git a/src/PJ_helmert.c b/src/PJ_helmert.c
index 39746aaa..478a2c82 100644
--- a/src/PJ_helmert.c
+++ b/src/PJ_helmert.c
@@ -583,145 +583,3 @@ PJ *TRANSFORMATION(helmert, 0) {
return P;
}
-
-
-#ifndef PJ_SELFTEST
-
-int pj_helmert_selftest (void) {return 0;}
-
-#else
-
-
-static int test (char *args, PJ_TRIPLET in, PJ_TRIPLET expect, double tol) {
- PJ_TRIPLET out;
- PJ *P = pj_init_plus (args);
-
- if (0==P)
- return 5;
-
- out.xyz = pj_fwd3d (in.lpz, P);
- if (proj_xyz_dist (out.xyz, expect.xyz) > tol) {
- proj_log_error(P, "Tolerance of forward calculation not met");
- proj_log_error(P, " Expect: %10.10f, %10.10f, %10.10f", expect.xyz.x, expect.xyz.y, expect.xyz.z);
- proj_log_error(P, " Out: %10.10f, %10.10f, %10.10f", out.xyz.x, out.xyz.y, out.xyz.z);
- proj_log_level(NULL, 0);
- proj_destroy (P);
- return 1;
- }
-
- out.lpz = pj_inv3d (out.xyz, P);
- if (proj_xyz_dist (out.xyz, in.xyz) > tol) {
- proj_log_error(P, "Tolerance of inverse calculation not met");
- proj_log_error(P, " In: %10.10f, %10.10f, %10.10f", in.xyz.x, in.xyz.y, in.xyz.z);
- proj_log_error(P, " Out: %10.10f, %10.10f, %10.10f", out.xyz.x, out.xyz.y, out.xyz.z);
- proj_log_level(NULL, 0);
- proj_destroy (P);
- return 2;
- }
-
- proj_destroy (P);
- return 0;
-}
-
-
-
-int pj_helmert_selftest (void) {
- int ret;
-
- /* This example is from
- Lotti Jivall:
- Simplified transformations from ITRF2008/IGS08 to ETRS89 for maritime applications */
- PJ_TRIPLET in1 = {{3565285.0000, 855949.0000, 5201383.0000}};
- PJ_TRIPLET expect1 = {{3565285.41342351, 855948.67986759, 5201382.72939791}};
- char args1[] = {
- " +proj=helmert +ellps=GRS80"
- " +x=0.67678 +y=0.65495 +z=-0.52827"
- " +rx=-0.022742 +ry=0.012667 +rz=0.022704 +s=-0.01070"
- /*" +rx=-22.742 +ry=12.667 +rz=22.704 +s=-0.01070" */
- };
-
-
- /* This example is a random point, transformed from ED50 to ETRS89 using KMStrans2 */
- PJ_TRIPLET in2 = {{3494994.3012, 1056601.9725, 5212382.1666}};
- PJ_TRIPLET expect2 = {{3494909.84026368, 1056506.78938633, 5212265.66699761}};
- char args2[] = {
- " +proj=helmert +ellps=GRS80"
- " +x=-81.0703 +y=-89.3603 +z=-115.7526"
- " +rx=-0.48488 +ry=-0.02436 +rz=-0.41321 +s=-0.540645"
- };
-
-
- /* This example is a coordinate from the geodetic observatory in Onsala,
- Sweden transformed from ITRF2000 @ 2017.0 to ITRF93 @ 2017.0.
- The test coordinate was transformed using GNSStrans.
- Transformation parameters published by ITRF:
- ftp://itrf.ensg.ign.fr/pub/itrf/ITRF.TP */
- PJ_TRIPLET in3 = {{3370658.378, 711877.314, 5349787.086}}; /* ITRF2000@2017.0 */
- PJ_TRIPLET expect3 = {{3370658.18890, 711877.42370, 5349787.12430}}; /* ITRF93@2017.0 */
- char args3[] = {
- " +proj=helmert +ellps=GRS80"
- " +x=0.0127 +y=0.0065 +z=-0.0209 +s=0.00195"
- " +rx=-0.00039 +ry=0.00080 +rz=-0.00114"
- " +dx=-0.0029 +dy=-0.0002 +dz=-0.0006 +ds=0.00001"
- " +drx=-0.00011 +dry=-0.00019 +drz=0.00007"
- " +epoch=1988.0 +tobs=2017.0 +transpose"
- };
-
- /* Test the 4D-capabilities of the proj.h API, especially that the rotation
- matrix is updated when necessary. Test coordinates from GNSStrans. */
- XYZ expect4a = {3370658.18890, 711877.42370, 5349787.12430};
- XYZ expect4b = {3370658.18087, 711877.42750, 5349787.12648};
- PJ_COORD in4 = {{3370658.378, 711877.314, 5349787.086, 2017.0}};
- PJ_COORD out;
-
- PJ *helmert = proj_create(
- 0,
- " +proj=helmert +ellps=GRS80"
- " +x=0.0127 +y=0.0065 +z=-0.0209 +s=0.00195"
- " +rx=-0.00039 +ry=0.00080 +rz=-0.00114"
- " +dx=-0.0029 +dy=-0.0002 +dz=-0.0006 +ds=0.00001"
- " +drx=-0.00011 +dry=-0.00019 +drz=0.00007"
- " +epoch=1988.0 +transpose"
- );
-
- /* This example is from "A mathematical relationship between NAD27 and NAD83 (91)
- State Plane coordinates in Southeastern Wisconsin":
-
- http://www.sewrpc.org/SEWRPCFiles/Publications/TechRep/tr-034-Mathematical-Relationship-Between-NAD27-and-NAD83-91-State-Plane-Coordinates-Southeastern-Wisconsin.pdf
-
- The test data is taken from p. 29. Here we are using point 203 and converting it
- from NAD27 (ft) -> NAD83 (m). The paper reports a difference of 0.0014 m from measured
- to computed coordinates, hence the test tolerance is set accordingly. */
- PJ_TRIPLET in5 = {{2546506.957, 542256.609, 0}};
- PJ_TRIPLET expect5 = {{766563.675, 165282.277, 0}};
- char args5[] = " +proj=helmert +ellps=GRS80 +x=-9597.3572 +y=.6112 +s=0.304794780637 +theta=-1.244048";
-
- /* Run tests 1-3 & 5 */
- ret = test (args1, in1, expect1, 1e-4); if (ret) return ret;
- ret = test (args2, in2, expect2, 1e-4); if (ret) return ret + 10;
- ret = test (args3, in3, expect3, 1e-4); if (ret) return ret + 20;
- ret = test (args5, in5, expect5, 0.001); if (ret) return ret + 40;
-
- /* Run test 4 */
- out = proj_trans (helmert, PJ_FWD, in4);
- if (proj_xyz_dist (out.xyz, expect4a) > 1e-4) {
- proj_log_error(helmert, "Tolerance of test 4a not met!");
- proj_log_error(helmert, " In: %10.10f, %10.10f, %10.10f", in4.xyz.x, in4.xyz.y, in4.xyz.z);
- proj_log_error(helmert, " Out: %10.10f, %10.10f, %10.10f", out.xyz.x, out.xyz.y, out.xyz.z);
- return 31;
- }
-
- in4.xyzt.t = 2018.0;
- out = proj_trans (helmert, PJ_FWD, in4);
- if (proj_xyz_dist (out.xyz, expect4b) > 1e-4) {
- proj_log_error(helmert, "Tolerance of test 4b not met!");
- proj_log_error(helmert, " In: %10.10f, %10.10f, %10.10f", in4.xyz.x, in4.xyz.y, in4.xyz.z);
- proj_log_error(helmert, " Out: %10.10f, %10.10f, %10.10f", out.xyz.x, out.xyz.y, out.xyz.z);
- return 32;
- }
-
- proj_destroy(helmert);
- return 0;
-}
-
-#endif
diff --git a/src/PJ_hgridshift.c b/src/PJ_hgridshift.c
index d57af697..92275e51 100644
--- a/src/PJ_hgridshift.c
+++ b/src/PJ_hgridshift.c
@@ -73,53 +73,3 @@ PJ *TRANSFORMATION(hgridshift,0) {
return P;
}
-
-#ifndef PJ_SELFTEST
-/* selftest stub */
-int pj_hgridshift_selftest (void) {return 0;}
-#else
-int pj_hgridshift_selftest (void) {
- PJ *P;
- PJ_COORD expect, a, b;
- double dist;
-
- /* fail on purpose: +grids parameter is mandatory*/
- P = proj_create(PJ_DEFAULT_CTX, "+proj=hgridshift");
- if (0!=P) {
- proj_destroy (P);
- return 99;
- }
-
- /* fail on purpose: open non-existing grid */
- P = proj_create(PJ_DEFAULT_CTX, "+proj=hgridshift +grids=@nonexistinggrid.gsb,anothernonexistinggrid.gsb");
- if (0!=P) {
- proj_destroy (P);
- return 999;
- }
-
- /* Failure most likely means the grid is missing */
- P = proj_create(PJ_DEFAULT_CTX, "+proj=hgridshift +grids=nzgd2kgrid0005.gsb +ellps=GRS80");
- if (0==P)
- return 10;
-
- a = proj_coord (0,0,0,0);
- a.lpz.lam = PJ_TORAD(173);
- a.lpz.phi = PJ_TORAD(-45);
- b = a;
-
- dist = proj_roundtrip (P, PJ_FWD, 1, &b);
- if (dist > 0.00000001) {
- printf("dist: %f\n",dist);
- return 1;
- }
-
- expect.lpz.lam = PJ_TORAD(172.999892181021551);
- expect.lpz.phi = PJ_TORAD(-45.001620431954613);
- b = proj_trans(P, PJ_FWD, a);
- if (proj_xy_dist(expect.xy, b.xy) > 1e-4)
- return 2;
-
- proj_destroy(P);
- return 0;
-}
-#endif
diff --git a/src/PJ_horner.c b/src/PJ_horner.c
index 51c271ae..6f1450cd 100644
--- a/src/PJ_horner.c
+++ b/src/PJ_horner.c
@@ -486,86 +486,3 @@ PJ *PROJECTION(horner) {
return P;
}
-#ifndef PJ_SELFTEST
-/* selftest stub */
-int pj_horner_selftest (void) {return 0;}
-#else
-char tc32_utm32[] = {
- " +proj=horner"
- " +ellps=intl"
- " +range=500000"
- " +fwd_origin=877605.269066,6125810.306769"
- " +inv_origin=877605.760036,6125811.281773"
- " +deg=4"
- " +fwd_v=6.1258112678e+06,9.9999971567e-01,1.5372750011e-10,5.9300860915e-15,2.2609497633e-19,4.3188227445e-05,2.8225130416e-10,7.8740007114e-16,-1.7453997279e-19,1.6877465415e-10,-1.1234649773e-14,-1.7042333358e-18,-7.9303467953e-15,-5.2906832535e-19,3.9984284847e-19"
- " +fwd_u=8.7760574982e+05,9.9999752475e-01,2.8817299305e-10,5.5641310680e-15,-1.5544700949e-18,-4.1357045890e-05,4.2106213519e-11,2.8525551629e-14,-1.9107771273e-18,3.3615590093e-10,2.4380247154e-14,-2.0241230315e-18,1.2429019719e-15,5.3886155968e-19,-1.0167505000e-18"
- " +inv_v=6.1258103208e+06,1.0000002826e+00,-1.5372762184e-10,-5.9304261011e-15,-2.2612705361e-19,-4.3188331419e-05,-2.8225549995e-10,-7.8529116371e-16,1.7476576773e-19,-1.6875687989e-10,1.1236475299e-14,1.7042518057e-18,7.9300735257e-15,5.2881862699e-19,-3.9990736798e-19"
- " +inv_u=8.7760527928e+05,1.0000024735e+00,-2.8817540032e-10,-5.5627059451e-15,1.5543637570e-18,4.1357152105e-05,-4.2114813612e-11,-2.8523713454e-14,1.9109017837e-18,-3.3616407783e-10,-2.4382678126e-14,2.0245020199e-18,-1.2441377565e-15,-5.3885232238e-19,1.0167203661e-18"
-};
-
-
-char sb_utm32[] = {
- " +proj=horner"
- " +ellps=intl"
- " +range=500000"
- " +tolerance=0.0005"
- " +fwd_origin=4.94690026817276e+05,6.13342113183056e+06"
- " +inv_origin=6.19480258923588e+05,6.13258568148837e+06"
- " +deg=3"
- " +fwd_c=6.13258562111350e+06,6.19480105709997e+05,9.99378966275206e-01,-2.82153291753490e-02,-2.27089979140026e-10,-1.77019590701470e-09,1.08522286274070e-14,2.11430298751604e-15"
- " +inv_c=6.13342118787027e+06,4.94690181709311e+05,9.99824464710368e-01,2.82279070814774e-02,7.66123542220864e-11,1.78425334628927e-09,-1.05584823306400e-14,-3.32554258683744e-15"
-};
-
-int pj_horner_selftest (void) {
- PJ *P;
- PJ_COORD a, b, c;
- double dist;
-
- /* Real polynonia relating the technical coordinate system TC32 to "System 45 Bornholm" */
- P = proj_create (PJ_DEFAULT_CTX, tc32_utm32);
- if (0==P)
- return 10;
-
- a = b = proj_coord (0,0,0,0);
- a.uv.v = 6125305.4245;
- a.uv.u = 878354.8539;
- c = a;
-
- /* Check roundtrip precision for 1 iteration each way, starting in forward direction */
- dist = proj_roundtrip (P, PJ_FWD, 1, &c);
- if (dist > 0.01)
- return 1;
-
- /* The complex polynomial transformation between the "System Storebaelt" and utm32/ed50 */
- P = proj_create (PJ_DEFAULT_CTX, sb_utm32);
- if (0==P)
- return 11;
-
- /* Test value: utm32_ed50(620000, 6130000) = sb_ed50(495136.8544, 6130821.2945) */
- a = b = c = proj_coord (0,0,0,0);
- a.uv.v = 6130821.2945;
- a.uv.u = 495136.8544;
- c.uv.v = 6130000.0000;
- c.uv.u = 620000.0000;
-
- /* Forward projection */
- b = proj_trans (P, PJ_FWD, a);
- dist = proj_xy_dist (b.xy, c.xy);
- if (dist > 0.001)
- return 2;
-
- /* Inverse projection */
- b = proj_trans (P, PJ_INV, c);
- dist = proj_xy_dist (b.xy, a.xy);
- if (dist > 0.001)
- return 3;
-
- /* Check roundtrip precision for 1 iteration each way */
- dist = proj_roundtrip (P, PJ_FWD, 1, &a);
- if (dist > 0.01)
- return 4;
-
- proj_destroy(P);
- return 0;
-}
-#endif
diff --git a/src/PJ_igh.c b/src/PJ_igh.c
index 01cfa246..d1d684e7 100644
--- a/src/PJ_igh.c
+++ b/src/PJ_igh.c
@@ -222,4 +222,3 @@ PJ *PROJECTION(igh) {
}
-int pj_igh_selftest (void) {return 10000;}
diff --git a/src/PJ_imw_p.c b/src/PJ_imw_p.c
index f0c88efb..9ebb8b4a 100644
--- a/src/PJ_imw_p.c
+++ b/src/PJ_imw_p.c
@@ -211,5 +211,3 @@ PJ *PROJECTION(imw_p) {
return P;
}
-
-int pj_imw_p_selftest (void) {return 10000;}
diff --git a/src/PJ_isea.c b/src/PJ_isea.c
index 72c34744..bf006a62 100644
--- a/src/PJ_isea.c
+++ b/src/PJ_isea.c
@@ -1147,5 +1147,3 @@ PJ *PROJECTION(isea) {
return P;
}
-
-int pj_isea_selftest (void) {return 10000;}
diff --git a/src/PJ_krovak.c b/src/PJ_krovak.c
index 929a2a6d..ef00d715 100644
--- a/src/PJ_krovak.c
+++ b/src/PJ_krovak.c
@@ -219,5 +219,3 @@ PJ *PROJECTION(krovak) {
return P;
}
-
-int pj_krovak_selftest (void) {return 10000;}
diff --git a/src/PJ_labrd.c b/src/PJ_labrd.c
index 7db03249..16c45a0d 100644
--- a/src/PJ_labrd.c
+++ b/src/PJ_labrd.c
@@ -128,5 +128,3 @@ PJ *PROJECTION(labrd) {
return P;
}
-
-int pj_labrd_selftest (void) {return 10000;}
diff --git a/src/PJ_laea.c b/src/PJ_laea.c
index 5cf5f5cd..82a341d8 100644
--- a/src/PJ_laea.c
+++ b/src/PJ_laea.c
@@ -295,5 +295,3 @@ PJ *PROJECTION(laea) {
return P;
}
-
-int pj_laea_selftest (void) {return 10000;}
diff --git a/src/PJ_lagrng.c b/src/PJ_lagrng.c
index 584f9a7a..b4744ed5 100644
--- a/src/PJ_lagrng.c
+++ b/src/PJ_lagrng.c
@@ -61,5 +61,3 @@ PJ *PROJECTION(lagrng) {
return P;
}
-
-int pj_lagrng_selftest (void) {return 10000;}
diff --git a/src/PJ_larr.c b/src/PJ_larr.c
index dc791ba0..a8d1af56 100644
--- a/src/PJ_larr.c
+++ b/src/PJ_larr.c
@@ -24,5 +24,3 @@ PJ *PROJECTION(larr) {
return P;
}
-
-int pj_larr_selftest (void) {return 10000;}
diff --git a/src/PJ_lask.c b/src/PJ_lask.c
index 998b3bbe..0bb3812c 100644
--- a/src/PJ_lask.c
+++ b/src/PJ_lask.c
@@ -37,4 +37,3 @@ PJ *PROJECTION(lask) {
return P;
}
-int pj_lask_selftest (void) {return 10000;}
diff --git a/src/PJ_latlong.c b/src/PJ_latlong.c
index 612bef78..5919023a 100644
--- a/src/PJ_latlong.c
+++ b/src/PJ_latlong.c
@@ -123,15 +123,3 @@ PJ *PROJECTION(lonlat) {
return P;
}
-
-/* Bogus self-test functions. Self-tests can't be implemented the usual way for
- * these "projections" since they can't be used directly from proj.
- * We still need them though, as all projections are automatically added to
- * the list of self-test functions.
- *
- * The code should be covered by the tests in nad/.
- * */
-int pj_latlong_selftest (void) {return 10000;}
-int pj_longlat_selftest (void) {return 10000;}
-int pj_latlon_selftest (void) {return 10000;}
-int pj_lonlat_selftest (void) {return 10000;}
diff --git a/src/PJ_lcc.c b/src/PJ_lcc.c
index 4a392690..bc02667a 100644
--- a/src/PJ_lcc.c
+++ b/src/PJ_lcc.c
@@ -144,5 +144,3 @@ PJ *PROJECTION(lcc) {
return P;
}
-
-int pj_lcc_selftest (void) {return 10000;}
diff --git a/src/PJ_lcca.c b/src/PJ_lcca.c
index 6aa33c4f..61b2ed02 100644
--- a/src/PJ_lcca.c
+++ b/src/PJ_lcca.c
@@ -158,6 +158,3 @@ PJ *PROJECTION(lcca) {
return P;
}
-
-
-int pj_lcca_selftest (void) {return 10000;}
diff --git a/src/PJ_loxim.c b/src/PJ_loxim.c
index 2b3e922d..bb870713 100644
--- a/src/PJ_loxim.c
+++ b/src/PJ_loxim.c
@@ -71,5 +71,3 @@ PJ *PROJECTION(loxim) {
return P;
}
-
-int pj_loxim_selftest (void) {return 10000;}
diff --git a/src/PJ_lsat.c b/src/PJ_lsat.c
index b3c36fe8..65b20fe4 100644
--- a/src/PJ_lsat.c
+++ b/src/PJ_lsat.c
@@ -208,5 +208,3 @@ PJ *PROJECTION(lsat) {
return P;
}
-
-int pj_lsat_selftest (void) {return 10000;}
diff --git a/src/PJ_mbt_fps.c b/src/PJ_mbt_fps.c
index 6499249c..2fccf3aa 100644
--- a/src/PJ_mbt_fps.c
+++ b/src/PJ_mbt_fps.c
@@ -53,4 +53,3 @@ PJ *PROJECTION(mbt_fps) {
return P;
}
-int pj_mbt_fps_selftest (void) {return 10000;}
diff --git a/src/PJ_mbtfpp.c b/src/PJ_mbtfpp.c
index 61254859..3bf2fa94 100644
--- a/src/PJ_mbtfpp.c
+++ b/src/PJ_mbtfpp.c
@@ -61,4 +61,3 @@ PJ *PROJECTION(mbtfpp) {
return P;
}
-int pj_mbtfpp_selftest (void) {return 10000;}
diff --git a/src/PJ_mbtfpq.c b/src/PJ_mbtfpq.c
index a3743b59..4a0d48df 100644
--- a/src/PJ_mbtfpq.c
+++ b/src/PJ_mbtfpq.c
@@ -70,4 +70,3 @@ PJ *PROJECTION(mbtfpq) {
return P;
}
-int pj_mbtfpq_selftest (void) {return 10000;}
diff --git a/src/PJ_merc.c b/src/PJ_merc.c
index 994d540f..5e0827b7 100644
--- a/src/PJ_merc.c
+++ b/src/PJ_merc.c
@@ -76,5 +76,3 @@ PJ *PROJECTION(merc) {
return P;
}
-
-int pj_merc_selftest (void) {return 10000;}
diff --git a/src/PJ_mill.c b/src/PJ_mill.c
index c491d79d..fdb0b2ad 100644
--- a/src/PJ_mill.c
+++ b/src/PJ_mill.c
@@ -33,5 +33,3 @@ PJ *PROJECTION(mill) {
return P;
}
-
-int pj_mill_selftest (void) {return 10000;}
diff --git a/src/PJ_misrsom.c b/src/PJ_misrsom.c
index 77717f03..d23f5fa8 100644
--- a/src/PJ_misrsom.c
+++ b/src/PJ_misrsom.c
@@ -215,5 +215,3 @@ PJ *PROJECTION(misrsom) {
return P;
}
-
-int pj_misrsom_selftest (void) {return 10000;}
diff --git a/src/PJ_mod_ster.c b/src/PJ_mod_ster.c
index ca81a43f..c8e4c6b8 100644
--- a/src/PJ_mod_ster.c
+++ b/src/PJ_mod_ster.c
@@ -277,9 +277,3 @@ PJ *PROJECTION(gs50) {
return setup(P);
}
-
-int pj_mil_os_selftest (void) {return 10000;}
-int pj_lee_os_selftest (void) {return 10000;}
-int pj_gs48_selftest (void) {return 10000;}
-int pj_alsk_selftest (void) {return 10000;}
-int pj_gs50_selftest (void) {return 10000;}
diff --git a/src/PJ_moll.c b/src/PJ_moll.c
index 80dd70d0..66e6315a 100644
--- a/src/PJ_moll.c
+++ b/src/PJ_moll.c
@@ -106,6 +106,3 @@ PJ *PROJECTION(wag5) {
return P;
}
-int pj_moll_selftest (void) {return 10000;}
-int pj_wag4_selftest (void) {return 10000;}
-int pj_wag5_selftest (void) {return 10000;}
diff --git a/src/PJ_molodensky.c b/src/PJ_molodensky.c
index 73d0e5c2..1b0eb3a1 100644
--- a/src/PJ_molodensky.c
+++ b/src/PJ_molodensky.c
@@ -312,83 +312,3 @@ PJ *TRANSFORMATION(molodensky,1) {
return P;
}
-
-#ifndef PJ_SELFTEST
-int pj_molodensky_selftest (void) {return 0;}
-#else
-int pj_molodensky_selftest (void) {
-
- PJ_COORD in, ni, res, exp;
- PJ *P;
-
- /* Test the abridged Molodensky first. Example from appendix 3 of Deakin (2004). */
- P = proj_create(PJ_DEFAULT_CTX,
- "+proj=molodensky +a=6378160 +rf=298.25 "
- "+da=-23 +df=-8.120449e-8 +dx=-134 +dy=-48 +dz=149 "
- "+abridged "
- );
- if (0==P)
- return 10;
-
- in.lpz.lam = PJ_TORAD(144.9667);
- in.lpz.phi = PJ_TORAD(-37.8);
- in.lpz.z = 50.0;
-
- exp.lpz.lam = PJ_TORAD(144.968);
- exp.lpz.phi = PJ_TORAD(-37.79848);
- exp.lpz.z = 46.378;
-
- res = proj_trans(P, PJ_FWD, in);
-
- if (proj_lp_dist(P, res.lp, exp.lp) > 2 ) { /* we don't expect much accurecy here... */
- proj_destroy(P);
- return 11;
- }
-
- /* let's try a roundtrip */
- ni = in;
- if (proj_roundtrip(P, PJ_FWD, 100, &ni) > 1) {
- proj_destroy(P);
- return 12;
- }
-
- if (res.lpz.z - exp.lpz.z > 1e-3) {
- proj_destroy(P);
- return 13;
- }
-
- proj_destroy(P);
-
- /* Test the abridged Molodensky first. Example from appendix 3 of Deaking (2004). */
-
- P = proj_create(PJ_DEFAULT_CTX,
- "+proj=molodensky +a=6378160 +rf=298.25 "
- "+da=-23 +df=-8.120449e-8 +dx=-134 +dy=-48 +dz=149 "
- );
- if (0==P)
- return 20;
-
- res = proj_trans(P, PJ_FWD, in);
-
- if (proj_lp_dist(P, res.lp, exp.lp) > 2 ) { /* we don't expect much accurecy here... */
- proj_destroy(P);
- return 21;
- }
-
- /* let's try a roundtrip */
- ni = in;
- if (proj_roundtrip(P, PJ_FWD, 100, &ni) > 1) {
- proj_destroy(P);
- return 22;
- }
-
- if (res.lpz.z - exp.lpz.z > 1e-3) {
- proj_destroy(P);
- return 23;
- }
-
- proj_destroy(P);
- return 0;
-}
-
-#endif
diff --git a/src/PJ_natearth.c b/src/PJ_natearth.c
index 2395ebb5..10abb23c 100644
--- a/src/PJ_natearth.c
+++ b/src/PJ_natearth.c
@@ -96,4 +96,3 @@ PJ *PROJECTION(natearth) {
return P;
}
-int pj_natearth_selftest (void) {return 10000;}
diff --git a/src/PJ_natearth2.c b/src/PJ_natearth2.c
index 162fd768..dbdc8fed 100644
--- a/src/PJ_natearth2.c
+++ b/src/PJ_natearth2.c
@@ -93,4 +93,3 @@ PJ *PROJECTION(natearth2) {
return P;
}
-int pj_natearth2_selftest (void) {return 10000;}
diff --git a/src/PJ_nell.c b/src/PJ_nell.c
index c4d65b88..51f9f99a 100644
--- a/src/PJ_nell.c
+++ b/src/PJ_nell.c
@@ -47,4 +47,3 @@ PJ *PROJECTION(nell) {
return P;
}
-int pj_nell_selftest (void) {return 10000;}
diff --git a/src/PJ_nell_h.c b/src/PJ_nell_h.c
index ebc8be90..24957786 100644
--- a/src/PJ_nell_h.c
+++ b/src/PJ_nell_h.c
@@ -49,5 +49,3 @@ PJ *PROJECTION(nell_h) {
return P;
}
-
-int pj_nell_h_selftest (void) {return 10000;}
diff --git a/src/PJ_nocol.c b/src/PJ_nocol.c
index aed5c382..13688a9f 100644
--- a/src/PJ_nocol.c
+++ b/src/PJ_nocol.c
@@ -50,4 +50,3 @@ PJ *PROJECTION(nicol) {
return P;
}
-int pj_nicol_selftest (void) {return 10000;}
diff --git a/src/PJ_nsper.c b/src/PJ_nsper.c
index b83b807b..0b3a1d1b 100644
--- a/src/PJ_nsper.c
+++ b/src/PJ_nsper.c
@@ -195,50 +195,3 @@ PJ *PROJECTION(tpers) {
return setup(P);
}
-
-#ifndef PJ_SELFTEST
-int pj_nsper_selftest (void) {return 0;}
-#else
-
-int pj_nsper_selftest (void) {
- double tolerance_lp = 1e-10;
- double tolerance_xy = 1e-7;
-
- char s_args[] = {"+proj=nsper +a=6400000 +h=1000000"};
-
- LP fwd_in[] = {
- { 2, 1},
- { 2,-1},
- {-2, 1},
- {-2,-1}
- };
-
- XY s_fwd_expect[] = {
- { 222239.816114099842, 111153.763991924759},
- { 222239.816114099842, -111153.763991924759},
- {-222239.816114099842, 111153.763991924759},
- {-222239.816114099842, -111153.763991924759},
- };
-
- XY inv_in[] = {
- { 200, 100},
- { 200,-100},
- {-200, 100},
- {-200,-100}
- };
-
- LP s_inv_expect[] = {
- { 0.00179049311728792437, 0.000895246558425396135},
- { 0.00179049311728792437, -0.000895246558425396135},
- {-0.00179049311728792437, 0.000895246558425396135},
- {-0.00179049311728792437, -0.000895246558425396135},
- };
-
- return pj_generic_selftest (0, s_args, tolerance_xy, tolerance_lp, 4, 4, fwd_in, 0, s_fwd_expect, inv_in, 0, s_inv_expect);
-}
-
-
-#endif
-
-
-int pj_tpers_selftest (void) {return 10000;}
diff --git a/src/PJ_nzmg.c b/src/PJ_nzmg.c
index 04128cfb..2d65a6e1 100644
--- a/src/PJ_nzmg.c
+++ b/src/PJ_nzmg.c
@@ -118,5 +118,3 @@ PJ *PROJECTION(nzmg) {
return P;
}
-
-int pj_nzmg_selftest (void) {return 10000;}
diff --git a/src/PJ_ob_tran.c b/src/PJ_ob_tran.c
index 3add8b29..4ce4bd4d 100644
--- a/src/PJ_ob_tran.c
+++ b/src/PJ_ob_tran.c
@@ -238,40 +238,3 @@ PJ *PROJECTION(ob_tran) {
return P;
}
-#ifndef PJ_SELFTEST
-int pj_ob_tran_selftest (void) {return 0;}
-#else
-
-int pj_ob_tran_selftest (void) {
- double d;
- PJ *P;
- PJ_COORD a, b;
-
- /* -- Tests from nad/testvarious -------------------------------------------- */
- P = proj_create (0, "+proj=ob_tran +o_proj=moll +R=6378137.0 +o_lon_p=0 +o_lat_p=0 +lon_0=180");
- if (0==P)
- return 1;
-
- a = proj_coord (300000, 400000, 0, 0);
- b.lpz.lam = -proj_torad (42 + (45 + 22.377/60)/60);
- b.lpz.phi = proj_torad (85 + (35 + 28.083/60)/60);
- a = proj_trans (P, -1, a);
- d = proj_lp_dist (P, a.lp, b.lp);
- if (d > 1e-3)
- return 2;
-
- a = proj_coord (proj_torad(10), proj_torad(20), 0, 0);
- b = proj_coord (-1384841.18787, 7581707.88240, 0, 0);
- a = proj_trans (P, 1, a);
- d = proj_xy_dist (a.xy, b.xy);
- if (d > 1e-3)
- return 3;
-
- proj_destroy (P);
- /* -------------------------------------------------------------------------- */
-
-
- return 0;
-}
-
-#endif \ No newline at end of file
diff --git a/src/PJ_ocea.c b/src/PJ_ocea.c
index b4b6d68c..33760180 100644
--- a/src/PJ_ocea.c
+++ b/src/PJ_ocea.c
@@ -96,5 +96,3 @@ PJ *PROJECTION(ocea) {
return P;
}
-
-int pj_ocea_selftest (void) {return 10000;}
diff --git a/src/PJ_oea.c b/src/PJ_oea.c
index aeef87c0..58ea7e93 100644
--- a/src/PJ_oea.c
+++ b/src/PJ_oea.c
@@ -82,5 +82,3 @@ PJ *PROJECTION(oea) {
return P;
}
-
-int pj_oea_selftest (void) {return 10000;}
diff --git a/src/PJ_omerc.c b/src/PJ_omerc.c
index b29033eb..22f0daca 100644
--- a/src/PJ_omerc.c
+++ b/src/PJ_omerc.c
@@ -223,5 +223,3 @@ PJ *PROJECTION(omerc) {
return P;
}
-
-int pj_omerc_selftest (void) {return 10000;}
diff --git a/src/PJ_ortho.c b/src/PJ_ortho.c
index a497b160..4da8247f 100644
--- a/src/PJ_ortho.c
+++ b/src/PJ_ortho.c
@@ -130,5 +130,3 @@ PJ *PROJECTION(ortho) {
return P;
}
-
-int pj_ortho_selftest (void) {return 10000;}
diff --git a/src/PJ_patterson.c b/src/PJ_patterson.c
index 9f9e3e39..0a1113ac 100644
--- a/src/PJ_patterson.c
+++ b/src/PJ_patterson.c
@@ -113,5 +113,3 @@ PJ *PROJECTION(patterson) {
return P;
}
-
-int pj_patterson_selftest (void) {return 10000;}
diff --git a/src/PJ_pipeline.c b/src/PJ_pipeline.c
index 0729b1da..e1568423 100644
--- a/src/PJ_pipeline.c
+++ b/src/PJ_pipeline.c
@@ -444,127 +444,3 @@ PJ *OPERATION(pipeline,0) {
return P;
}
-#ifndef PJ_SELFTEST
-/* selftest stub */
-int pj_pipeline_selftest (void) {return 0;}
-#else
-
-int pj_pipeline_selftest (void) {
- PJ *P;
- PJ_COORD a, b;
- XY cph_utm32 = {691875.63214, 6098907.82501};
- double dist;
-
- /* forward-reverse geo->utm->geo */
- P = proj_create (PJ_DEFAULT_CTX, "+proj=pipeline +zone=32 +step +proj=utm +ellps=GRS80 +step +proj=utm +ellps=GRS80 +inv");
- if (0==P)
- return 1000;
- /* zero initialize everything, then set (longitude, latitude, height) to (12, 55, 0) */
- a = b = proj_coord (0,0,0,0);
- a.lpz.lam = PJ_TORAD(12);
- a.lpz.phi = PJ_TORAD(55);
- a.lpz.z = 10;
-
- /* Forward projection */
- b = proj_trans (P, PJ_FWD, a);
- if (proj_lp_dist (P, a.lp, b.lp) > 1e-4)
- return 1001;
-
- /* Inverse projection (still same result: pipeline is symmetrical) */
- a = proj_trans (P, PJ_INV, b);
- if (proj_lp_dist (P, a.lp, b.lp) > 1e-4)
- return 1002;
-
- proj_destroy (P);
-
- /* And now the back-to-back situation utm->geo->utm */
- P = proj_create (PJ_DEFAULT_CTX, "+proj=pipeline +zone=32 +step +proj=utm +ellps=GRS80 +inv +step +proj=utm +ellps=GRS80");
- if (0==P)
- return 2000;
-
- /* zero initialize everything, then set (easting, northing) to utm(12, 55) */
- a = b = proj_coord (0,0,0,0);
- a.xy = cph_utm32;
-
- /* Forward projection */
- b = proj_trans (P, PJ_FWD, a);
- if (proj_xy_dist (a.xy, b.xy) > 1e-4)
- return 2001;
-
- /* Inverse projection */
- a = proj_trans (P, PJ_INV, b);
- if (proj_xy_dist (a.xy, b.xy) > 1e-4)
- return 2001;
- if (proj_xyz_dist (a.xyz, b.xyz) > 1e-4)
- return 2002;
-
- proj_destroy (P);
-
-
- /* Finally testing a corner case: A rather pointless one-step pipeline geo->utm */
- P = proj_create (PJ_DEFAULT_CTX, "+proj=pipeline +zone=32 +step +proj=utm +ellps=GRS80 ");
- if (0==P)
- return 3000;
-
-
- a = b = proj_coord (0,0,0,0);
- a.lpz.lam = PJ_TORAD(12);
- a.lpz.phi = PJ_TORAD(55);
-
- /* Forward projection */
- b = proj_trans (P, PJ_FWD, a);
- if (proj_xy_dist (cph_utm32, b.xy) > 1e-4)
- return 3001;
-
- /* Inverse projection */
- b = proj_trans (P, PJ_INV, b);
- if (proj_lp_dist (P, a.lp, b.lp) > 1e-4)
- return 3002;
-
-
- /* Since we use pj_lp_dist to determine success above, we should also test that it works */
-
- /* Geodesic distance between two points with angular 2D coordinates */
- a.lp.lam = PJ_TORAD(12);
- a.lp.phi = PJ_TORAD(60);
- b.lp.lam = PJ_TORAD(12);
- b.lp.phi = PJ_TORAD(61);
- dist = proj_lp_dist (P, a.lp, b.lp);
- if (fabs (111420.727870234 - dist) > 1e-4)
- return 4001;
-
- a.lp.lam = PJ_TORAD(12);
- a.lp.phi = PJ_TORAD(0.);
- b.lp.lam = PJ_TORAD(12);
- b.lp.phi = PJ_TORAD(1.);
- dist = proj_lp_dist (P, a.lp, b.lp);
- if (fabs (110574.388554153 - dist) > 1e-4)
- return 4002;
-
- proj_destroy (P);
-
- /* test a pipeline with several +init steps */
- P = proj_create(
- 0,
- "+proj=pipeline "
- "+step +init=epsg:25832 +inv "
- "+step +init=epsg:25833 "
- "+step +init=epsg:25833 +inv "
- "+step +init=epsg:25832 "
- );
- if (0==P)
- return 5000;
-
- a.xy.x = 700000.0;
- a.xy.y = 6000000.0;
-
- b = proj_trans(P, PJ_FWD, a);
- dist = proj_xy_dist(a.xy, b.xy);
- if (dist > 1e-7)
- return 5001;
-
-
- proj_destroy (P);
- return 0;
-}
-#endif
diff --git a/src/PJ_poly.c b/src/PJ_poly.c
index d748be09..7a8fc44d 100644
--- a/src/PJ_poly.c
+++ b/src/PJ_poly.c
@@ -164,5 +164,3 @@ PJ *PROJECTION(poly) {
return P;
}
-
-int pj_poly_selftest (void) {return 10000;}
diff --git a/src/PJ_putp2.c b/src/PJ_putp2.c
index 59eca8a6..51cf263d 100644
--- a/src/PJ_putp2.c
+++ b/src/PJ_putp2.c
@@ -57,4 +57,3 @@ PJ *PROJECTION(putp2) {
return P;
}
-int pj_putp2_selftest (void) {return 10000;}
diff --git a/src/PJ_putp3.c b/src/PJ_putp3.c
index dfd152f8..acc777bc 100644
--- a/src/PJ_putp3.c
+++ b/src/PJ_putp3.c
@@ -63,5 +63,3 @@ PJ *PROJECTION(putp3p) {
return P;
}
-int pj_putp3_selftest (void) {return 10000;}
-int pj_putp3p_selftest (void) {return 10000;}
diff --git a/src/PJ_putp4p.c b/src/PJ_putp4p.c
index 576ffbf6..958f9681 100644
--- a/src/PJ_putp4p.c
+++ b/src/PJ_putp4p.c
@@ -70,6 +70,3 @@ PJ *PROJECTION(weren) {
return P;
}
-
-int pj_putp4p_selftest (void) {return 10000;}
-int pj_weren_selftest (void) {return 10000;}
diff --git a/src/PJ_putp5.c b/src/PJ_putp5.c
index 2a847fa7..14bfea23 100644
--- a/src/PJ_putp5.c
+++ b/src/PJ_putp5.c
@@ -69,5 +69,3 @@ PJ *PROJECTION(putp5p) {
return P;
}
-int pj_putp5_selftest (void) {return 10000;}
-int pj_putp5p_selftest (void) {return 10000;}
diff --git a/src/PJ_putp6.c b/src/PJ_putp6.c
index be86f805..8c4efa66 100644
--- a/src/PJ_putp6.c
+++ b/src/PJ_putp6.c
@@ -91,6 +91,3 @@ PJ *PROJECTION(putp6p) {
return P;
}
-
-int pj_putp6_selftest (void) {return 10000;}
-int pj_putp6p_selftest (void) {return 10000;}
diff --git a/src/PJ_qsc.c b/src/PJ_qsc.c
index c8079f9e..36dabeb9 100644
--- a/src/PJ_qsc.c
+++ b/src/PJ_qsc.c
@@ -398,5 +398,3 @@ PJ *PROJECTION(qsc) {
return P;
}
-
-int pj_qsc_selftest (void) {return 10000;}
diff --git a/src/PJ_robin.c b/src/PJ_robin.c
index a9bac6ec..7532ff71 100644
--- a/src/PJ_robin.c
+++ b/src/PJ_robin.c
@@ -154,4 +154,3 @@ PJ *PROJECTION(robin) {
}
-int pj_robin_selftest (void) {return 10000;}
diff --git a/src/PJ_rpoly.c b/src/PJ_rpoly.c
index 36e5a63e..d7241719 100644
--- a/src/PJ_rpoly.c
+++ b/src/PJ_rpoly.c
@@ -52,5 +52,3 @@ PJ *PROJECTION(rpoly) {
return P;
}
-
-int pj_rpoly_selftest (void) {return 10000;}
diff --git a/src/PJ_sch.c b/src/PJ_sch.c
index 4ea3404d..c404fc9a 100644
--- a/src/PJ_sch.c
+++ b/src/PJ_sch.c
@@ -226,7 +226,3 @@ PJ *PROJECTION(sch) {
return setup(P);
}
-/* Skipping sef-test since the test system is not capable of handling
- * 3D coordinate systems for the time being. Relying on tests in ../nad/
- */
-int pj_sch_selftest (void) {return 10000;}
diff --git a/src/PJ_sconics.c b/src/PJ_sconics.c
index 1e00a17e..93a2f2f4 100644
--- a/src/PJ_sconics.c
+++ b/src/PJ_sconics.c
@@ -214,11 +214,3 @@ PJ *PROJECTION(vitk1) {
return setup(P, VITK1);
}
-
-int pj_euler_selftest (void) {return 10000;}
-int pj_murd1_selftest (void) {return 10000;}
-int pj_murd2_selftest (void) {return 10000;}
-int pj_murd3_selftest (void) {return 10000;}
-int pj_pconic_selftest (void) {return 10000;}
-int pj_tissot_selftest (void) {return 10000;}
-int pj_vitk1_selftest (void) {return 10000;}
diff --git a/src/PJ_somerc.c b/src/PJ_somerc.c
index 69fb6d47..8222ca24 100644
--- a/src/PJ_somerc.c
+++ b/src/PJ_somerc.c
@@ -88,5 +88,3 @@ PJ *PROJECTION(somerc) {
return P;
}
-
-int pj_somerc_selftest (void) {return 10000;}
diff --git a/src/PJ_stere.c b/src/PJ_stere.c
index 82d83061..c01b86f0 100644
--- a/src/PJ_stere.c
+++ b/src/PJ_stere.c
@@ -313,6 +313,3 @@ PJ *PROJECTION(ups) {
return setup(P);
}
-
-int pj_stere_selftest (void) {return 10000;}
-int pj_ups_selftest (void) {return 10000;}
diff --git a/src/PJ_sterea.c b/src/PJ_sterea.c
index 8a73f453..38b26117 100644
--- a/src/PJ_sterea.c
+++ b/src/PJ_sterea.c
@@ -114,5 +114,3 @@ PJ *PROJECTION(sterea) {
return P;
}
-
-int pj_sterea_selftest (void) {return 10000;}
diff --git a/src/PJ_sts.c b/src/PJ_sts.c
index 0349e67b..d8866b66 100644
--- a/src/PJ_sts.c
+++ b/src/PJ_sts.c
@@ -103,9 +103,3 @@ PJ *PROJECTION(mbt_s) {
return setup(P, 1.48875, 1.36509, 0);
}
-
-
-int pj_fouc_selftest (void) {return 10000;}
-int pj_kav5_selftest (void) {return 10000;}
-int pj_qua_aut_selftest (void) {return 10000;}
-int pj_mbt_s_selftest (void) {return 10000;}
diff --git a/src/PJ_tcc.c b/src/PJ_tcc.c
index 37211fdd..c6600ae0 100644
--- a/src/PJ_tcc.c
+++ b/src/PJ_tcc.c
@@ -30,5 +30,3 @@ PJ *PROJECTION(tcc) {
return P;
}
-
-int pj_tcc_selftest (void) {return 10000;}
diff --git a/src/PJ_tcea.c b/src/PJ_tcea.c
index 76249827..415b42de 100644
--- a/src/PJ_tcea.c
+++ b/src/PJ_tcea.c
@@ -32,5 +32,3 @@ PJ *PROJECTION(tcea) {
return P;
}
-
-int pj_tcea_selftest (void) {return 10000;}
diff --git a/src/PJ_times.c b/src/PJ_times.c
index 696c9fd5..74b79393 100644
--- a/src/PJ_times.c
+++ b/src/PJ_times.c
@@ -75,5 +75,3 @@ PJ *PROJECTION(times) {
return P;
}
-
-int pj_times_selftest (void) {return 10000;}
diff --git a/src/PJ_tmerc.c b/src/PJ_tmerc.c
index 2aa189fd..77fb5826 100644
--- a/src/PJ_tmerc.c
+++ b/src/PJ_tmerc.c
@@ -204,5 +204,3 @@ PJ *PROJECTION(tmerc) {
return setup(P);
}
-
-int pj_tmerc_selftest (void) {return 10000;}
diff --git a/src/PJ_tpeqd.c b/src/PJ_tpeqd.c
index dd19da8c..eee5b3c3 100644
--- a/src/PJ_tpeqd.c
+++ b/src/PJ_tpeqd.c
@@ -104,5 +104,3 @@ PJ *PROJECTION(tpeqd) {
return P;
}
-
-int pj_tpeqd_selftest (void) {return 0;}
diff --git a/src/PJ_unitconvert.c b/src/PJ_unitconvert.c
index 3a70903c..523d8897 100644
--- a/src/PJ_unitconvert.c
+++ b/src/PJ_unitconvert.c
@@ -389,95 +389,3 @@ PJ *CONVERSION(unitconvert,0) {
return P;
}
-#ifndef PJ_SELFTEST
-
-int pj_unitconvert_selftest (void) {return 0;}
-
-#else
-
-static int test_time(char* args, double tol, double t_in, double t_exp) {
- PJ_COORD in, out;
- PJ *P = proj_create(PJ_DEFAULT_CTX, args);
- int ret = 0;
-
- if (P == 0)
- return 5;
-
- in.xyzt.t = t_in;
-
- out = proj_trans(P, PJ_FWD, in);
- if (fabs(out.xyzt.t - t_exp) > tol) {
- proj_log_error(P, "out: %10.10g, expect: %10.10g", out.xyzt.t, t_exp);
- ret = 1;
- }
- out = proj_trans(P, PJ_INV, out);
- if (fabs(out.xyzt.t - t_in) > tol) {
- proj_log_error(P, "out: %10.10g, expect: %10.10g", out.xyzt.t, t_in);
- ret = 2;
- }
- pj_free(P);
-
- proj_log_level(NULL, 0);
- return ret;
-}
-
-static int test_xyz(char* args, double tol, PJ_TRIPLET in, PJ_TRIPLET exp) {
- PJ_COORD out, obs_in;
- PJ *P = proj_create(PJ_DEFAULT_CTX, args);
- int ret = 0;
-
- if (P == 0)
- return 5;
-
- obs_in.xyz = in.xyz;
- out = proj_trans(P, PJ_FWD, obs_in);
- if (proj_xyz_dist(out.xyz, exp.xyz) > tol) {
- printf("exp: %10.10g, %10.10g, %10.10g\n", exp.xyz.x, exp.xyz.y, exp.xyz.z);
- printf("out: %10.10g, %10.10g, %10.10g\n", out.xyz.x, out.xyz.y, out.xyz.z);
- ret = 1;
- }
-
- out = proj_trans(P, PJ_INV, out);
- if (proj_xyz_dist(out.xyz, in.xyz) > tol) {
- printf("exp: %g, %g, %g\n", in.xyz.x, in.xyz.y, in.xyz.z);
- printf("out: %g, %g, %g\n", out.xyz.x, out.xyz.y, out.xyz.z);
- ret += 2;
- }
- proj_destroy(P);
- proj_log_level(NULL, 0);
- return ret;
-}
-
-
-int pj_unitconvert_selftest (void) {
- int ret = 0;
- char args1[] = "+proj=unitconvert +t_in=decimalyear +t_out=decimalyear";
- double in1 = 2004.25;
-
- char args2[] = "+proj=unitconvert +t_in=gps_week +t_out=gps_week";
- double in2 = 1782.0;
-
- char args3[] = "+proj=unitconvert +t_in=mjd +t_out=mjd";
- double in3 = 57390.0;
-
- char args4[] = "+proj=unitconvert +t_in=gps_week +t_out=decimalyear";
- double in4 = 1877.71428, exp4 = 2016.0;
-
- char args5[] = "+proj=unitconvert +xy_in=m +xy_out=dm +z_in=cm +z_out=mm";
- PJ_TRIPLET in5 = {{55.25, 23.23, 45.5}}, exp5 = {{552.5, 232.3, 455.0}};
-
- char args6[] = "+proj=unitconvert +xy_in=m +xy_out=m +z_in=m +z_out=m";
- PJ_TRIPLET in6 = {{12.3, 45.6, 7.89}};
-
- ret = test_time(args1, 1e-6, in1, in1); if (ret) return ret + 10;
- ret = test_time(args2, 1e-6, in2, in2); if (ret) return ret + 20;
- ret = test_time(args3, 1e-6, in3, in3); if (ret) return ret + 30;
- ret = test_time(args4, 1e-6, in4, exp4); if (ret) return ret + 40;
- ret = test_xyz (args5, 1e-10, in5, exp5); if (ret) return ret + 50;
- ret = test_xyz (args6, 1e-10, in6, in6); if (ret) return ret + 50;
-
- return 0;
-
-}
-
-#endif
diff --git a/src/PJ_urm5.c b/src/PJ_urm5.c
index e90cc9ee..9960f501 100644
--- a/src/PJ_urm5.c
+++ b/src/PJ_urm5.c
@@ -50,5 +50,3 @@ PJ *PROJECTION(urm5) {
return P;
}
-
-int pj_urm5_selftest (void) {return 10000;}
diff --git a/src/PJ_urmfps.c b/src/PJ_urmfps.c
index 04ee8296..19719a26 100644
--- a/src/PJ_urmfps.c
+++ b/src/PJ_urmfps.c
@@ -70,6 +70,3 @@ PJ *PROJECTION(wag1) {
return setup(P);
}
-
-int pj_urmfps_selftest (void) {return 10000;}
-int pj_wag1_selftest (void) {return 10000;}
diff --git a/src/PJ_vandg.c b/src/PJ_vandg.c
index 69c7e55c..b6b84bd0 100644
--- a/src/PJ_vandg.c
+++ b/src/PJ_vandg.c
@@ -105,5 +105,3 @@ PJ *PROJECTION(vandg) {
return P;
}
-
-int pj_vandg_selftest (void) {return 10000;}
diff --git a/src/PJ_vandg2.c b/src/PJ_vandg2.c
index b6b69183..81f28a74 100644
--- a/src/PJ_vandg2.c
+++ b/src/PJ_vandg2.c
@@ -70,6 +70,3 @@ PJ *PROJECTION(vandg3) {
return P;
}
-
-int pj_vandg2_selftest (void) {return 10000;}
-int pj_vandg3_selftest (void) {return 10000;}
diff --git a/src/PJ_vandg4.c b/src/PJ_vandg4.c
index de525810..afffe41f 100644
--- a/src/PJ_vandg4.c
+++ b/src/PJ_vandg4.c
@@ -51,5 +51,3 @@ PJ *PROJECTION(vandg4) {
return P;
}
-
-int pj_vandg4_selftest (void) {return 10000;}
diff --git a/src/PJ_vgridshift.c b/src/PJ_vgridshift.c
index 5ab4a162..97faa240 100644
--- a/src/PJ_vgridshift.c
+++ b/src/PJ_vgridshift.c
@@ -75,64 +75,3 @@ PJ *TRANSFORMATION(vgridshift,0) {
return P;
}
-
-#ifndef PJ_SELFTEST
-/* selftest stub */
-int pj_vgridshift_selftest (void) {return 0;}
-#else
-int pj_vgridshift_selftest (void) {
- PJ *P;
- PJ_COORD expect, a, b;
- double dist;
- int failures = 0;
-
- /* fail on purpose: +grids parameter is mandatory*/
- P = proj_create(PJ_DEFAULT_CTX, "+proj=vgridshift");
- if (0!=P) {
- proj_destroy (P);
- return 99;
- }
-
- /* fail on purpose: open non-existing grid */
- P = proj_create(PJ_DEFAULT_CTX, "+proj=vgridshift +grids=nonexistinggrid.gtx");
- if (0!=P) {
- proj_destroy (P);
- return 999;
- }
-
- /* Failure most likely means the grid is missing */
- P = proj_create(PJ_DEFAULT_CTX, "+proj=vgridshift +grids=egm96_15.gtx +ellps=GRS80");
- if (0==P)
- return 10;
-
- a = proj_coord(0,0,0,0);
- a.lpz.lam = PJ_TORAD(12.5);
- a.lpz.phi = PJ_TORAD(55.5);
- b = a;
- dist = proj_roundtrip (P, PJ_FWD, 1, &b);
- if (dist > 0.00000001)
- return 1;
-
- expect = a;
- /* Appears there is a difference between the egm96_15.gtx distributed by OSGeo4W, */
- /* and the one from http://download.osgeo.org/proj/vdatum/egm96_15/egm96_15.gtx */
- /* Was: expect.lpz.z = -36.021305084228515625; (download.osgeo.org) */
- /* Was: expect.lpz.z = -35.880001068115234000; (OSGeo4W) */
- /* This is annoying, but must be handled elsewhere. So for now, we check for both. */
- expect.lpz.z = -36.021305084228516;
- failures = 0;
- b = proj_trans(P, PJ_FWD, a);
- if (proj_xyz_dist(expect.xyz, b.xyz) > 1e-4) failures++;
- expect.lpz.z = -35.880001068115234000;
- if (proj_xyz_dist(expect.xyz, b.xyz) > 1e-4) failures++;
- /* manual roundtrip a->b, b<-b, b==a */
- b = proj_trans(P, PJ_INV, b);
- if (proj_xyz_dist(a.xyz, b.xyz) > 1e-9) failures++;
- if (failures > 1)
- return 2;
-
- proj_destroy (P);
-
- return 0;
-}
-#endif
diff --git a/src/PJ_wag2.c b/src/PJ_wag2.c
index 14d8f1c4..059494d7 100644
--- a/src/PJ_wag2.c
+++ b/src/PJ_wag2.c
@@ -32,5 +32,3 @@ PJ *PROJECTION(wag2) {
return P;
}
-
-int pj_wag2_selftest (void) {return 10000;}
diff --git a/src/PJ_wag3.c b/src/PJ_wag3.c
index 09a9291d..5db1e50f 100644
--- a/src/PJ_wag3.c
+++ b/src/PJ_wag3.c
@@ -44,5 +44,3 @@ PJ *PROJECTION(wag3) {
return P;
}
-
-int pj_wag3_selftest (void) {return 10000;}
diff --git a/src/PJ_wag7.c b/src/PJ_wag7.c
index 55c43534..a820b2cd 100644
--- a/src/PJ_wag7.c
+++ b/src/PJ_wag7.c
@@ -26,5 +26,3 @@ PJ *PROJECTION(wag7) {
return P;
}
-
-int pj_wag7_selftest (void) {return 10000;}
diff --git a/src/PJ_wink1.c b/src/PJ_wink1.c
index 670ff0f6..f64f97d2 100644
--- a/src/PJ_wink1.c
+++ b/src/PJ_wink1.c
@@ -40,5 +40,3 @@ PJ *PROJECTION(wink1) {
return P;
}
-
-int pj_wink1_selftest (void) {return 10000;}
diff --git a/src/PJ_wink2.c b/src/PJ_wink2.c
index 512354bb..d715074e 100644
--- a/src/PJ_wink2.c
+++ b/src/PJ_wink2.c
@@ -48,5 +48,3 @@ PJ *PROJECTION(wink2) {
return P;
}
-
-int pj_wink2_selftest (void) {return 10000;}
diff --git a/src/gie.c b/src/gie.c
index 09a33069..df4a0b07 100644
--- a/src/gie.c
+++ b/src/gie.c
@@ -435,8 +435,25 @@ static int operation (char *args) {
an operation is the general term describing something that can be
either a conversion or a transformation)
******************************************************************************/
+ int i, j, n;
T.op_id++;
+
+ /* compactify the args, so we can fit more info on a line in verbose mode */
+ n = (int) strlen (args);
+ for (i = j = 0; i < n; ) {
+ /* skip prefix whitespace */
+ while (isspace (args[i]))
+ i++;
+ /* move a whitespace delimited text string to the left, skipping over superfluous whitespace */
+ while ((0!=args[i]) && (!isspace (args[i])))
+ args[j++] = args[i++];
+ if (args[j+1]!=0)
+ args[j++] = ' ';
+ i++;
+ }
+ args[j++] = 0;
strcpy (&(T.operation[0]), args);
+
if (T.verbosity > 1) {
finish_previous_operation (args);
banner (args);
@@ -448,15 +465,67 @@ static int operation (char *args) {
direction ("forward");
tolerance ("0.5 mm");
+
if (T.P)
proj_destroy (T.P);
T.P = proj_create (0, args);
- if (0==T.P)
- errmsg(3, "Invalid operation definition!\n %s\n", args);
+
return 0;
}
+
+
+static int pj_unitconvert_selftest (void);
+static int pj_cart_selftest (void);
+static int pj_horner_selftest (void);
+/*****************************************************************************/
+static int builtins (char *args) {
+/*****************************************************************************
+ There are still a few tests that cannot be described using gie
+ primitives. Instead, they are implemented as builtins, and invoked
+ using the "builtins" command verb.
+******************************************************************************/
+ int i;
+ if (T.verbosity > 1) {
+ finish_previous_operation (args);
+ banner ("builtins: unitconvert, horner, cart");
+ }
+ T.op_ok = 0;
+ T.op_ko = 0;
+
+ i = pj_unitconvert_selftest ();
+ if (i!=0) {
+ printf ("pj_unitconvert_selftest fails with %d\n", i);
+ another_failure();
+ }
+ else
+ another_success ();
+
+
+ i = pj_cart_selftest ();
+ if (i!=0) {
+ printf ("pj_cart_selftest fails with %d\n", i);
+ another_failure();
+ }
+ else
+ another_success ();
+
+ i = pj_horner_selftest ();
+ if (i!=0) {
+ printf ("pj_horner_selftest fails with %d\n", i);
+ another_failure();
+ }
+ else
+ another_success ();
+
+ return 0;
+}
+
+
+
+
+
static PJ_COORD torad_coord (PJ_COORD a) {
PJ_COORD c = a;
c.lpz.lam = proj_torad (a.lpz.lam);
@@ -496,7 +565,7 @@ static int accept (char *args) {
******************************************************************************/
T.a = parse_coord (args);
if (T.verbosity > 3)
- printf ("# %s", args);
+ printf ("# %s\n", args);
return 0;
}
@@ -583,22 +652,58 @@ static int expect (char *args) {
******************************************************************************/
PJ_COORD ci, co, ce;
double d;
- if (0==T.P)
+ int expect_failure = 0;
+
+ if (0==strcmp (args, "failure"))
+ expect_failure = 1;
+
+ if (0==T.P && !expect_failure) {
+ errmsg(3, "Invalid operation definition!\n %s\n", args);
+ return another_failure ();
+ }
+
+
+ if (expect_failure) {
+ /* If we expect failure, and fail, then it's a success... */
+ if (0==T.P)
+ return another_success ();
+ /* We may still successfully fail even if the proj_create succeeded */
+ ci = proj_angular_input (T.P, T.dir)? torad_coord (T.a): T.a;
+ co = proj_trans (T.P, T.dir, ci);
+ if (co.xyz.x==HUGE_VAL)
+ return another_success ();
+ /* no - we didn't manage to purportedly fail */
return another_failure ();
+ }
+
+
+ if (T.verbosity > 3) {
+ puts (T.P->inverted? "INVERTED": "NOT INVERTED");
+ puts (T.dir== 1? "forward": "reverse");
+ puts (proj_angular_input (T.P, T.dir)? "angular in": "linear in");
+ puts (proj_angular_output (T.P, T.dir)? "angular out": "linear out");
+ }
T.e = parse_coord (args);
if (HUGE_VAL==T.e.v[0])
return expect_message_cannot_parse (args);
- /* expected angular values probably in degrees */
+ /* expected angular values, probably in degrees */
ce = proj_angular_output (T.P, T.dir)? torad_coord (T.e): T.e;
+ if (T.verbosity > 3)
+ printf ("EXPECTS %.4f %.4f %.4f %.4f\n", ce.v[0],ce.v[1],ce.v[2],ce.v[3]);
- /* input ("accepted") values also probably in degrees */
+ /* input ("accepted") values, also probably in degrees */
ci = proj_angular_input (T.P, T.dir)? torad_coord (T.a): T.a;
+ if (T.verbosity > 3)
+ printf ("ACCEPTS %.4f %.4f %.4f %.4f\n", ci.v[0],ci.v[1],ci.v[2],ci.v[3]);
+
/* angular output from proj_trans comes in radians */
co = proj_trans (T.P, T.dir, ci);
T.b = proj_angular_output (T.P, T.dir)? todeg_coord (co): co;
+ if (T.verbosity > 3)
+ printf ("GOT %.4f %.4f %.4f %.4f\n", ci.v[0],ci.v[1],ci.v[2],ci.v[3]);
/* but there are a few more possible input conventions... */
if (proj_angular_output (T.P, T.dir)) {
@@ -693,6 +798,8 @@ static int dispatch (char *cmnd, char *args) {
if (0==strcmp (cmnd, "direction")) return direction (args);
if (0==strcmp (cmnd, "TOLERANCE")) return tolerance (args);
if (0==strcmp (cmnd, "tolerance")) return tolerance (args);
+ if (0==strcmp (cmnd, "BUILTINS")) return builtins (args);
+ if (0==strcmp (cmnd, "builtins")) return builtins (args);
if (0==strcmp (cmnd, "ECHO")) return echo (args);
if (0==strcmp (cmnd, "echo")) return echo (args);
if (0==strcmp (cmnd, "END")) return finish_previous_operation (args), level++, 0;
@@ -806,3 +913,619 @@ static char *get_args (char *inp) {
return args;
return --args;
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+char tc32_utm32[] = {
+ " +proj=horner"
+ " +ellps=intl"
+ " +range=500000"
+ " +fwd_origin=877605.269066,6125810.306769"
+ " +inv_origin=877605.760036,6125811.281773"
+ " +deg=4"
+ " +fwd_v=6.1258112678e+06,9.9999971567e-01,1.5372750011e-10,5.9300860915e-15,2.2609497633e-19,4.3188227445e-05,2.8225130416e-10,7.8740007114e-16,-1.7453997279e-19,1.6877465415e-10,-1.1234649773e-14,-1.7042333358e-18,-7.9303467953e-15,-5.2906832535e-19,3.9984284847e-19"
+ " +fwd_u=8.7760574982e+05,9.9999752475e-01,2.8817299305e-10,5.5641310680e-15,-1.5544700949e-18,-4.1357045890e-05,4.2106213519e-11,2.8525551629e-14,-1.9107771273e-18,3.3615590093e-10,2.4380247154e-14,-2.0241230315e-18,1.2429019719e-15,5.3886155968e-19,-1.0167505000e-18"
+ " +inv_v=6.1258103208e+06,1.0000002826e+00,-1.5372762184e-10,-5.9304261011e-15,-2.2612705361e-19,-4.3188331419e-05,-2.8225549995e-10,-7.8529116371e-16,1.7476576773e-19,-1.6875687989e-10,1.1236475299e-14,1.7042518057e-18,7.9300735257e-15,5.2881862699e-19,-3.9990736798e-19"
+ " +inv_u=8.7760527928e+05,1.0000024735e+00,-2.8817540032e-10,-5.5627059451e-15,1.5543637570e-18,4.1357152105e-05,-4.2114813612e-11,-2.8523713454e-14,1.9109017837e-18,-3.3616407783e-10,-2.4382678126e-14,2.0245020199e-18,-1.2441377565e-15,-5.3885232238e-19,1.0167203661e-18"
+};
+
+
+char sb_utm32[] = {
+ " +proj=horner"
+ " +ellps=intl"
+ " +range=500000"
+ " +tolerance=0.0005"
+ " +fwd_origin=4.94690026817276e+05,6.13342113183056e+06"
+ " +inv_origin=6.19480258923588e+05,6.13258568148837e+06"
+ " +deg=3"
+ " +fwd_c=6.13258562111350e+06,6.19480105709997e+05,9.99378966275206e-01,-2.82153291753490e-02,-2.27089979140026e-10,-1.77019590701470e-09,1.08522286274070e-14,2.11430298751604e-15"
+ " +inv_c=6.13342118787027e+06,4.94690181709311e+05,9.99824464710368e-01,2.82279070814774e-02,7.66123542220864e-11,1.78425334628927e-09,-1.05584823306400e-14,-3.32554258683744e-15"
+};
+
+static int pj_horner_selftest (void) {
+ PJ *P;
+ PJ_COORD a, b, c;
+ double dist;
+
+ /* Real polynonia relating the technical coordinate system TC32 to "System 45 Bornholm" */
+ P = proj_create (PJ_DEFAULT_CTX, tc32_utm32);
+ if (0==P)
+ return 10;
+
+ a = b = proj_coord (0,0,0,0);
+ a.uv.v = 6125305.4245;
+ a.uv.u = 878354.8539;
+ c = a;
+
+ /* Check roundtrip precision for 1 iteration each way, starting in forward direction */
+ dist = proj_roundtrip (P, PJ_FWD, 1, &c);
+ if (dist > 0.01)
+ return 1;
+
+ /* The complex polynomial transformation between the "System Storebaelt" and utm32/ed50 */
+ P = proj_create (PJ_DEFAULT_CTX, sb_utm32);
+ if (0==P)
+ return 11;
+
+ /* Test value: utm32_ed50(620000, 6130000) = sb_ed50(495136.8544, 6130821.2945) */
+ a = b = c = proj_coord (0,0,0,0);
+ a.uv.v = 6130821.2945;
+ a.uv.u = 495136.8544;
+ c.uv.v = 6130000.0000;
+ c.uv.u = 620000.0000;
+
+ /* Forward projection */
+ b = proj_trans (P, PJ_FWD, a);
+ dist = proj_xy_dist (b.xy, c.xy);
+ if (dist > 0.001)
+ return 2;
+
+ /* Inverse projection */
+ b = proj_trans (P, PJ_INV, c);
+ dist = proj_xy_dist (b.xy, a.xy);
+ if (dist > 0.001)
+ return 3;
+
+ /* Check roundtrip precision for 1 iteration each way */
+ dist = proj_roundtrip (P, PJ_FWD, 1, &a);
+ if (dist > 0.01)
+ return 4;
+
+ proj_destroy(P);
+ return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+/* Testing quite a bit of the pj_obs_api as a side effect (inspired by pj_obs_api_test.c) */
+static int pj_cart_selftest (void) {
+ PJ_CONTEXT *ctx;
+ PJ *P;
+ PJ_COORD a, b, obs[2];
+ PJ_COORD coord[2];
+
+ PJ_INFO info;
+ PJ_PROJ_INFO pj_info;
+ PJ_GRID_INFO grid_info;
+ PJ_INIT_INFO init_info;
+
+ PJ_DERIVS derivs;
+ PJ_FACTORS factors;
+
+ const PJ_OPERATIONS *oper_list;
+ const PJ_ELLPS *ellps_list;
+ const PJ_UNITS *unit_list;
+ const PJ_PRIME_MERIDIANS *pm_list;
+
+ int err;
+ size_t n, sz;
+ double dist, h, t;
+ char *args[3] = {"proj=utm", "zone=32", "ellps=GRS80"};
+ char *arg = {"+proj=utm +zone=32 +ellps=GRS80"};
+ char buf[40];
+
+ /* An utm projection on the GRS80 ellipsoid */
+ P = proj_create (PJ_DEFAULT_CTX, arg);
+ if (0==P)
+ return 1;
+
+
+ /* Clean up */
+ proj_destroy (P);
+
+ /* Same projection, now using argc/argv style initialization */
+ P = proj_create_argv (PJ_DEFAULT_CTX, 3, args);
+ if (0==P)
+ return 2;
+
+ /* zero initialize everything, then set (longitude, latitude) to (12, 55) */
+ a = proj_coord (0,0,0,0);
+ /* a.lp: The coordinate part of a, interpreted as a classic LP pair */
+ a.lp.lam = PJ_TORAD(12);
+ a.lp.phi = PJ_TORAD(55);
+
+ /* Forward projection */
+ b = proj_trans (P, PJ_FWD, a);
+
+ /* Inverse projection */
+ a = proj_trans (P, PJ_INV, b);
+
+ /* Null projection */
+ a = proj_trans (P, PJ_IDENT, a);
+
+ /* Forward again, to get two linear items for comparison */
+ a = proj_trans (P, PJ_FWD, a);
+
+ dist = proj_xy_dist (a.xy, b.xy);
+ if (dist > 2e-9)
+ return 3;
+
+ /* Clear any previous error */
+ proj_errno_set (P, 0);
+
+ /* Invalid projection */
+ a = proj_trans (P, 42, a);
+ if (a.lpz.lam!=HUGE_VAL)
+ return 4;
+ err = proj_errno (P);
+ if (0==err)
+ return 5;
+
+ /* Clear error again */
+ proj_errno_set (P, 0);
+
+ /* Clean up */
+ proj_destroy (P);
+
+ /* Now do some 3D transformations */
+ P = proj_create (PJ_DEFAULT_CTX, "+proj=cart +ellps=GRS80");
+ if (0==P)
+ return 6;
+
+ /* zero initialize everything, then set (longitude, latitude, height) to (12, 55, 100) */
+ a = b = proj_coord (0,0,0,0);
+ a.lpz.lam = PJ_TORAD(12);
+ a.lpz.phi = PJ_TORAD(55);
+ a.lpz.z = 100;
+
+ /* Forward projection: 3D-Cartesian-to-Ellipsoidal */
+ b = proj_trans (P, PJ_FWD, a);
+
+ /* Check roundtrip precision for 10000 iterations each way */
+ dist = proj_roundtrip (P, PJ_FWD, 10000, &a);
+ dist = proj_roundtrip (P, PJ_INV, 10000, &b);
+ if (dist > 2e-9)
+ return 7;
+
+
+ /* Test at the North Pole */
+ a = b = proj_coord (0,0,0,0);
+ a.lpz.lam = PJ_TORAD(0);
+ a.lpz.phi = PJ_TORAD(90);
+ a.lpz.z = 100;
+
+ /* Forward projection: Ellipsoidal-to-3D-Cartesian */
+ dist = proj_roundtrip (P, PJ_FWD, 1, &a);
+ if (dist > 1e-12)
+ return 8;
+
+ /* Test at the South Pole */
+ a = b = proj_coord (0,0,0,0);
+ a.lpz.lam = PJ_TORAD(0);
+ a.lpz.phi = PJ_TORAD(-90);
+ a.lpz.z = 100;
+ b = a;
+
+ /* Forward projection: Ellipsoidal-to-3D-Cartesian */
+ dist = proj_roundtrip (P, PJ_FWD, 1, &a);
+ if (dist > 1e-12)
+ return 9;
+
+
+ /* Inverse projection: 3D-Cartesian-to-Ellipsoidal */
+ b = proj_trans (P, PJ_INV, b);
+
+ /* Move p to another context */
+ ctx = proj_context_create ();
+ if (ctx==pj_get_default_ctx())
+ return 10;
+ proj_context_set (P, ctx);
+ if (ctx != P->ctx)
+ return 11;
+ b = proj_trans (P, PJ_FWD, b);
+
+ /* Move it back to the default context */
+ proj_context_set (P, 0);
+ if (pj_get_default_ctx() != P->ctx)
+ return 12;
+ proj_context_destroy (ctx);
+
+ /* We go on with the work - now back on the default context */
+ b = proj_trans (P, PJ_INV, b);
+ proj_destroy (P);
+
+
+ /* Testing proj_trans_generic () */
+
+ /* An utm projection on the GRS80 ellipsoid */
+ P = proj_create (PJ_DEFAULT_CTX, "+proj=utm +zone=32 +ellps=GRS80");
+ if (0==P)
+ return 13;
+
+ obs[0] = proj_coord (PJ_TORAD(12), PJ_TORAD(55), 45, 0);
+ obs[1] = proj_coord (PJ_TORAD(12), PJ_TORAD(56), 50, 0);
+ sz = sizeof (PJ_COORD);
+
+ /* Forward projection */
+ a = proj_trans (P, PJ_FWD, obs[0]);
+ b = proj_trans (P, PJ_FWD, obs[1]);
+
+ n = proj_trans_generic (
+ P, PJ_FWD,
+ &(obs[0].lpz.lam), sz, 2,
+ &(obs[0].lpz.phi), sz, 2,
+ &(obs[0].lpz.z), sz, 2,
+ 0, sz, 0
+ );
+ if (2!=n)
+ return 14;
+ if (a.lpz.lam != obs[0].lpz.lam) return 15;
+ if (a.lpz.phi != obs[0].lpz.phi) return 16;
+ if (a.lpz.z != obs[0].lpz.z) return 17;
+ if (b.lpz.lam != obs[1].lpz.lam) return 18;
+ if (b.lpz.phi != obs[1].lpz.phi) return 19;
+ if (b.lpz.z != obs[1].lpz.z) return 20;
+
+ /* now test the case of constant z */
+ obs[0] = proj_coord (PJ_TORAD(12), PJ_TORAD(55), 45, 0);
+ obs[1] = proj_coord (PJ_TORAD(12), PJ_TORAD(56), 50, 0);
+ h = 27;
+ t = 33;
+ n = proj_trans_generic (
+ P, PJ_FWD,
+ &(obs[0].lpz.lam), sz, 2,
+ &(obs[0].lpz.phi), sz, 2,
+ &h, 0, 1,
+ &t, 0, 1
+ );
+ if (2!=n)
+ return 21;
+ if (a.lpz.lam != obs[0].lpz.lam) return 22;
+ if (a.lpz.phi != obs[0].lpz.phi) return 23;
+ if (45 != obs[0].lpz.z) return 24;
+ if (b.lpz.lam != obs[1].lpz.lam) return 25;
+ if (b.lpz.phi != obs[1].lpz.phi) return 26;
+ if (50 != obs[1].lpz.z) return 27; /* NOTE: unchanged */
+ if (50==h) return 28;
+
+ /* test proj_trans_array () */
+
+ coord[0] = proj_coord (PJ_TORAD(12), PJ_TORAD(55), 45, 0);
+ coord[1] = proj_coord (PJ_TORAD(12), PJ_TORAD(56), 50, 0);
+ if (proj_trans_array (P, PJ_FWD, 2, coord))
+ return 40;
+
+ if (a.lpz.lam != coord[0].lpz.lam) return 41;
+ if (a.lpz.phi != coord[0].lpz.phi) return 42;
+ if (a.lpz.z != coord[0].lpz.z) return 43;
+ if (b.lpz.lam != coord[1].lpz.lam) return 44;
+ if (b.lpz.phi != coord[1].lpz.phi) return 45;
+ if (b.lpz.z != coord[1].lpz.z) return 46;
+
+ /* Clean up after proj_trans_* tests */
+ proj_destroy (P);
+
+ /* test proj_create_crs_to_crs() */
+ P = proj_create_crs_to_crs(PJ_DEFAULT_CTX, "epsg:25832", "epsg:25833", NULL);
+ if (P==0)
+ return 50;
+
+ a.xy.x = 700000.0;
+ a.xy.y = 6000000.0;
+ b.xy.x = 307788.8761171057;
+ b.xy.y = 5999669.3036037628;
+
+ a = proj_trans(P, PJ_FWD, a);
+ if (dist > 1e-7)
+ return 51;
+ proj_destroy(P);
+
+ /* let's make sure that only entries in init-files results in a usable PJ */
+ P = proj_create_crs_to_crs(PJ_DEFAULT_CTX, "proj=utm +zone=32 +datum=WGS84", "proj=utm +zone=33 +datum=WGS84", NULL);
+ if (P != 0) {
+ proj_destroy(P);
+ return 52;
+ }
+ proj_destroy(P);
+
+ /* ********************************************************************** */
+ /* Test info functions */
+ /* ********************************************************************** */
+
+ /* proj_info() */
+ /* this one is difficult to test, since the output changes with the setup */
+ info = proj_info();
+ if (info.version[0] != '\0' ) {
+ char tmpstr[64];
+ sprintf(tmpstr, "%d.%d.%d", info.major, info.minor, info.patch);
+ if (strcmp(info.version, tmpstr)) return 55;
+ }
+ if (info.release[0] == '\0') return 56;
+ if (info.searchpath[0] == '\0') return 57;
+
+ /* proj_pj_info() */
+ P = proj_create(PJ_DEFAULT_CTX, "+proj=august"); /* august has no inverse */
+ if (proj_pj_info(P).has_inverse) { proj_destroy(P); return 60; }
+ proj_destroy(P);
+
+ P = proj_create(PJ_DEFAULT_CTX, arg);
+ pj_info = proj_pj_info(P);
+ if ( !pj_info.has_inverse ) { proj_destroy(P); return 61; }
+ if ( strcmp(pj_info.definition, arg) ) { proj_destroy(P); return 62; }
+ if ( strcmp(pj_info.id, "utm") ) { proj_destroy(P); return 63; }
+ proj_destroy(P);
+
+ /* proj_grid_info() */
+ grid_info = proj_grid_info("egm96_15.gtx");
+ if ( strlen(grid_info.filename) == 0 ) return 64;
+ if ( strcmp(grid_info.gridname, "egm96_15.gtx") ) return 65;
+ grid_info = proj_grid_info("nonexistinggrid");
+ if ( strlen(grid_info.filename) > 0 ) return 66;
+
+ /* proj_init_info() */
+ init_info = proj_init_info("unknowninit");
+ if ( strlen(init_info.filename) != 0 ) return 67;
+
+ init_info = proj_init_info("epsg");
+ /* Need to allow for "Unknown" until all commonly distributed EPSG-files comes with a metadata section */
+ if ( strcmp(init_info.origin, "EPSG") && strcmp(init_info.origin, "Unknown") ) return 69;
+ if ( strcmp(init_info.name, "epsg") ) return 68;
+
+
+
+ /* test proj_rtodms() and proj_dmstor() */
+ if (strcmp("180dN", proj_rtodms(buf, M_PI, 'N', 'S')))
+ return 70;
+
+ if (proj_dmstor(&buf[0], NULL) != M_PI)
+ return 71;
+
+ if (strcmp("114d35'29.612\"S", proj_rtodms(buf, -2.0, 'N', 'S')))
+ return 72;
+
+ /* we can't expect perfect numerical accuracy so testing with a tolerance */
+ if (fabs(-2.0 - proj_dmstor(&buf[0], NULL)) > 1e-7)
+ return 73;
+
+
+ /* test proj_derivatives_retrieve() and proj_factors_retrieve() */
+ P = proj_create(PJ_DEFAULT_CTX, "+proj=merc");
+ a = proj_coord (0,0,0,0);
+ a.lp.lam = PJ_TORAD(12);
+ a.lp.phi = PJ_TORAD(55);
+
+ derivs = proj_derivatives(P, a.lp);
+ if (proj_errno(P))
+ return 80; /* derivs not created correctly */
+
+ if ( fabs(derivs.x_l - 1.0) > 1e-5 ) return 81;
+ if ( fabs(derivs.x_p - 0.0) > 1e-5 ) return 82;
+ if ( fabs(derivs.y_l - 0.0) > 1e-5 ) return 83;
+ if ( fabs(derivs.y_p - 1.73959) > 1e-5 ) return 84;
+
+
+ factors = proj_factors(P, a.lp);
+ if (proj_errno(P))
+ return 85; /* factors not created correctly */
+
+ /* check a few key characteristics of the Mercator projection */
+ if (factors.omega != 0.0) return 86; /* angular distortion should be 0 */
+ if (factors.thetap != M_PI_2) return 87; /* Meridian/parallel angle should be 90 deg */
+ if (factors.conv != 0.0) return 88; /* meridian convergence should be 0 */
+
+
+ proj_destroy(P);
+
+ /* Check that proj_list_* functions work by looping through them */
+ n = 0;
+ for (oper_list = proj_list_operations(); oper_list->id; ++oper_list) n++;
+ if (n == 0) return 90;
+
+ n = 0;
+ for (ellps_list = proj_list_ellps(); ellps_list->id; ++ellps_list) n++;
+ if (n == 0) return 91;
+
+ n = 0;
+ for (unit_list = proj_list_units(); unit_list->id; ++unit_list) n++;
+ if (n == 0) return 92;
+
+ n = 0;
+ for (pm_list = proj_list_prime_meridians(); pm_list->id; ++pm_list) n++;
+ if (n == 0) return 93;
+
+
+ /* check io-predicates */
+
+ /* angular in on fwd, linear out */
+ P = proj_create (PJ_DEFAULT_CTX, "+proj=cart +ellps=GRS80");
+ if (0==P) return 0;
+ if (!proj_angular_input (P, PJ_FWD)) return 100;
+ if ( proj_angular_input (P, PJ_INV)) return 101;
+ if ( proj_angular_output (P, PJ_FWD)) return 102;
+ if (!proj_angular_output (P, PJ_INV)) return 103;
+ P->inverted = 1;
+ if ( proj_angular_input (P, PJ_FWD)) return 104;
+ if (!proj_angular_input (P, PJ_INV)) return 105;
+ if (!proj_angular_output (P, PJ_FWD)) return 106;
+ if ( proj_angular_output (P, PJ_INV)) return 107;
+ proj_destroy(P);
+
+ /* angular in and out */
+ P = proj_create(PJ_DEFAULT_CTX,
+ "+proj=molodensky +a=6378160 +rf=298.25 "
+ "+da=-23 +df=-8.120449e-8 +dx=-134 +dy=-48 +dz=149 "
+ "+abridged "
+ );
+ if (0==P) return 0;
+ if (!proj_angular_input (P, PJ_FWD)) return 108;
+ if (!proj_angular_input (P, PJ_INV)) return 109;
+ if (!proj_angular_output (P, PJ_FWD)) return 110;
+ if (!proj_angular_output (P, PJ_INV)) return 111;
+ P->inverted = 1;
+ if (!proj_angular_input (P, PJ_FWD)) return 112;
+ if (!proj_angular_input (P, PJ_INV)) return 113;
+ if (!proj_angular_output (P, PJ_FWD)) return 114;
+ if (!proj_angular_output (P, PJ_INV)) return 115;
+ proj_destroy(P);
+
+ /* linear in and out */
+ P = proj_create(PJ_DEFAULT_CTX,
+ " +proj=helmert +ellps=GRS80"
+ " +x=0.0127 +y=0.0065 +z=-0.0209 +s=0.00195"
+ " +rx=-0.00039 +ry=0.00080 +rz=-0.00114"
+ " +dx=-0.0029 +dy=-0.0002 +dz=-0.0006 +ds=0.00001"
+ " +drx=-0.00011 +dry=-0.00019 +drz=0.00007"
+ " +epoch=1988.0 +transpose"
+ );
+ if (0==P) return 0;
+ if (proj_angular_input (P, PJ_FWD)) return 116;
+ if (proj_angular_input (P, PJ_INV)) return 117;
+ if (proj_angular_output (P, PJ_FWD)) return 118;
+ if (proj_angular_output (P, PJ_INV)) return 119;
+ P->inverted = 1;
+ if (proj_angular_input (P, PJ_FWD)) return 120;
+ if (proj_angular_input (P, PJ_INV)) return 121;
+ if (proj_angular_output (P, PJ_FWD)) return 122;
+ if (proj_angular_output (P, PJ_INV)) return 123;
+ proj_destroy(P);
+
+
+ return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+static int test_time(char* args, double tol, double t_in, double t_exp) {
+ PJ_COORD in, out;
+ PJ *P = proj_create(PJ_DEFAULT_CTX, args);
+ int ret = 0;
+
+ if (P == 0)
+ return 5;
+
+ in.xyzt.t = t_in;
+
+ out = proj_trans(P, PJ_FWD, in);
+ if (fabs(out.xyzt.t - t_exp) > tol) {
+ proj_log_error(P, "out: %10.10g, expect: %10.10g", out.xyzt.t, t_exp);
+ ret = 1;
+ }
+ out = proj_trans(P, PJ_INV, out);
+ if (fabs(out.xyzt.t - t_in) > tol) {
+ proj_log_error(P, "out: %10.10g, expect: %10.10g", out.xyzt.t, t_in);
+ ret = 2;
+ }
+ pj_free(P);
+
+ proj_log_level(NULL, 0);
+ return ret;
+}
+
+static int test_xyz(char* args, double tol, PJ_TRIPLET in, PJ_TRIPLET exp) {
+ PJ_COORD out, obs_in;
+ PJ *P = proj_create(PJ_DEFAULT_CTX, args);
+ int ret = 0;
+
+ if (P == 0)
+ return 5;
+
+ obs_in.xyz = in.xyz;
+ out = proj_trans(P, PJ_FWD, obs_in);
+ if (proj_xyz_dist(out.xyz, exp.xyz) > tol) {
+ printf("exp: %10.10g, %10.10g, %10.10g\n", exp.xyz.x, exp.xyz.y, exp.xyz.z);
+ printf("out: %10.10g, %10.10g, %10.10g\n", out.xyz.x, out.xyz.y, out.xyz.z);
+ ret = 1;
+ }
+
+ out = proj_trans(P, PJ_INV, out);
+ if (proj_xyz_dist(out.xyz, in.xyz) > tol) {
+ printf("exp: %g, %g, %g\n", in.xyz.x, in.xyz.y, in.xyz.z);
+ printf("out: %g, %g, %g\n", out.xyz.x, out.xyz.y, out.xyz.z);
+ ret += 2;
+ }
+ proj_destroy(P);
+ proj_log_level(NULL, 0);
+ return ret;
+}
+
+
+static int pj_unitconvert_selftest (void) {
+ int ret = 0;
+ char args1[] = "+proj=unitconvert +t_in=decimalyear +t_out=decimalyear";
+ double in1 = 2004.25;
+
+ char args2[] = "+proj=unitconvert +t_in=gps_week +t_out=gps_week";
+ double in2 = 1782.0;
+
+ char args3[] = "+proj=unitconvert +t_in=mjd +t_out=mjd";
+ double in3 = 57390.0;
+
+ char args4[] = "+proj=unitconvert +t_in=gps_week +t_out=decimalyear";
+ double in4 = 1877.71428, exp4 = 2016.0;
+
+ char args5[] = "+proj=unitconvert +xy_in=m +xy_out=dm +z_in=cm +z_out=mm";
+ PJ_TRIPLET in5 = {{55.25, 23.23, 45.5}}, exp5 = {{552.5, 232.3, 455.0}};
+
+ char args6[] = "+proj=unitconvert +xy_in=m +xy_out=m +z_in=m +z_out=m";
+ PJ_TRIPLET in6 = {{12.3, 45.6, 7.89}};
+
+ ret = test_time(args1, 1e-6, in1, in1); if (ret) return ret + 10;
+ ret = test_time(args2, 1e-6, in2, in2); if (ret) return ret + 20;
+ ret = test_time(args3, 1e-6, in3, in3); if (ret) return ret + 30;
+ ret = test_time(args4, 1e-6, in4, exp4); if (ret) return ret + 40;
+ ret = test_xyz (args5, 1e-10, in5, exp5); if (ret) return ret + 50;
+ ret = test_xyz (args6, 1e-10, in6, in6); if (ret) return ret + 50;
+
+ return 0;
+
+}
+
+
+
diff --git a/src/lib_proj.cmake b/src/lib_proj.cmake
index 4b701886..81de451e 100644
--- a/src/lib_proj.cmake
+++ b/src/lib_proj.cmake
@@ -186,7 +186,6 @@ SET(SRC_LIBPROJ_CORE
pj_fwd3d.c
pj_gauss.c
pj_gc_reader.c
- pj_generic_selftest.c
pj_geocent.c
pj_gridcatalog.c
pj_gridinfo.c
@@ -212,7 +211,6 @@ SET(SRC_LIBPROJ_CORE
pj_pr_list.c
pj_qsfn.c
pj_release.c
- pj_run_selftests.c
pj_strerrno.c
pj_transform.c
pj_tsfn.c
diff --git a/src/makefile.vc b/src/makefile.vc
index ae2dc587..6bc06bd1 100644
--- a/src/makefile.vc
+++ b/src/makefile.vc
@@ -56,8 +56,7 @@ support = \
pj_utils.obj pj_gridlist.obj pj_gridinfo.obj \
proj_mdist.obj pj_mutex.obj pj_initcache.obj \
pj_ctx.obj pj_fileapi.obj pj_log.obj pj_apply_vgridshift.obj \
- pj_strtod.obj pj_run_selftests.obj pj_generic_selftest.obj \
- pj_internal.obj
+ pj_strtod.obj pj_internal.obj
pipeline = \
proj_4D_api.obj PJ_cart.obj PJ_pipeline.obj PJ_horner.obj PJ_helmert.obj \
diff --git a/src/pj_generic_selftest.c b/src/pj_generic_selftest.c
deleted file mode 100644
index 88b5c308..00000000
--- a/src/pj_generic_selftest.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/******************************************************************************
- * Project: PROJ.4
- * Purpose: Generic regression test for PROJ.4 projection algorithms.
- * Author: Thomas Knudsen
- *
- ******************************************************************************
- * Copyright (c) 2016, Thomas Knudsen
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *****************************************************************************/
-
-
-#include <stdio.h>
-#define PJ_LIB__
-#include <projects.h>
-
-
-static int deviates_xy (XY expected, XY got, double tolerance);
-static int deviates_lp (LP expected, LP got, double tolerance);
-static XY pj_fwd_deg (LP in, PJ *P);
-
-
-/**********************************************************************/
-int pj_generic_selftest (
-/**********************************************************************/
- char *e_args,
- char *s_args,
- double tolerance_xy,
- double tolerance_lp,
- int n_fwd,
- int n_inv,
- LP *fwd_in,
- XY *e_fwd_expect,
- XY *s_fwd_expect,
- XY *inv_in,
- LP *e_inv_expect,
- LP *s_inv_expect
-) {
-/***********************************************************************
-
-Generic regression test for PROJ.4 projection algorithms, testing both
-ellipsoidal ("e_") and spheroidal ("s_") versions of the projection
-algorithms in both forward ("_fwd_") and inverse ("_inv_") mode.
-
-Compares the "known good" results in <e_fwd_expect> and <s_fwd_expect>
-with the actual results obtained by transforming the forward input data
-set in <fwd_in> with pj_fwd() using setup arguments <e_args> and
-<s_args>, respectively.
-
-Then
-
-Compares the "known good" results in <e_inv_expect> and <s_inv_expect>
-with the actual results obtained by transforming the inverse input data
-set in <inv_in> with pj_inv() using setup arguments <e_args> and
-<s_args>, respectively.
-
-Any of the pointers passed may be set to 0, indicating "don't test this
-part".
-
-Returns 0 if all data agree to within the accuracy specified in
-<tolerance_xy> and <tolerance_lp>. Non-zero otherwise.
-
-***********************************************************************/
- int i;
-
- PJ *P;
-
- if (e_args) {
- P = pj_init_plus(e_args);
- if (0==P)
- return 2;
-
- /* Test forward ellipsoidal */
- if (e_fwd_expect) {
- for (i = 0; i < n_fwd; i++)
- if (deviates_xy (e_fwd_expect[i], pj_fwd_deg ( fwd_in[i], P ), tolerance_xy))
- break;
- if ( i != n_fwd )
- return 100 + i;
- }
-
- /* Test inverse ellipsoidal */
- if (e_inv_expect) {
- for (i = 0; i < n_inv; i++)
- if (deviates_lp (e_inv_expect[i], pj_inv ( inv_in[i], P ), tolerance_lp))
- break;
- if ( i != n_inv )
- return 200 + i;
- }
-
- pj_free (P);
- }
-
-
- if (s_args) {
- P = pj_init_plus(s_args);
- if (0==P)
- return 3;
-
- /* Test forward spherical */
- if (s_fwd_expect) {
- for (i = 0; i < n_fwd; i++)
- if (deviates_xy (s_fwd_expect[i], pj_fwd_deg ( fwd_in[i], P ), tolerance_xy))
- break;
- if ( i != n_fwd )
- return 300 + i;
- }
-
- /* Test inverse spherical */
- if (s_inv_expect) {
- for (i = 0; i < n_inv; i++)
- if (deviates_lp (s_inv_expect[i], pj_inv ( inv_in[i], P ), tolerance_lp))
- break;
- if ( i != n_inv )
- return 400 + i;
- }
-
- pj_free (P);
- }
-
- return 0;
-}
-
-
-
-/**********************************************************************/
-static int deviates_xy (XY expected, XY got, double tolerance) {
-/***********************************************************************
-
- Determine whether two XYs deviate by more than <tolerance>.
-
- The test material ("expected" values) may contain coordinates that
- are indeterminate. For those cases, we test the other coordinate
- only by forcing expected and actual ("got") coordinates to 0.
-
-***********************************************************************/
- if (HUGE_VAL== expected.x)
- return 0;
- if (HUGE_VAL== expected.y)
- return 0;
- if (hypot ( expected.x - got.x, expected.y - got.y ) > tolerance)
- return 1;
- return 0;
-}
-
-
-/**********************************************************************/
-static int deviates_lp (LP expected, LP got, double tolerance) {
-/***********************************************************************
-
- Determine whether two LPs deviate by more than <tolerance>.
-
- This one is slightly tricky, since the <expected> LP is
- supposed to be represented as degrees (since it was at some
- time written down by a real human), whereas the <got> LP is
- represented in radians (since it is supposed to be the result
- output from pj_inv)
-
-***********************************************************************/
- if (HUGE_VAL== expected.lam)
- return 0;
- if (HUGE_VAL== expected.phi)
- return 0;
- if (hypot ( DEG_TO_RAD * expected.lam - got.lam, DEG_TO_RAD * expected.phi - got.phi ) > tolerance)
- return 1;
- return 0;
-}
-
-
-/**********************************************************************/
-static XY pj_fwd_deg (LP in, PJ *P) {
-/***********************************************************************
-
- Wrapper for pj_fwd, accepting input in degrees.
-
-***********************************************************************/
- LP in_rad;
- in_rad.lam = DEG_TO_RAD * in.lam;
- in_rad.phi = DEG_TO_RAD * in.phi;
- return pj_fwd (in_rad, P);
-}
diff --git a/src/pj_geocent.c b/src/pj_geocent.c
index 667c29bd..eca62080 100644
--- a/src/pj_geocent.c
+++ b/src/pj_geocent.c
@@ -58,49 +58,3 @@ PJ *PROJECTION(geocent) {
return P;
}
-
-#ifndef PJ_SELFTEST
-int pj_geocent_selftest (void) {return 0;}
-#else
-
-int pj_geocent_selftest (void) {
-
- double tolerance_lp = 1e-10;
- double tolerance_xy = 1e-7;
-
- char e_args[] = {"+proj=geocent +ellps=GRS80 +lat_1=0.5 +lat_2=2"};
- char s_args[] = {"+proj=geocent +a=6400000 +lat_1=0.5 +lat_2=2"};
-
- LP fwd_in[] = {
- { 2, 1},
- { 2,-1},
- {-2, 1},
- {-2,-1}
- };
-
- XY e_fwd_expect[] = {
- { 222638.98158654713, 111319.49079327357},
- { 222638.98158654713, -111319.49079327357},
- {-222638.98158654713, 111319.49079327357},
- {-222638.98158654713, -111319.49079327357},
- };
-
- XY inv_in[] = {
- { 200, 100},
- { 200,-100},
- {-200, 100},
- {-200,-100}
- };
-
- LP e_inv_expect[] = {
- { 0.0017966305682390426, 0.00089831528411952132},
- { 0.0017966305682390426, -0.00089831528411952132},
- {-0.0017966305682390426, 0.00089831528411952132},
- {-0.0017966305682390426, -0.00089831528411952132},
- };
-
- return pj_generic_selftest (e_args, s_args, tolerance_xy, tolerance_lp, 4, 4, fwd_in, e_fwd_expect, 0, inv_in, e_inv_expect, 0);
-}
-
-#endif
-
diff --git a/src/pj_list.c b/src/pj_list.c
index 9fde000f..2bdd3053 100644
--- a/src/pj_list.c
+++ b/src/pj_list.c
@@ -6,26 +6,16 @@
#include "projects.h"
-
-#define PASTE(a,b) a##b
-
/* Generate prototypes for projection functions */
#define PROJ_HEAD(id, name) struct PJconsts *pj_##id(struct PJconsts*);
#include "pj_list.h"
#undef PROJ_HEAD
-/* Generate prototypes for projection selftest functions */
-#define PROJ_HEAD(id, name) int PASTE(pj_##id, _selftest) (void);
-#include "pj_list.h"
-#undef PROJ_HEAD
-
-
/* Generate extern declarations for description strings */
#define PROJ_HEAD(id, name) extern char * const pj_s_##id;
#include "pj_list.h"
#undef PROJ_HEAD
-
/* Generate the null-terminated list of projection functions with associated mnemonics and descriptions */
#define PROJ_HEAD(id, name) {#id, pj_##id, &pj_s_##id},
struct PJ_LIST pj_list[] = {
@@ -35,21 +25,6 @@ struct PJ_LIST pj_list[] = {
#undef PROJ_HEAD
-/* Generate the null-terminated list of projection selftest functions with associated mnemonics */
-#define PROJ_HEAD(id, name) {#id, PASTE(pj_##id, _selftest)},
-struct PJ_SELFTEST_LIST pj_selftest_list[] = {
-#include "pj_list.h"
- {0, 0},
- };
-#undef PROJ_HEAD
-#undef PASTE
-
-
struct PJ_LIST *pj_get_list_ref (void) {
return pj_list;
}
-
-
-struct PJ_SELFTEST_LIST *pj_get_selftest_list_ref (void) {
- return pj_selftest_list;
-}
diff --git a/src/pj_run_selftests.c b/src/pj_run_selftests.c
deleted file mode 100644
index 90193af8..00000000
--- a/src/pj_run_selftests.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/******************************************************************************
- * Project: PROJ.4
- * Purpose: Generic regression test for PROJ.4 projection algorithms.
- * Author: Thomas Knudsen
- *
- ******************************************************************************
- * Copyright (c) 2016, Thomas Knudsen
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *****************************************************************************/
-
-#include <stdio.h>
-#define PJ_LIB__
-#include <projects.h>
-
-
-#ifndef PJ_SELFTEST
-int pj_run_selftests (int verbosity) {
- (void)verbosity;
- printf ("This version of libproj is not configured for internal regression tests.\n");
- return 0;
-}
-#else
-
-
-static void run_one_test (const char *mnemonic, int (testfunc)(void), int verbosity, int *n_ok, int *n_ko, int *n_stubs) {
- int ret;
- ret = testfunc ();
- switch (ret) {
- case 0: (*n_ok)++; break;
- case 10000: (*n_stubs)++; break;
- default: (*n_ko)++;
- }
-
- if (verbosity) {
- if (ret==10000)
- printf ("Testing: %10s - [stub]\n", mnemonic);
- else
- printf ("Testing: %10s - return code: %d\n", mnemonic, ret);
- }
- return;
-}
-
-
-int pj_run_selftests (int verbosity) {
- int n_ok = 0, n_ko = 0, n_stubs = 0, i = 0;
-
- struct PJ_SELFTEST_LIST *tests = pj_get_selftest_list_ref ();
-
- if (0==tests)
- printf ("This version of libproj is not configured for internal regression tests.\n");
-
- if (verbosity)
- printf ("Running internal regression tests\n");
-
- for (i = 0; tests[i].testfunc != 0; i++)
- run_one_test (tests[i].id, tests[i].testfunc, verbosity, &n_ok, &n_ko, &n_stubs);
-
- if (0==verbosity)
- printf ("Internal regression tests done. ");
- printf ("[Stubs: %d] Total: %d. Failure: %d. Success: %d\n", n_stubs, n_ok+n_ko, n_ko, n_ok);
- return n_ko;
-}
-#endif
diff --git a/src/proj.c b/src/proj.c
index 049593c9..57d33a73 100644
--- a/src/proj.c
+++ b/src/proj.c
@@ -42,7 +42,7 @@ static char
*cheby_str, /* string controlling Chebychev evaluation */
*oform = (char *)0, /* output format for x-y or decimal degrees */
*oterr = "*\t*", /* output line for unprojectable input */
- *usage = "%s\nusage: %s [ -bCeEfiIlormsStTvVwW [args] ] [ +opts[=arg] ] [ files ]\n";
+ *usage = "%s\nusage: %s [ -beEfiIlormsStTvVwW [args] ] [ +opts[=arg] ] [ files ]\n";
static struct FACTORS facs;
@@ -329,9 +329,6 @@ int main(int argc, char **argv) {
case 'b': /* binary I/O */
bin_in = bin_out = 1;
continue;
- case 'C': /* Check - run internal regression tests */
- return pj_run_selftests (very_verby);
- continue;
case 'v': /* monitor dump of initialization */
mon = 1;
continue;
diff --git a/src/proj.def b/src/proj.def
index cc1793e1..dd4a456c 100644
--- a/src/proj.def
+++ b/src/proj.def
@@ -88,62 +88,61 @@ EXPORTS
geod_polygon_testedge @86
geod_polygon_testpoint @87
geod_polygon_clear @88
- pj_run_selftests @89
- pj_find_file @90
+ pj_find_file @89
- proj_create @91
- proj_create_argv @92
- proj_create_crs_to_crs @93
- proj_destroy @94
+ proj_create @90
+ proj_create_argv @91
+ proj_create_crs_to_crs @92
+ proj_destroy @93
- proj_trans @95
- proj_trans_array @96
- proj_trans_generic @97
- proj_roundtrip @98
+ proj_trans @94
+ proj_trans_array @95
+ proj_trans_generic @96
+ proj_roundtrip @97
- proj_coord @99
- proj_coord_error @100
+ proj_coord @98
+ proj_coord_error @99
- proj_errno @101
- proj_errno_set @102
- proj_errno_reset @103
- proj_errno_restore @104
- proj_context_errno_set @105
+ proj_errno @100
+ proj_errno_set @101
+ proj_errno_reset @102
+ proj_errno_restore @103
+ proj_context_errno_set @104
- proj_context_create @106
- proj_context_set @107
- proj_context_inherit @108
- proj_context_destroy @109
+ proj_context_create @105
+ proj_context_set @106
+ proj_context_inherit @107
+ proj_context_destroy @108
- proj_lp_dist @110
- proj_lpz_dist @111
- proj_xy_dist @112
- proj_xyz_dist @113
+ proj_lp_dist @109
+ proj_lpz_dist @110
+ proj_xy_dist @111
+ proj_xyz_dist @112
- proj_log_level @114
- proj_log_func @115
- proj_log_error @116
- proj_log_debug @117
- proj_log_trace @118
+ proj_log_level @113
+ proj_log_func @114
+ proj_log_error @115
+ proj_log_debug @116
+ proj_log_trace @117
- proj_info @119
- proj_pj_info @120
- proj_grid_info @121
- proj_init_info @122
+ proj_info @118
+ proj_pj_info @119
+ proj_grid_info @120
+ proj_init_info @121
- proj_torad @123
- proj_todeg @124
- proj_rtodms @125
- proj_dmstor @126
+ proj_torad @122
+ proj_todeg @123
+ proj_rtodms @124
+ proj_dmstor @125
- proj_derivatives @127
- proj_factors @128
+ proj_derivatives @126
+ proj_factors @127
- proj_list_operations @129
- proj_list_ellps @130
- proj_list_units @131
- proj_list_prime_meridians @132
+ proj_list_operations @128
+ proj_list_ellps @129
+ proj_list_units @130
+ proj_list_prime_meridians @131
- proj_angular_input @133
- proj_angular_output @134
+ proj_angular_input @132
+ proj_angular_output @133
diff --git a/src/proj_api.h b/src/proj_api.h
index 151a824d..b0c4b71f 100644
--- a/src/proj_api.h
+++ b/src/proj_api.h
@@ -175,8 +175,6 @@ void pj_acquire_lock(void);
void pj_release_lock(void);
void pj_cleanup_lock(void);
-int pj_run_selftests (int verbosity);
-
void pj_set_ctx( projPJ, projCtx );
projCtx pj_ctx_alloc(void);
void pj_ctx_free( projCtx );
diff --git a/src/proj_etmerc.c b/src/proj_etmerc.c
index a756a7ac..b03862f8 100644
--- a/src/proj_etmerc.c
+++ b/src/proj_etmerc.c
@@ -332,63 +332,6 @@ PJ *PROJECTION(etmerc) {
-
-
-
-
-#ifndef PJ_SELFTEST
-int pj_etmerc_selftest (void) {return 0;}
-#else
-
-int pj_etmerc_selftest (void) {
- double tolerance_lp = 1e-10;
- double tolerance_xy = 1e-7;
-
- char e_args[] = {"+proj=etmerc +ellps=GRS80 +lat_1=0.5 +lat_2=2 +n=0.5 +zone=30"};
-
- LP fwd_in[] = {
- { 2, 1},
- { 2,-1},
- {-2, 1},
- {-2,-1}
- };
-
- XY e_fwd_expect[] = {
- {222650.79679758562, 110642.22941193319},
- {222650.79679758562, -110642.22941193319},
- {-222650.79679758562, 110642.22941193319},
- {-222650.79679758562, -110642.22941193319},
- };
-
- XY inv_in[] = {
- { 200, 100},
- { 200,-100},
- {-200, 100},
- {-200,-100}
- };
-
- LP e_inv_expect[] = {
- {0.0017966305681649398, 0.00090436947663183873},
- {0.0017966305681649398, -0.00090436947663183873},
- {-0.0017966305681649398, 0.00090436947663183873},
- {-0.0017966305681649398, -0.00090436947663183873},
- };
-
- return pj_generic_selftest (e_args, 0, tolerance_xy, tolerance_lp, 4, 4, fwd_in, e_fwd_expect, 0, inv_in, e_inv_expect, 0);
-}
-#endif
-
-
-
-
-
-
-
-
-
-
-
-
/* utm uses etmerc for the underlying projection */
@@ -429,48 +372,3 @@ PJ *PROJECTION(utm) {
return setup (P);
}
-
-#ifndef PJ_SELFTEST
-int pj_utm_selftest (void) {return 0;}
-#else
-
-int pj_utm_selftest (void) {
- double tolerance_lp = 1e-10;
- double tolerance_xy = 1e-7;
-
- char e_args[] = {"+proj=utm +ellps=GRS80 +lat_1=0.5 +lat_2=2 +n=0.5 +zone=30"};
-
- LP fwd_in[] = {
- { 2, 1},
- { 2,-1},
- {-2, 1},
- {-2,-1}
- };
-
- XY e_fwd_expect[] = {
- {1057002.4054912981, 110955.14117594929},
- {1057002.4054912981, -110955.14117594929},
- {611263.81227890507, 110547.10569680421},
- {611263.81227890507, -110547.10569680421},
- };
-
- XY inv_in[] = {
- { 200, 100},
- { 200,-100},
- {-200, 100},
- {-200,-100}
- };
-
- LP e_inv_expect[] = {
- {-7.4869520833902357, 0.00090193980983462605},
- {-7.4869520833902357, -0.00090193980983462605},
- {-7.4905356820622613, 0.00090193535121489081},
- {-7.4905356820622613, -0.00090193535121489081},
- };
-
- return pj_generic_selftest (e_args, 0, tolerance_xy, tolerance_lp, 4, 4, fwd_in, e_fwd_expect, 0, inv_in, e_inv_expect, 0);
-}
-#endif
-
-
-
diff --git a/src/proj_rouss.c b/src/proj_rouss.c
index 952e5c55..5555e3e4 100644
--- a/src/proj_rouss.c
+++ b/src/proj_rouss.c
@@ -152,47 +152,3 @@ PJ *PROJECTION(rouss) {
return P;
}
-
-#ifndef PJ_SELFTEST
-int pj_rouss_selftest (void) {return 0;}
-#else
-
-int pj_rouss_selftest (void) {
- double tolerance_lp = 1e-10;
- double tolerance_xy = 1e-7;
-
- char e_args[] = {"+proj=rouss +ellps=GRS80 +lat_1=0.5 +lat_2=2"};
-
- LP fwd_in[] = {
- { 2, 1},
- { 2,-1},
- {-2, 1},
- {-2,-1}
- };
-
- XY e_fwd_expect[] = {
- { 222644.89413161727, 110611.09186837047},
- { 222644.89413161727, -110611.09186837047},
- {-222644.89413161727, 110611.09186837047},
- {-222644.89413161727, -110611.09186837047},
- };
-
- XY inv_in[] = {
- { 200, 100},
- { 200,-100},
- {-200, 100},
- {-200,-100}
- };
-
- LP e_inv_expect[] = {
- { 0.0017966305682019911, 0.00090436947683699559},
- { 0.0017966305682019911, -0.00090436947683699559},
- {-0.0017966305682019911, 0.00090436947683699559},
- {-0.0017966305682019911, -0.00090436947683699559},
- };
-
- return pj_generic_selftest (e_args, 0, tolerance_xy, tolerance_lp, 4, 4, fwd_in, e_fwd_expect, 0, inv_in, e_inv_expect, 0);
-}
-
-
-#endif
diff --git a/src/projects.h b/src/projects.h
index a28c08d1..1d4fff50 100644
--- a/src/projects.h
+++ b/src/projects.h
@@ -561,7 +561,6 @@ struct PJ_LIST {
#ifndef USE_PJ_LIST_H
extern struct PJ_LIST pj_list[];
-extern struct PJ_SELFTEST_LIST pj_selftest_list[];
#endif
#ifndef PJ_ELLPS__
@@ -588,7 +587,6 @@ extern struct PJ_PRIME_MERIDIANS pj_prime_meridians[];
\
pj_projection_specific_setup_##name (PJ *P); \
C_NAMESPACE PJ *pj_##name (PJ *P); \
-int pj_ ## name ## _selftest (void); \
\
C_NAMESPACE_VAR const char * const pj_s_##name = des_##name; \
\
@@ -618,27 +616,6 @@ PJ *pj_projection_specific_setup_##name (PJ *P)
#endif /* def PJ_LIB__ */
-
-
-
-int pj_generic_selftest (
- char *e_args,
- char *s_args,
- double tolerance_xy,
- double tolerance_lp,
- int n_fwd,
- int n_inv,
- LP *fwd_in,
- XY *e_fwd_expect,
- XY *s_fwd_expect,
- XY *inv_in,
- LP *e_inv_expect,
- LP *s_inv_expect
-);
-
-
-
-
#define MAX_TAB_ID 80
typedef struct { float lam, phi; } FLP;
typedef struct { int lam, phi; } ILP;
@@ -816,7 +793,6 @@ struct PJ_ELLPS *pj_get_ellps_ref( void );
struct PJ_DATUMS *pj_get_datums_ref( void );
struct PJ_UNITS *pj_get_units_ref( void );
struct PJ_LIST *pj_get_list_ref( void );
-struct PJ_SELFTEST_LIST *pj_get_selftest_list_ref ( void );
struct PJ_PRIME_MERIDIANS *pj_get_prime_meridians_ref( void );
void *pj_default_destructor (PJ *P, int errlev);
diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie
index 0755ffb3..c6a801f8 100644
--- a/test/gie/builtins.gie
+++ b/test/gie/builtins.gie
@@ -1,3 +1,15 @@
+===============================================================================
+
+Test material, mostly converted from selftest entries in PJ_xxx.c
+
+Most of this material was autogenerated, and does not attempt to exercise
+corner cases etc.
+
+See more_builtins.gie for some test cases with a more human touch.
+
+===============================================================================
+
+
BEGIN
===============================================================================
@@ -1181,7 +1193,7 @@ expect -0.002532140 -0.001048847
===============================================================================
Geocentric
-
+
===============================================================================
-------------------------------------------------------------------------------
@@ -1456,7 +1468,7 @@ expect -75.446820242 34.185406226
===============================================================================
Hammer & Eckert-Greifendorff
- Misc Sph,
+ Misc Sph,
W= M=
===============================================================================
@@ -4242,7 +4254,7 @@ accept 2 1
expect 223395.249543407 111704.596633675
rem 223395.249543407 111704.596633675 osgeo
rem 223395.249543407 111704.596633675 debug/bin
-
+
accept 2 -1
expect 223395.249543407 -111704.596633675
diff --git a/test/gie/more_builtins.gie b/test/gie/more_builtins.gie
new file mode 100644
index 00000000..1e3ce185
--- /dev/null
+++ b/test/gie/more_builtins.gie
@@ -0,0 +1,264 @@
+
+===============================================================================
+
+Various test material, mostly converted from selftest entries in PJ_xxx.c
+
+Contrary to the material in builtins.gie, this material is handwritten and
+intends to exercise corner cases.
+
+===============================================================================
+
+
+BEGIN
+
+-------------------------------------------------------------------------------
+Two ob_tran tests from nad/testvarious
+-------------------------------------------------------------------------------
+operation +proj=ob_tran +o_proj=moll +R=6378137.0 +o_lon_p=0 +o_lat_p=0 +lon_0=180
+-------------------------------------------------------------------------------
+tolerance 1 mm
+direction inverse
+
+accept 300000 400000 0 0
+expect -42.7562158333 85.5911341667 0 0
+
+direction forward
+
+accept 10 20 0 0
+expect -1384841.18787 7581707.88240 0 0
+-------------------------------------------------------------------------------
+
+
+
+
+
+-------------------------------------------------------------------------------
+Two tests from PJ_molodensky.c
+-------------------------------------------------------------------------------
+operation proj=molodensky a=6378160 rf=298.25 \
+ da=-23 df=-8.120449e-8 dx=-134 dy=-48 dz=149 \
+ abridged
+-------------------------------------------------------------------------------
+tolerance 2 m
+
+accept 144.9667 -37.8 50 0
+expect 144.968 -37.79848 46.378 0
+
+roundtrip 100 1 m
+-------------------------------------------------------------------------------
+Same thing once more, but this time unabridged
+-------------------------------------------------------------------------------
+operation proj=molodensky a=6378160 rf=298.25 \
+ da=-23 df=-8.120449e-8 dx=-134 dy=-48 dz=149
+-------------------------------------------------------------------------------
+tolerance 2 m
+
+accept 144.9667 -37.8 50 0
+expect 144.968 -37.79848 46.378 0
+
+roundtrip 100 1 m
+-------------------------------------------------------------------------------
+
+
+
+
+
+-------------------------------------------------------------------------------
+Some tests from PJ_pipeline.c
+-------------------------------------------------------------------------------
+Forward-reverse geo->utm->geo
+-------------------------------------------------------------------------------
+operation proj=pipeline zone=32 step \
+ proj=utm ellps=GRS80 step \
+ proj=utm ellps=GRS80 inv
+-------------------------------------------------------------------------------
+tolerance 0.1 mm
+
+accept 12 55 0 0
+expect 12 55 0 0
+
+Now the inverse direction (still same result: the pipeline is symmetrical)
+
+direction inverse
+expect 12 55 0 0
+-------------------------------------------------------------------------------
+And now the back-to-back situation utm->geo->utm
+-------------------------------------------------------------------------------
+operation proj=pipeline zone=32 ellps=GRS80 step \
+ proj=utm inv step \
+ proj=utm
+-------------------------------------------------------------------------------
+accept 691875.63214 6098907.82501 0 0
+expect 691875.63214 6098907.82501 0 0
+direction inverse
+expect 691875.63214 6098907.82501 0 0
+-------------------------------------------------------------------------------
+Test a corner case: A rather pointless one-step pipeline geo->utm
+-------------------------------------------------------------------------------
+operation proj=pipeline step proj=utm zone=32 ellps=GRS80
+-------------------------------------------------------------------------------
+accept 12 55 0 0
+expect 691875.63214 6098907.82501 0 0
+direction inverse
+accept 691875.63214 6098907.82501 0 0
+expect 12 55 0 0
+-------------------------------------------------------------------------------
+Finally test a pipeline with more than one init step
+-------------------------------------------------------------------------------
+operation proj=pipeline step \
+ init=epsg:25832 inv step \
+ init=epsg:25833 step \
+ init=epsg:25833 inv step \
+ init=epsg:25832
+-------------------------------------------------------------------------------
+accept 691875.63214 6098907.82501 0 0
+expect 691875.63214 6098907.82501 0 0
+direction inverse
+accept 12 55 0 0
+expect 12 55 0 0
+
+
+
+
+
+-------------------------------------------------------------------------------
+Some tests from PJ_vgridshift.c
+-------------------------------------------------------------------------------
+operation proj=vgridshift grids=egm96_15.gtx ellps=GRS80
+-------------------------------------------------------------------------------
+Appears there is a difference between the egm96_15.gtx distributed by OSGeo4W,
+and the one from http://download.osgeo.org/proj/vdatum/egm96_15/egm96_15.gtx
+N(12.5, 55.5) = -36.021305084228515625 (download.osgeo.org)
+N(12.5, 55.5) = -35.880001068115234000 (OSGeo4W)
+This is annoying, but must be handled elsewhere. We jump through the hoop by
+setting a very lax tolerance.
+
+tolerance 15 cm
+accept 12.5 55.5 0 0
+expect 12.5 55.5 -36.021305084228516 0
+
+roundtrip 100 1 nm
+-------------------------------------------------------------------------------
+Fail on purpose: +grids parameter is mandatory
+operation proj=vgridshift
+expect failure
+
+Fail on purpose: open non-existing grid
+operation proj=vgridshift grids=nonexistinggrid.gtx
+expect failure
+
+
+
+
+
+-------------------------------------------------------------------------------
+Some tests from PJ_hgridshift.c
+-------------------------------------------------------------------------------
+operation proj=hgridshift +grids=nzgd2kgrid0005.gsb ellps=GRS80
+-------------------------------------------------------------------------------
+tolerance 1 nm
+accept 173 -45 0 0
+roundtrip 100
+-------------------------------------------------------------------------------
+expect 172.999892181021551 -45.001620431954613 0 0
+direction inverse
+accept 172.999892181021551 -45.001620431954613 0 0
+expect 173 -45 0 0
+-------------------------------------------------------------------------------
+Fail on purpose: +grids parameter is mandatory:
+operation proj=hgridshift
+expect failure
+
+Fail on purpose: open non-existing grid:
+operation proj=hgridshift grids=@nonexistinggrid.gsb,anothernonexistinggrid.gsb
+expect failure
+-------------------------------------------------------------------------------
+
+
+
+
+-------------------------------------------------------------------------------
+A number of tests from PJ_helmert.c
+-------------------------------------------------------------------------------
+This example is from Lotti Jivall: "Simplified transformations from
+ITRF2008/IGS08 to ETRS89 for maritime applications"
+-------------------------------------------------------------------------------
+operation proj=helmert ellps=GRS80 \
+ x=0.67678 y=0.65495 z=-0.52827 \
+ rx=-0.022742 ry=0.012667 rz=0.022704 s=-0.01070
+-------------------------------------------------------------------------------
+tolerance 1 um
+accept 3565285.00000000 855949.00000000 5201383.00000000
+expect 3565285.41342351 855948.67986759 5201382.72939791
+-------------------------------------------------------------------------------
+This example is a random point, transformed from ED50 to ETRS89 using KMStrans2
+-------------------------------------------------------------------------------
+operation proj=helmert ellps=GRS80 \
+ x=-81.0703 y=-89.3603 z=-115.7526 \
+ rx=-0.48488 ry=-0.02436 rz=-0.41321 s=-0.540645
+-------------------------------------------------------------------------------
+tolerance 1 um
+accept 3494994.30120000 1056601.97250000 5212382.16660000
+expect 3494909.84026368 1056506.78938633 5212265.66699761
+-------------------------------------------------------------------------------
+This example is a coordinate from the geodetic observatory in Onsala,
+Sweden transformed from ITRF2000 @ 2017.0 to ITRF93 @ 2017.0.
+
+The test coordinate was transformed using GNSStrans, using transformation
+parameters published by ITRF: ftp://itrf.ensg.ign.fr/pub/itrf/ITRF.TP
+-------------------------------------------------------------------------------
+operation proj=helmert ellps=GRS80 \
+ x=0.0127 y=0.0065 z=-0.0209 s=0.00195 \
+ dx=-0.0029 dy=-0.0002 dz=-0.0006 ds=0.00001 \
+ rx=-0.00039 ry=0.00080 rz=-0.00114 \
+ drx=-0.00011 dry=-0.00019 drz=0.00007 \
+ epoch=1988.0 tobs=2017.0 transpose
+-------------------------------------------------------------------------------
+tolerance 0.03 mm
+accept 3370658.37800 711877.31400 5349787.08600 2017.0 # ITRF2000@2017.0
+expect 3370658.18890 711877.42370 5349787.12430 2017.0 # ITRF93@2017.0
+-------------------------------------------------------------------------------
+This example is from "A mathematical relationship between NAD27 and NAD83 (91)
+State Plane coordinates in Southeastern Wisconsin":
+http://www.sewrpc.org/SEWRPCFiles/Publications/TechRep/tr-034-Mathematical-Relationship-Between-NAD27-and-NAD83-91-State-Plane-Coordinates-Southeastern-Wisconsin.pdf
+
+The test data is taken from p. 29. Here we are using point 203 and converting it
+from NAD27 (ft) -> NAD83 (m). The paper reports a difference of 0.0014 m from
+measured to computed coordinates, hence the test tolerance is set accordingly.
+-------------------------------------------------------------------------------
+operation proj=helmert ellps=GRS80 \
+ x=-9597.3572 y=.6112 \
+ s=0.304794780637 theta=-1.244048
+-------------------------------------------------------------------------------
+tolerance 1 mm
+accept 2546506.957 542256.609 0
+expect 766563.675 165282.277 0
+-------------------------------------------------------------------------------
+Finally test the 4D-capabilities of the proj.h API, especially that the
+rotation matrix is updated when necessary.
+
+Test coordinates from GNSStrans.
+-------------------------------------------------------------------------------
+operation proj=helmert ellps=GRS80 \
+ x=0.01270 y=0.00650 z=-0.0209 s=0.00195 \
+ dx=-0.0029 dy=-0.0002 dz=-0.0006 ds=0.00001 \
+ rx=-0.00039 ry=0.00080 rz=-0.00114 \
+ drx=-0.00011 dry=-0.00019 drz=0.00007 \
+ epoch=1988.0 transpose
+-------------------------------------------------------------------------------
+tolerance 0.1 mm
+accept 3370658.378 711877.314 5349787.086 2017.0
+expect 3370658.18890 711877.42370 5349787.12430 2017.0
+accept 3370658.378 711877.314 5349787.086 2018.0
+expect 3370658.18087 711877.42750 5349787.12648 2018.0
+
+
+
+-------------------------------------------------------------------------------
+builtins
+-------------------------------------------------------------------------------
+
+
+
+END
+
diff --git a/travis/install.sh b/travis/install.sh
index a96a151f..049669d4 100755
--- a/travis/install.sh
+++ b/travis/install.sh
@@ -80,8 +80,8 @@ if [ $TRAVIS_OS_NAME == "osx" ]; then
fi
make -j3
make check
-PROJ_LIB=$GRIDDIR ./src/proj -VC
PROJ_LIB=$GRIDDIR ./src/gie ./test/gie/builtins.gie
+PROJ_LIB=$GRIDDIR ./src/gie ./test/gie/more_builtins.gie
PROJ_LIB=$GRIDDIR ./src/gie ./test/gie/deformation.gie
PROJ_LIB=$GRIDDIR ./src/gie ./test/gie/axisswap.gie