2024-04-18 21:50:05 +02:00
|
|
|
(defpackage flappy-ball-test
|
|
|
|
(:use :cl :fiveam :flappy-ball)
|
|
|
|
(:export #:flappy-ball-test))
|
|
|
|
|
|
|
|
(in-package :flappy-ball-test)
|
|
|
|
|
2024-04-25 23:05:15 +02:00
|
|
|
(def-suite all-tests)
|
|
|
|
|
|
|
|
(in-suite all-tests)
|
|
|
|
|
2024-04-27 09:47:19 +02:00
|
|
|
(test test-ball
|
|
|
|
(let ((ball (make-ball 100 300 5.0 10)))
|
|
|
|
(is (= (ball-x ball) 100))
|
|
|
|
(is (= (ball-y ball) 300))
|
|
|
|
(is (= (ball-size ball) 10))
|
|
|
|
(is (= (ball-velocity ball) 5.0))))
|
|
|
|
|
|
|
|
(test test-ball-move
|
|
|
|
(let ((ball (make-ball 100 300 5.0 10)))
|
|
|
|
(is (= (ball-x (ball-move ball 1 600)) 100))
|
|
|
|
(is (= (ball-y (ball-move ball 1 600)) 305))
|
|
|
|
(is (= (ball-size (ball-move ball 1 600)) 10))
|
|
|
|
(is (= (ball-velocity (ball-move ball 1 600)) 6.0))))
|
|
|
|
|
|
|
|
|
|
|
|
(run-all-tests)
|
|
|
|
```
|
|
|
|
|