static void TestSimpleTask() { OrderedTask task(task_behaviour); const StartPoint tp1(new LineSectorZone(wp1.location), wp1, task_behaviour, ordered_task_behaviour.start_constraints); task.Append(tp1); const FinishPoint tp2(new LineSectorZone(wp3.location), wp3, task_behaviour, ordered_task_behaviour.finish_constraints, false); task.Append(tp2); ok1(task.CheckTask()); AircraftState aircraft; aircraft.Reset(); aircraft.location = MakeGeoPoint(0, 44.5); aircraft.altitude = fixed(1700); task.Update(aircraft, aircraft, glide_polar); const GeoVector tp1_to_tp2 = wp1.location.DistanceBearing(wp3.location); const TaskStats &stats = task.GetStats(); ok1(stats.task_valid); ok1(!stats.task_started); ok1(!stats.task_finished); ok1(!stats.flight_mode_final_glide); ok1(equals(stats.distance_nominal, tp1_to_tp2.distance)); ok1(equals(stats.distance_min, tp1_to_tp2.distance)); ok1(equals(stats.distance_max, tp1_to_tp2.distance)); CheckLeg(tp1, aircraft, stats); CheckTotal(aircraft, stats, tp1, tp1, tp2); }
static void TestHighTPFinal() { const fixed width(1); OrderedTask task(task_behaviour); const StartPoint tp1(new LineSectorZone(wp1.location, width), wp1, task_behaviour, ordered_task_settings.start_constraints); task.Append(tp1); const Waypoint wp3b = MakeWaypoint(wp3, 1500); const ASTPoint tp2(new LineSectorZone(wp3b.location, width), wp3b, task_behaviour); task.Append(tp2); const Waypoint wp5b = MakeWaypoint(wp5, 200); const FinishPoint tp3(new LineSectorZone(wp5b.location, width), wp5b, task_behaviour, ordered_task_settings.finish_constraints, false); task.Append(tp3); task.SetActiveTaskPoint(1); task.UpdateGeometry(); ok1(task.CheckTask()); AircraftState aircraft; aircraft.Reset(); aircraft.location = wp1.location; aircraft.altitude = fixed(1200); task.Update(aircraft, aircraft, glide_polar); const TaskStats &stats = task.GetStats(); ok1(stats.task_valid); ok1(!stats.start.task_started); ok1(!stats.task_finished); ok1(!stats.flight_mode_final_glide); CheckLeg(tp2, aircraft, stats); CheckTotal(aircraft, stats, tp1, tp2, tp3); }