@@ -49,7 +49,7 @@ def test_stays_near_coast_and_progresses(self):
4949 self .assertEqual (plan ['mode' ], 'coastal' )
5050 self .assertLess (abs (plan ['endpoint_standoff_m' ]- STANDOFF_M ), 200 )
5151 self .assertGreater (plan ['progress_to_course_waypoint_m' ], 1000 )
52- self .assertLessEqual (plan ['coastal_through_length_m' ], plan ['shortest_checked_length_m' ]* 1.15 )
52+ self .assertLessEqual (plan ['coastal_through_length_m' ], plan ['shortest_checked_length_m' ]* 1.30 )
5353 self .assert_swept_safe (terrain , start , plan )
5454
5555 def test_close_safe_start_is_not_rejected_by_an_extra_grid_ring (self ):
@@ -72,13 +72,15 @@ def test_offshore_start_does_not_take_a_scenic_detour(self):
7272 def test_headland_cannot_be_shortcut (self ):
7373 terrain = grid (headland = True )
7474 start = geo (800 , - 4000 )
75- # Land avoidance remains mandatory when scenic preference is rejected .
75+ # The relaxed coastal preference still requires going around land .
7676 target = geo (800 , 9000 )
7777 plan = coastal_corridor (terrain , SPEC , start , target )
78- self .assertEqual (plan ['mode' ],'detour' )
79- points = np .array ([FORWARD .transform (* p ) for p in plan ['points' ]])
78+ self .assertEqual (plan ['mode' ],'coastal' )
79+ self .assertLessEqual (plan ['coastal_through_length_m' ], plan ['shortest_checked_length_m' ]* 1.30 )
80+ through = plan ['points' ]+ plan ['onward_points' ]
81+ points = np .array ([FORWARD .transform (* p ) for p in through ])
8082 self .assertGreater (points [:, 0 ].max (), 1800 + REGIONAL_BUFFER_M )
81- self .assert_swept_safe (terrain , start , plan )
83+ self .assert_swept_safe (terrain , start , dict ( points = through ) )
8284
8385 def test_closed_bay_requires_an_onward_water_exit (self ):
8486 terrain = grid ()
@@ -164,7 +166,12 @@ def test_distant_coast_approach_advances_without_changing_course_target(self):
164166 self .assertEqual (target ,geo (0 ,- 90000 ))
165167 self .assertIsNone (coastal_approach (geo (800 ,0 ),target ,geo (0 ,0 )))
166168 self .assertIsNone (coastal_approach (geo (30000 ,0 ),geo (90000 ,0 ),geo (0 ,0 )))
167- self .assertIsNone (coastal_approach (start ,target ,geo (0 ,- 12000 )))
169+ relaxed = coastal_approach (start ,target ,geo (0 ,- 12000 ))
170+ self .assertIsNotNone (relaxed )
171+ travel = distance (start ,relaxed )
172+ progress = distance (start ,target )- distance (relaxed ,target )
173+ self .assertGreaterEqual (progress ,travel / 1.30 )
174+ self .assertLess (progress ,travel / 1.15 )
168175 self .assertIsNone (coastal_approach (start ,target ,shore ,progress_target = geo (90000 ,0 )))
169176
170177 def test_real_progressive_shore_excludes_backward_coast (self ):
0 commit comments