flappy-ball/flappy-ball-test.lisp
2024-04-27 13:34:41 +02:00

33 lines
851 B
Common Lisp

(defpackage flappy-ball-test
(:use :cl :fiveam :flappy-ball)
(:export #:flappy-ball-test))
(in-package :flappy-ball-test)
(def-suite all-tests)
(in-suite all-tests)
(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))))
(test test-pipe
(let ((pipe (make-pipe 10 200 100 20)))
(is (= (pipe-x pipe) 10))
(is (= (pipe-height pipe) 200))
(is (= (pipe-gap pipe) 100))
(is (= (pipe-width pipe) 20))))
(run-all-tests)