#
# Basic FIT tests (read)
#
rm -f ${TMPDIR}/fit-*
gpsbabel -i garmin_fit -f ${REFERENCE}/track/fit-sample.fit -o gpx -F ${TMPDIR}/fit-sameple.gpx
compare ${REFERENCE}/track/fit-sample.gpx ${TMPDIR}/fit-sameple.gpx

gpsbabel -i garmin_fit -f ${REFERENCE}/track/garmin-edge-200-output.fit -o gpx -F ${TMPDIR}/fit-sample.gpx
compare ${REFERENCE}/track/garmin-edge-200-output.gpx ${TMPDIR}/fit-sample.gpx

gpsbabel -i garmin_fit -f ${REFERENCE}/track/garmin-edge-800.fit -o gpx -F ${TMPDIR}/fit-sample-800.gpx
compare ${REFERENCE}/track/garmin-edge-800-output.gpx ${TMPDIR}/fit-sample-800.gpx

gpsbabel -i garmin_fit -f ${REFERENCE}/track/garmin-forerunner-10.fit -o gpx -F ${TMPDIR}/fit-sample-10.gpx
compare ${REFERENCE}/track/garmin-forerunner-10-output.gpx ${TMPDIR}/fit-sample-10.gpx

gpsbabel -i garmin_fit -f ${REFERENCE}/track/garmin-virb-ultra-30.fit -o gpx -F ${TMPDIR}/fit-sample-virb-ultra-30.gpx
compare ${REFERENCE}/track/garmin-virb-ultra-30-output.gpx ${TMPDIR}/fit-sample-virb-ultra-30.gpx

gpsbabel -i garmin_fit,allpoints -f ${REFERENCE}/track/garmin-vivosmart-hr.fit -o gpx,garminextensions -F ${TMPDIR}/fit-sample-vivosmart-hr.gpx
compare ${REFERENCE}/track/garmin-vivosmart-hr.gpx ${TMPDIR}/fit-sample-vivosmart-hr.gpx

gpsbabel -i garmin_fit -f ${REFERENCE}/track/wahoo-element-bolt.fit -o gpx -F ${TMPDIR}/fit-sample-wahoo-element-bolt.gpx
compare ${REFERENCE}/track/wahoo-element-bolt.gpx ${TMPDIR}/fit-sample-wahoo-element-bolt.gpx

gpsbabel -i garmin_fit -f ${REFERENCE}/track/garmin-oregon-700.fit -o gpx -F ${TMPDIR}/fit-sample-garmin-oregon-700.gpx
compare ${REFERENCE}/track/garmin-oregon-700-output.gpx ${TMPDIR}/fit-sample-garmin-oregon-700.gpx

gpsbabel -i garmin_fit,recoverymode -f ${REFERENCE}/track/lezyne_super_gps-garmin_fit-sample-bad-endian.fit -o gpx -F ${TMPDIR}/lezyne_super_gps-garmin_fit-sample-bad-endian.gpx 2>/dev/null
compare ${REFERENCE}/track/lezyne_super_gps-garmin_fit-sample-bad-endian.gpx ${TMPDIR}/lezyne_super_gps-garmin_fit-sample-bad-endian.gpx

# fitlocations-sample.fit is from a Garmin Edge Explore, edited to remove sensitive data.
gpsbabel -i garmin_fit -f ${REFERENCE}/track/fitlocations-sample.fit -o gpx -F ${TMPDIR}/fitlocations-sample.gpx
compare ${REFERENCE}/track/fitlocations-sample.gpx ${TMPDIR}/fitlocations-sample.gpx

gpsbabel -i garmin_fit -f ${REFERENCE}/Lctns_Instinct.fit -o gpx -F ${TMPDIR}/Lctns_Instinct.gpx
compare ${REFERENCE}/Lctns_Instinct.gpx ${TMPDIR}/Lctns_Instinct.gpx

#
# Basic FIT tests (write)
#
gpsbabel -i gpx -f ${REFERENCE}/track/fitwrite-track.gpx -o garmin_fit -F ${TMPDIR}/fitwrite-track.fit
bincompare ${REFERENCE}/track/fitwrite-track.fit ${TMPDIR}/fitwrite-track.fit
