@@ -41,12 +41,11 @@ def setup_free_kick_play(
4141 )
4242
4343
44- # Test 1: Direct Shot
45- # FSM path: SetupPositionState -> ShootState -> X
46- # Triggers: setupDone=True, shotFound=True, shotDone=True
4744def test_free_kick_play_direct_shot (simulated_test_runner ):
4845 """Ball in enemy half with no enemies blocking the goal so kicker shoots directly.
49- Validates FriendlyTeamEventuallyScored.
46+ FSM: SetupPositionState -> ShootState -> X
47+ Triggers: setupDone=True, shotFound=True, shotDone=True
48+ Validates: FriendlyTeamEventuallyScored.
5049 """
5150 field = tbots_cpp .Field .createSSLDivisionBField ()
5251 ball_initial_pos = tbots_cpp .Point (1.5 , 0.0 )
@@ -87,12 +86,11 @@ def setup(*args):
8786 )
8887
8988
90- # Test 2: Pass Completes
91- # FSM path: SetupPositionState -> AttemptPassState -> PassState -> X
92- # Triggers: setupDone=True, shotFound=False, passFound=True, passDone=True
9389def test_free_kick_play_pass_completes (simulated_test_runner ):
9490 """Goal is blocked by enemy robots and blue receivers are open in the enemy half. Pass will be made.
95- Validates that a receiver eventually gets possession.
91+ FSM path: SetupPositionState -> AttemptPassState -> PassState -> X
92+ Triggers: setupDone=True, shotFound=False, passFound=True, passDone=True
93+ Validates: Receiver eventually gets possession.
9694 """
9795 field = tbots_cpp .Field .createSSLDivisionBField ()
9896 ball_initial_pos = tbots_cpp .Point (- 0.5 , 0.0 )
@@ -137,18 +135,13 @@ def setup(*args):
137135 )
138136
139137
140- # Test 3: Abort Pass and Retry
141- # FSM path: SetupPositionState -> AttemptPassState -> PassState
142- # -> AttemptPassState -> ... -> X (chip or second pass)
143- # Triggers: passFound=True, shouldAbortPass=True
144- # shouldAbortPass fires when ratePass() drops below abs_min_pass_score (0.05)
145-
146-
147138def test_free_kick_play_abort_pass_and_retry (simulated_test_runner ):
148139 """Ball in friendly half so shotFound is reliably False.
149140 A yellow robot sits directly on the pass lane from the ball to receiver B,
150141 so ratePass() scores the found pass below abs_min_pass_score (0.05).
151- Validates ball eventually moves via chip or a cleared second-attempt pass.
142+ FSM path: SetupPositionState -> AttemptPassState -> PassState -> AttemptPassState -> ... -> X (chip or second pass)
143+ Triggers: passFound=True, shouldAbortPass=True
144+ Validates: ball eventually moves via chip or a cleared second-attempt pass.
152145 """
153146 field = tbots_cpp .Field .createSSLDivisionBField ()
154147 # (-0.5, 0) shot angle to enemy goal about 4 < min_open_angle_for_shot_deg (6)
@@ -194,13 +187,12 @@ def setup(*args):
194187 )
195188
196189
197- # Test 4: Timeout -> Chip
198- # FSM path: SetupPositionState -> AttemptPassState -> ChipState -> X
199- # Triggers: setupDone=True, shotFound=False, passFound=False (timeout), chipDone=True
200190def test_free_kick_play_chip_on_timeout (simulated_test_runner ):
201191 """Goal is blocked and all receiver zones are covered by enemies. passFound never becomes True,
202192 so timeExpired fires and the FSM chips.
203- Validates that the ball eventually moves from rest via the chip.
193+ FSM path: SetupPositionState -> AttemptPassState -> ChipState -> X
194+ Triggers: setupDone=True, shotFound=False, passFound=False (timeout), chipDone=True
195+ Validates: Ball eventually moves above a threshold speed.
204196 """
205197 field = tbots_cpp .Field .createSSLDivisionBField ()
206198 ball_initial_pos = tbots_cpp .Point (- 1.0 , 0.0 )
@@ -243,27 +235,22 @@ def setup(*args):
243235 )
244236
245237
246- # Test 5: Near-Sideline
247- # Exercises all FSM paths with ball at field edges
248238@pytest .mark .parametrize (
249239 "ball_initial_pos,must_score" ,
250240 [
251- # Enemy half, near sideline for direct shot
252- (tbots_cpp .Point (1.5 , 0.0 ), True ),
253- # Friendly half, near sideline for pass or chip
254- (tbots_cpp .Point (- 1.5 , - 2.75 ), False ),
255- # Near corner for pass or chip
256- (tbots_cpp .Point (1.5 , - 3.0 ), False ),
257- # Enemy half, center for direct shot likely
258- (tbots_cpp .Point (1.5 , - 0.5 ), True ),
241+ (tbots_cpp .Point (1.5 , 0.0 ), True ), # Enemy half, near sideline for direct shot
242+ (
243+ tbots_cpp .Point (- 1.5 , - 2.75 ),
244+ False ,
245+ ), # Friendly half, near sideline for pass or chip
246+ (tbots_cpp .Point (1.5 , - 3.0 ), False ), # Near corner for pass or chip
247+ (tbots_cpp .Point (1.5 , - 0.5 ), True ), # Enemy half, center for direct shot likely
259248 ],
260249)
261250def test_free_kick_play_near_sideline (
262251 simulated_test_runner , ball_initial_pos , must_score
263252):
264- """Parametrized test covering ball positions at and near field edges. Requires score if must_score is True, otherwise
265- moving the ball will pass the test.
266- """
253+ """Parametric generalized free kick tests. Requires score if must_score is True, otherwise moving the ball will pass the test."""
267254 field = tbots_cpp .Field .createSSLDivisionBField ()
268255
269256 blue_bots = [
0 commit comments