+static int ao_records_read = 0;
+static int ao_eof_read = 0;
+static int ao_flight_ground_accel;
+static int ao_flight_started = 0;
+static int ao_test_max_height;
+static double ao_test_max_height_time;
+static int ao_test_main_height;
+static double ao_test_main_height_time;
+
+void
+ao_test_exit(void)
+{
+ double drogue_error;
+ double main_error;
+
+ if (!ao_test_main_height_time) {
+ ao_test_main_height_time = ao_test_max_height_time;
+ ao_test_main_height = ao_test_max_height;
+ }
+ drogue_error = fabs(ao_test_max_height_time - drogue_time);
+ main_error = fabs(ao_test_main_height_time - main_time);
+ if (drogue_error > emulator_error_max || main_error > emulator_error_max) {
+ printf ("%s %s\n",
+ emulator_app, emulator_name);
+ printf ("\tApogee error %g\n", drogue_error);
+ printf ("\tMain error %g\n", main_error);
+ printf ("\tActual: apogee: %d at %7.2f main: %d at %7.2f\n",
+ ao_test_max_height, ao_test_max_height_time,
+ ao_test_main_height, ao_test_main_height_time);
+ printf ("\tComputed: apogee: %d at %7.2f main: %d at %7.2f\n",
+ drogue_height, drogue_time, main_height, main_time);
+ exit (1);
+ }
+ exit(0);
+}
+