summaryrefslogtreecommitdiff
path: root/test_geoid.c
diff options
context:
space:
mode:
authorChris Kuethe <chris.kuethe@gmail.com>2009-03-02 20:47:18 +0000
committerChris Kuethe <chris.kuethe@gmail.com>2009-03-02 20:47:18 +0000
commit6bc85b03ed3794d3d4549c25ba864eabffdfc39f (patch)
tree3aa743673efedc5f9b7c2fae5115fe2ab3006b2e /test_geoid.c
parentf36209db311e0c1b7fd6fcde1cd5058691c6d453 (diff)
downloadgpsd-6bc85b03ed3794d3d4549c25ba864eabffdfc39f.tar.gz
repository beautification, part 2:
rename the test programs to test_$(subsystem).c
Diffstat (limited to 'test_geoid.c')
-rw-r--r--test_geoid.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/test_geoid.c b/test_geoid.c
new file mode 100644
index 00000000..5db55019
--- /dev/null
+++ b/test_geoid.c
@@ -0,0 +1,42 @@
+/* $Id$ */
+/*
+ * test driver for the ECEF to WGS84 conversions in geoid.c
+ *
+ */
+
+#include <sys/types.h>
+#include <math.h>
+#include "gpsd_config.h"
+#include "gpsd.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv)
+{
+ double lat, lon;
+
+ if (argc != 3) {
+ fprintf(stderr,"Usage: %s lat lon\n",argv[0]);
+ return 1;
+ }
+
+ lat=atof(argv[1]);
+ lon=atof(argv[2]);
+
+ if (lat > 90. || lat < -90.)
+ {
+ fprintf(stderr," -90 <= lat=%s(%.f) <= 90 ?\n",argv[1],lat);
+ return 1;
+ }
+
+ if (lon > 180. || lat < -180.)
+ {
+ fprintf(stderr," -180 <= lon=%s(%.f) <= 180 ?\n",argv[2],lon);
+ return 1;
+ }
+
+ printf(" lat= %f lon= %f geoid correction= %f\n",
+ lat, lon, wgs84_separation(lat, lon));
+
+ return 0;
+}