Add missing trailing dot in sentences
[viking/guyou.git] / test / check_degrees_conversions.sh
bloba6a0b8887a0274a57f3c9cb32fdaa5ae3c790ae5
1 #!/bin/sh
3 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 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