tests: shared-vertex both-arms test, door-closed-on-token pin (Q14), KNOWN LIMITATION token-on-wall pin
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -39,6 +39,19 @@ suite "visibility":
|
||||
check sees(w, (0.0, 0.0), (70.0, 5.0))
|
||||
check not sees(w, (0.0, 0.0), (70.0, -5.0))
|
||||
|
||||
test "shared vertex: both arms required (mutation d1/d2)":
|
||||
# L corner at (50,0). The viewer's ray through the vertex splits the shadow: points above it are
|
||||
# shadowed only by the vertical arm, points below it only by the horizontal arm. Removing either arm
|
||||
# makes one assertion fail (tools/mutation.sh d1/d2 edit the SHARED-VERTEX line below).
|
||||
let arm1 = W(50, -50, 50, 0) # vertical
|
||||
let arm2 = W(50, 0, 100, 0) # horizontal
|
||||
let w = @[arm1, arm2] # SHARED-VERTEX
|
||||
let v: Vec = (0.0, 25.0) # ray v->(50,0) has slope -1/2: (70,-10) is on it
|
||||
check visibilityPolygon(v, w, 500).hasVertex((50.0, 0.0))
|
||||
check not sees(w, v, (70.0, -11.0)) # above the vertex ray: crosses x=50 at y<0, only arm1 stops it
|
||||
check not sees(w, v, (70.0, -9.0)) # below the vertex ray: crosses y=0 at x>50, only arm2 stops it
|
||||
check sees(w, v, (70.0, 9.0)) # control: well clear of both arms, not a blanket "blocked"
|
||||
|
||||
test "'<' apex: ray through the shared tip must not leak":
|
||||
for flip in [false, true]: # each wall in both directions: the tip is an upper end of one and a lower end of the other
|
||||
let w = if flip: @[W(100, 0, 50, -40), W(100, 0, 50, 40)] else: @[W(50, -40, 100, 0), W(50, 40, 100, 0)]
|
||||
@@ -236,3 +249,28 @@ suite "token clearance (r=20)":
|
||||
let w = @[W(0, 0, 100, 0)]
|
||||
check not moveBlocked(w, (50.0, 5.0), (50.0, 40.0), r)
|
||||
check moveBlocked(w, (50.0, 5.0), (50.0, 15.0), r)
|
||||
|
||||
suite "door/wall closing on a token (M1 pins current behaviour)":
|
||||
test "door closed on a token: Q14 undecided, DESIGN 5.4 vs 12 H2 conflict":
|
||||
# DESIGN section 14 Q14 (allow walk-out / auto-nudge / refuse edit) is OPEN. DESIGN 5.4 says the token "may step
|
||||
# perpendicular out"; H2 says the server keeps tokens >= r off walls. Pinned: current moveBlocked only.
|
||||
const r = 20.0
|
||||
let door = @[W(0, -50, 0, 50, door = true)] # closed, token radius 20
|
||||
# token centre 10 off the door (circle overlaps it): may leave to a clear spot, but not cross or stay overlapped
|
||||
check not moveBlocked(door, (10.0, 0.0), (40.0, 0.0), r) # walk away: dest 40 off
|
||||
check moveBlocked(door, (10.0, 0.0), (15.0, 0.0), r) # still overlapping: blocked
|
||||
check moveBlocked(door, (10.0, 0.0), (-40.0, 0.0), r) # through the closed door: blocked
|
||||
var op = door
|
||||
op[0].open = true # opening it lifts everything
|
||||
check not moveBlocked(op, (10.0, 0.0), (-40.0, 0.0), r)
|
||||
|
||||
test "KNOWN LIMITATION: token exactly on a wall cannot move off it":
|
||||
# prototype-server-vision/HANDOFF.md ("token exactly on a wall cannot move off it", inclusive segsCross);
|
||||
# DESIGN 5.4 / H2 / Q14. A future fix deliberately flips these checks.
|
||||
let wall = W(0, -50, 0, 50)
|
||||
check moveBlocked([wall], (0.0, 10.0), (30.0, 10.0)) # perpendicular, away
|
||||
check moveBlocked([wall], (0.0, 10.0), (-30.0, 10.0))
|
||||
check moveBlocked([wall], (0.0, 10.0), (0.0, 80.0)) # along the wall, off its end
|
||||
check moveBlocked([wall], (0.0, 10.0), (1.0, 10.0)) # one pixel
|
||||
check moveBlocked([wall], (0.0, 10.0), (0.0, 10.0)) # even a zero-length move
|
||||
check moveBlocked([wall], (0.0, 10.0), (30.0, 10.0), 20.0) # with a token radius too
|
||||
|
||||
Reference in New Issue
Block a user