Explain how to build. Extend git ignore for test directory build output. Improve gpx2gpx to run without the need of a $DISPLAY and to free memory. Fix compiler warnings. Add returns for all main programs. --- .gitignore | 4 ++++ test/README | 7 +++++++ test/degrees_converter.c | 11 +++++++---- test/gpx2gpx.c | 4 +++- test/test_vikgotoxmltool.c | 7 ++++--- 5 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 test/README
diff --git a/.gitignore b/.gitignore index 9b0bd7f..37019c2 100644 --- a/.gitignore +++ b/.gitignore @@ -69,6 +69,10 @@ doc/examples/Makefile.in /test/.deps /test/Makefile.in /test/Makefile +/test/*.o +/test/gpx2gpx +/test/degrees_converter +/test/test_vikgotoxmltool # /po/ /po/Makefile.in.in diff --git a/test/README b/test/README new file mode 100644 index 0000000..42619d1 --- /dev/null +++ b/test/README @@ -0,0 +1,7 @@ +To create the test programs in this directory: + +make check + +To run memory checks eg: + +valgrind --leak-check=full ./gpx2gpx < file.gpx > /dev/null diff --git a/test/degrees_converter.c b/test/degrees_converter.c index 113dbb9..1d976ea 100644 --- a/test/degrees_converter.c +++ b/test/degrees_converter.c @@ -1,3 +1,5 @@ +#include <stdio.h> +#include <stdlib.h> #include "degrees_converters.h" int main(int argc, char *argv[]) { @@ -16,8 +18,9 @@ int main(int argc, char *argv[]) { lonDMS = convert_lon_dec_to_dms(value); printf("'%s' -> %f %s %s %s %s %s %s\n", argv[i], value, latDDD, lonDDD, latDMM, lonDMM, latDMS, lonDMS); - free(latDMS); free(lonDMS); - free(latDMM); free(lonDMM); - free(latDDD); free(lonDDD); + free(latDMS); free(lonDMS); + free(latDMM); free(lonDMM); + free(latDDD); free(lonDDD); } -} \ No newline at end of file + return 0; +} diff --git a/test/gpx2gpx.c b/test/gpx2gpx.c index 0afbb0d..4799dca 100644 --- a/test/gpx2gpx.c +++ b/test/gpx2gpx.c @@ -4,8 +4,10 @@ int main(int argc, char *argv[]) { VikTrwLayer *trw = NULL; - gtk_init (&argc, &argv); + g_type_init (); trw = vik_trw_layer_new(0); a_gpx_read_file(trw, stdin); a_gpx_write_file(trw, stdout); + vik_trw_layer_free (trw); + return 0; } diff --git a/test/test_vikgotoxmltool.c b/test/test_vikgotoxmltool.c index ab05035..d58de91 100644 --- a/test/test_vikgotoxmltool.c +++ b/test/test_vikgotoxmltool.c @@ -39,8 +39,9 @@ int main(int argc, char *argv[]) int i; for (i = 1; i<argc ; i++) { - parse(with_element, argv[i]); - parse(with_attr, argv[i]); - parse(with_xpath, argv[i]); + parse(VIK_GOTO_TOOL(with_element), argv[i]); + parse(VIK_GOTO_TOOL(with_attr), argv[i]); + parse(VIK_GOTO_TOOL(with_xpath), argv[i]); } + return 0; } -- 1.7.1 ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Viking-devel mailing list Viking-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/viking-devel Viking home page: http://viking.sf.net/