-#!/bin/sh
+#!/bin/bash
-DIR=~/src/cc1111/flights
+DIR=~/misc/rockets/flights
-while read flight; do
- baro=`./ao_flight_test_baro -s $DIR/$flight |
- awk '/drogue/ { printf "%s ", $4 }
- /main/ { printf "%s\n", $4 }'`
- full=`./ao_flight_test -s $DIR/$flight |
- awk '/drogue/ { printf "%s ", $4 }
- /main/ { printf "%s\n", $4 }'`
- echo $flight $baro $full
-done < test-flights |
-awk '{ name = $1;
- drogue_error = $2 - $4;
- if (drogue_error < 0) drogue_error = -drogue_error;
- main_error = $3 - $5;
- if (main_error < 0) main_error = -main_error;
- if (drogue_error > 4 || main_error > 4)
- printf ("%s: baro drogue %f main %f. full drogue %f main %f\n",
- name, $2, $3, $4, $5);
- }'
+expect_baro=2
+expect_full=5
+
+bad_baro=0
+bad_full=0
+while read flight description; do
+ if ./ao_flight_test_baro -s -i "$description" $DIR/$flight; then
+ :
+ else
+ : $((bad_baro++))
+ fi
+ if ./ao_flight_test -s -i "$description" $DIR/$flight; then
+ :
+ else
+ : $((bad_full++))
+ fi
+done < test-flights
+echo baro errors $bad_baro expected $expect_baro
+echo full errors $bad_full expected $expect_full
+: $((miss_baro = bad_baro > expect_baro ? bad_baro - expect_baro : expect_baro - bad_baro))
+: $((miss_full = bad_full > expect_full ? bad_full - expect_full : expect_full - bad_full))
+: $((miss = miss_baro + miss_full))
+exit $miss
\ No newline at end of file