aboutsummaryrefslogtreecommitdiff
path: root/tests/input-test.scm
diff options
context:
space:
mode:
authorGene Pasquet <dev@etenil.net>2026-04-18 05:59:07 +0100
committerGene Pasquet <dev@etenil.net>2026-04-18 05:59:07 +0100
commit84f251ee6e829d33a4f29aa4043924023a378724 (patch)
treeab03d18fa192303bf2e1758743ac16c11d9da87f /tests/input-test.scm
parentc2085be2dd2a0cb3da05991847e35080915e547e (diff)
Re-format
Diffstat (limited to 'tests/input-test.scm')
-rw-r--r--tests/input-test.scm34
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/input-test.scm b/tests/input-test.scm
index 2903cbb..39316c4 100644
--- a/tests/input-test.scm
+++ b/tests/input-test.scm
@@ -63,7 +63,7 @@
;; In state2, up is held but was not held before -> pressed
(test-assert "pressed when current=#t and previous=#f"
- (input-pressed? state2 'up))))
+ (input-pressed? state2 'up))))
;; Test: input-released? detection
(test-group "input-released?"
@@ -79,14 +79,14 @@
(test "not released when held" #f (input-released? state-held 'up))
(test-assert "released when current=#f and previous=#t"
- (input-released? state-released 'up))))
+ (input-released? state-released 'up))))
;; Test: input-any-pressed?
(test-group "input-any-pressed?"
(let ((state1 (create-input-state *default-input-config*)))
(test "no actions pressed in initial state"
- #f
- (input-any-pressed? state1 *default-input-config*))))
+ #f
+ (input-any-pressed? state1 *default-input-config*))))
;; Test: input-state->string formatting
(test-group "input-state->string"
@@ -95,8 +95,8 @@
(test-assert "returns a string" (string? str))
(test-assert "contains [Input:" (string-contains str "[Input:"))
(test-assert "empty state shows no actions"
- (or (string-contains str "[]")
- (string-contains str "[Input: ]")))))
+ (or (string-contains str "[]")
+ (string-contains str "[Input: ]")))))
;; Test: state transitions
(test-group "state-transitions"
@@ -119,13 +119,13 @@
(input-state-current state2))))
(test-assert "up still held in state3" (input-held? state3 'up))
(test "up not pressed in state3 (already was pressed)"
- #f
- (input-pressed? state3 'up)))))
+ #f
+ (input-pressed? state3 'up)))))
(define (make-physics-entity)
(entity-set-many (make-entity 0 0 16 16)
- `((#:vx . 0) (#:vy . 0)
- (#:input-map . ((left . (-2 . 0)) (right . (2 . 0)))))))
+ `((#:vx . 0) (#:vy . 0)
+ (#:input-map . ((left . (-2 . 0)) (right . (2 . 0)))))))
;; Test: apply-input-to-entity applies input to entity
(test-group "apply-input-to-entity"
@@ -169,13 +169,13 @@
(test-group "custom-input-config"
(let* ((cfg (make-input-config
- actions: '(jump shoot)
- keyboard-map: '((space . jump) (f . shoot))
- joy-button-map: '()
- controller-button-map: '()
- joy-axis-bindings: '()
- controller-axis-bindings: '()
- deadzone: 8000))
+ actions: '(jump shoot)
+ keyboard-map: '((space . jump) (f . shoot))
+ joy-button-map: '()
+ controller-button-map: '()
+ joy-axis-bindings: '()
+ controller-axis-bindings: '()
+ deadzone: 8000))
(state (create-input-state cfg)))
(test-assert "custom config creates valid state" (input-state? state))
(test "jump is false" #f (input-held? state 'jump))