flappy-ball/flappy-ball-test.lisp

40 lines
1 KiB
Common Lisp
Raw Permalink Normal View History

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))))
2024-04-27 13:34:41 +02:00
(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))))
2024-04-27 09:47:19 +02:00
2024-05-03 01:31:27 +02:00
(test test-high-score
(let ((high-score (make-high-score 10 (get-universal-time))))
(is (= (high-score-value high-score) 10))
(is (< (- (get-universal-time) (high-score-time high-score)) 1))))
2024-04-27 09:47:19 +02:00
(run-all-tests)