aboutsummaryrefslogtreecommitdiff
path: root/src/PJ_unitconvert.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/PJ_unitconvert.c')
-rw-r--r--src/PJ_unitconvert.c92
1 files changed, 0 insertions, 92 deletions
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