diff options
Diffstat (limited to 'tests/physics-test.scm')
| -rw-r--r-- | tests/physics-test.scm | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/physics-test.scm b/tests/physics-test.scm index e22c2fd..54c71ea 100644 --- a/tests/physics-test.scm +++ b/tests/physics-test.scm @@ -303,16 +303,16 @@ (test "pushed above floor" 28 (entity-ref result #:y)) (test "vy zeroed" 0 (entity-ref result #:vy)))))) - (test-group "high-velocity fall: snaps to first solid row, not last" - ;; Regression: entity falls fast enough that apply-velocity-y moves it into TWO solid rows. - ;; Rows 2 and 3 are both solid (tileheight=16, so row 2 = y=[32,47], row 3 = y=[48,63]). - ;; After apply-velocity-y the entity lands at y=34 (overlapping both rows 2 and 3). - ;; Correct: snap to top of row 2 → y=16. Bug was: fold overwrote row 2 snap with row 3 snap → y=32 (inside row 2). - (let* ((tm (make-test-tilemap '((0 0 0) (0 0 0) (1 0 0) (1 0 0) (0 0 0)))) - (e (entity #:type 'player #:x 0 #:y 34 #:width 16 #:height 16 #:vx 0 #:vy 20))) - (let ((result (resolve-tile-collisions-y (test-scene tilemap: tm) e 0))) - (test "snapped to first solid row" 16 (entity-ref result #:y)) - (test "vy zeroed" 0 (entity-ref result #:vy))))) +(test-group "high-velocity fall: snaps to first solid row, not last" + ;; Regression: entity falls fast enough that apply-velocity-y moves it into TWO solid rows. + ;; Rows 2 and 3 are both solid (tileheight=16, so row 2 = y=[32,47], row 3 = y=[48,63]). + ;; After apply-velocity-y the entity lands at y=34 (overlapping both rows 2 and 3). + ;; Correct: snap to top of row 2 → y=16. Bug was: fold overwrote row 2 snap with row 3 snap → y=32 (inside row 2). + (let* ((tm (make-test-tilemap '((0 0 0) (0 0 0) (1 0 0) (1 0 0) (0 0 0)))) + (e (entity #:type 'player #:x 0 #:y 34 #:width 16 #:height 16 #:vx 0 #:vy 20))) + (let ((result (resolve-tile-collisions-y (test-scene tilemap: tm) e 0))) + (test "snapped to first solid row" 16 (entity-ref result #:y)) + (test "vy zeroed" 0 (entity-ref result #:vy))))) ;; Integration test: simulate the actual game physics loop (test-group "multi-frame physics simulation" |
