diff options
Diffstat (limited to 'test-common.c')
-rw-r--r-- | test-common.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test-common.c b/test-common.c new file mode 100644 index 0000000..ea56bdb --- /dev/null +++ b/test-common.c @@ -0,0 +1,33 @@ +/* See LICENSE file for copyright and license details. */ +#include "test-common.h" + + +#if LIBGEOME_LAST_DATUM != LIBGEOME_DATUM_ALTITUDE +# warning struct libgeome_data has been updated, test_common_print() is out of date +#endif + + +void +test_common_init(struct libgeome_context *ctx_out, struct libgeome_data *data_out, const char *procname) +{ + libgeome_basic_context(ctx_out, procname); + ctx_out->print_debug = ctx_out->print_error; + data_out->requested_data = (LIBGEOME_LAST_DATUM - 1U) | LIBGEOME_LAST_DATUM; +} + + +void +test_common_print(struct libgeome_data *data) +{ + if (!data->requested_data) + printf("No data retrieved"); + + if (data->requested_data & LIBGEOME_DATUM_LATITUDE) + printf("Latitude: %g\n", data->latitude); + if (data->requested_data & LIBGEOME_DATUM_LONGITUDE) + printf("Longitude: %g\n", data->longitude); + if (data->requested_data & LIBGEOME_DATUM_ALTITUDE) + printf("Altitude: %g\n", data->altitude); + + data->requested_data = (LIBGEOME_LAST_DATUM - 1U) | LIBGEOME_LAST_DATUM; +} |