File tree Expand file tree Collapse file tree
test/hyperspace/test/library Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6161 (cond
6262 (> counter max-cycle) [world nil ]
6363 planet [world (:position planet)]
64- player [(kill-player world player) (:position planet )]
64+ player [(kill-player world player) (:position player )]
6565 :else (recur bullet (+ counter 1 )))))))
Original file line number Diff line number Diff line change 77 [hyperspace.library.world :as world]))
88
99(def player-fixture (world/make-player [10 10 ]))
10+ (def player2-fixture (world/make-player [15 15 ]))
1011(def nonexistent-player-fixture (world/make-player [20 20 ]))
1112(def world-fixture (-> (world/create 800 600 )
1213 (assoc :players [player-fixture])))
14+ (def two-player-world-fixture (assoc world-fixture
15+ :players [player-fixture player2-fixture]))
1316
1417(facts " about kill-player function"
1518 (kill-player world-fixture player-fixture) => (assoc world-fixture :players [(assoc player-fixture :status :dead )])
4447 ))
4548
4649(facts " about fire function"
47- ; ; TODO: test shot to player
50+ (let [heading (geometry/heading (:position player-fixture) (:position player2-fixture))
51+ result-player2 (assoc player2-fixture :status :dead )
52+ result-world (assoc two-player-world-fixture :players [player-fixture result-player2])]
53+ (fire two-player-world-fixture player-fixture heading 10 )
54+ => [result-world (:position player2-fixture)])
4855 ; ; TODO: test shot to planet
4956 (fire world-fixture player-fixture 0 10 ) => [world-fixture nil ])
You can’t perform that action at this time.
0 commit comments