
# GPX
rm -f ${TMPDIR}/gl.gpx ${TMPDIR}/gpx.wpt
gpsbabel -i geo -f ${REFERENCE}/geocaching.loc -o gpx -F ${TMPDIR}/gl.gpx
gpsbabel -i gpx -f ${TMPDIR}/gl.gpx -o geo -F ${TMPDIR}/gpx.wpt
compare ${TMPDIR}/gpx.wpt ${TMPDIR}/gpx.wpt

rm -f ${TMPDIR}/gtrnctr_power.gpx
gpsbabel -i gtrnctr -f ${REFERENCE}/track/gtrnctr_power.tcx -o gpx,garminextensions=1 -F ${TMPDIR}/gtrnctr_power.gpx
compare  ${REFERENCE}/track/gtrnctr_power.gpx ${TMPDIR}/gtrnctr_power.gpx

rm -f ${TMPDIR}/tpx-sample.gpx
gpsbabel -i gpx -f ${REFERENCE}/track/gpx_garmin_extensions.gpx -o gpx,garminextensions -F ${TMPDIR}/tpx-sample.gpx
compare ${REFERENCE}/track/gpx_garmin_extensions.gpx ${TMPDIR}/tpx-sample.gpx

rm -f ${TMPDIR}/basecamp~gpx.gpx
gpsbabel -i gpx -f ${REFERENCE}/basecamp.gpx -o gpx -F ${TMPDIR}/basecamp~gpx.gpx
compare ${REFERENCE}/basecamp~gpx.gpx ${TMPDIR}/basecamp~gpx.gpx

rm -f ${TMPDIR}/extensiondata.gpx
gpsbabel -i unicsv -f ${REFERENCE}/extensiondata.unicsv -x transform,trk=wpt -o gpx,garminextensions -F ${TMPDIR}/extensiondata.gpx
compare ${REFERENCE}/extensiondata~unicsv.gpx ${TMPDIR}/extensiondata.gpx

# Read, write GPX file with times that don't fit in time_t, subsecond.
gpsbabel -i gpx -f ${REFERENCE}/bigtime.gpx -o gpx -F ${TMPDIR}/bigtime.gpx
compare ${REFERENCE}/bigtime.gpx ${TMPDIR}/bigtime.gpx

# test standard output
rm -f ${TMPDIR}/basecamp~gpx_so.gpx
gpsbabel -i gpx -f ${REFERENCE}/basecamp.gpx -o gpx -F - 1> ${TMPDIR}/basecamp~gpx_so.gpx
compare ${REFERENCE}/basecamp~gpx.gpx ${TMPDIR}/basecamp~gpx_so.gpx

# test standard input
rm -f ${TMPDIR}/basecamp~gpx_si.gpx
gpsbabel -i gpx -f - -o gpx -F ${TMPDIR}/basecamp~gpx_si.gpx 0< ${REFERENCE}/basecamp.gpx
compare ${REFERENCE}/basecamp~gpx.gpx ${TMPDIR}/basecamp~gpx_si.gpx

# test unknown tags
rm -f ${TMPDIR}/unknowntag.gpx
gpsbabel -i gpx -f ${REFERENCE}/unknowntag.gpx -o gpx -F ${TMPDIR}/unknowntag.gpx
compare ${REFERENCE}/unknowntag~gpx.gpx ${TMPDIR}/unknowntag.gpx

rm -f ${TMPDIR}/unknowntag2.gpx
gpsbabel -i gpx -f ${REFERENCE}/unknowntag2.gpx -o gpx -F ${TMPDIR}/unknowntag2.gpx
compare ${REFERENCE}/unknowntag2~gpx.gpx ${TMPDIR}/unknowntag2.gpx

# test passing of globals from input to output
# gpx 1.0
rm -f ${TMPDIR}/global.gpx
gpsbabel -i gpx -f ${REFERENCE}/global.gpx -o gpx -F ${TMPDIR}/global.gpx
compare ${REFERENCE}/global.gpx ${TMPDIR}/global.gpx
# gpx 1.1 (only partially implemented)
rm -f ${TMPDIR}/metadata.gpx
gpsbabel -i gpx -f ${REFERENCE}/metadata.gpx -o gpx -F ${TMPDIR}/metadata.gpx
compare ${REFERENCE}/metadata~gpx.gpx ${TMPDIR}/metadata.gpx

# output ilinks if gpx garamextensions specified
gpsbabel -i gdb,dropwpt -f ${REFERENCE}/gdb-sample-v3-ilinks.gdb -o gpx,garminextensions -F ${TMPDIR}/gdb-sample-v3-ilinks.gpx
compare ${REFERENCE}/gdb-sample-v3-ilinks.gpx ${TMPDIR}/gdb-sample-v3-ilinks.gpx

# use declared namespace prefixes in gpx reader
gpsbabel -t -i gpx -f ${REFERENCE}/track/garminconnect.gpx -o unicsv,utc=0 -F ${TMPDIR}/garminconnect.csv
compare ${REFERENCE}/track/garminconnect.csv ${TMPDIR}/garminconnect.csv
