Add missing include glib/gprintf.h
[viking.git] / test / check_degrees_conversions.sh
blobf63392bb34288fe7852f7eba1d249617332ccd89
1 #!/bin/sh
3 function check_success()
5 expected=$1
6 shift
7 for value in "$@"
8 do
9 result=`./degrees_converter "$value" | cut -d' ' -f3`
10 diff=`echo "$result - $expected" | bc -l`
11 if [ $diff != 0 ]
12 then
13 echo "$value -> $result != $expected"
14 exit 1
16 done
19 function check_failure()
21 expected=$1
22 shift
23 for value in "$@"
25 result=`./degrees_converter "$value" | cut -d' ' -f3`
26 diff=`echo "$result - $expected" | bc -l`
27 if [ $diff = 0 ]
28 then
29 echo "$value -> $result = $expected"
30 exit 1
32 done
35 check_success 3.5 3.5 3°30 "3°30'0.00"
36 check_failure 3.5 3.6 3°40 "3°30'1.00"
38 exit 0