def test_race_moved_leg(self): """ Race task with moved waypoint, should not crash. somehow distances are not completely equal. https://www.soaringspot.com/en_gb/35th-world-gliding-championships-hosin-2018/results/18-meter/task-1-on-2018-07-29/daily """ lcu_lines = [ 'LCU::C290718193533301299000203', 'LCU::C0000000N00000000E', 'LCU::C4908600N01432867E011SP07RADONICE', 'LCU::C4936150N01352917E477ROZMITAL', 'LCU::C4940950N01240067E442PRIMDA', 'LCU::C4915633N01308733E385NYRSKO', 'LCU::C4902383N01429650E001SP01HOSIN', 'LCU::C0000000N00000000E', ] lseeyou_lines = [ 'LSEEYOU OZ=-1,Style=2,SpeedStyle=0,R1=5000m,A1=180,Line=1', 'LSEEYOU OZ=0,Style=1,SpeedStyle=3,R1=500m,A1=180', 'LSEEYOU OZ=1,Style=1,SpeedStyle=3,R1=500m,A1=180', 'LSEEYOU OZ=2,Style=1,SpeedStyle=3,R1=500m,A1=180', 'LSEEYOU OZ=3,Style=3,SpeedStyle=2,R1=5000m,A1=180,Move=1', ] waypoints = get_waypoints(lcu_lines, lseeyou_lines) try: race_task = RaceTask(waypoints) except Exception: self.fail()
def test_get_waypoints(self): lcu_lines = [ 'LCU::C210614200004301299000003', 'LCU::C5228133N00620000ESALLAND FL', 'LCU::C5226783N00620467ESALLAND AF1', 'LCU::C5215000N00609500EDeventer', 'LCU::C5204900N00626800ERuurlo', 'LCU::C5228400N00624600EArchemerberg', 'LCU::C5228133N00620000ESALLAND FL', 'LCU::C5228133N00620000ESALLAND FL' ] lseeyou_lines = [ 'LSEEYOU OZ=-1,Style=2,R1=2500m,A1=35,Line=1', 'LSEEYOU OZ=0,Style=1,R1=500m,A1=180', 'LSEEYOU OZ=1,Style=1,R1=500m,A1=180', 'LSEEYOU OZ=2,Style=1,R1=500m,A1=180', 'LSEEYOU OZ=3,Style=3,R1=500m,A1=180', ] waypoints = get_waypoints(lcu_lines, lseeyou_lines) self.assertEqual(len(waypoints), 5) for waypoint in waypoints: self.assertTrue(isinstance(waypoint, Waypoint)) self.assertEqual(waypoints[2].name, 'Ruurlo')
def test_race_reduced_legs(self): """ Race task with reduced legs, should produce correct distance https://www.soaringspot.com/en_gb/pribina-cup-2018-nitra-2018/results/15-meter/task-1-on-2018-04-02/daily """ lcu_lines = [ 'LCU::C020418195435301299000202', 'LCU::C0000000N00000000E', 'LCU::C4819183N01759550E158LEHOTA', 'LCU::C4907167N01819400E235PUCHOV', 'LCU::C4748117N01842983E271STUROVO', 'LCU::C4816767N01807967E001NITRA', 'LCU::C0000000N00000000E', ] lseeyou_lines = [ 'LSEEYOU OZ=-1,Style=2,SpeedStyle=0,R1=5000m,A1=180,Line=1', 'LSEEYOU OZ=0,Style=1,SpeedStyle=3,R1=500m,A1=180,Reduce=1', 'LSEEYOU OZ=1,Style=1,SpeedStyle=3,R1=500m,A1=180,Reduce=1', 'LSEEYOU OZ=2,Style=3,SpeedStyle=2,R1=3000m,A1=180,Reduce=1', ] waypoints = get_waypoints(lcu_lines, lseeyou_lines) race_task = RaceTask(waypoints) self.assertAlmostEqual(race_task.total_distance / 1000, 305.21, places=2)