diff --git a/flappy-ball-test.lisp b/flappy-ball-test.lisp index 4bd5c7b..2db80ad 100644 --- a/flappy-ball-test.lisp +++ b/flappy-ball-test.lisp @@ -8,3 +8,21 @@ (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)))) + + +(run-all-tests) +``` + diff --git a/flappy-ball.lisp b/flappy-ball.lisp index ecd1025..426259d 100644 --- a/flappy-ball.lisp +++ b/flappy-ball.lisp @@ -1,6 +1,8 @@ (defpackage :flappy-ball (:use :cl :sketch) - (:export :flappy-ball :on-click :on-key :setup)) + (:export :flappy-ball :on-click :on-key :setup + :make-ball :ball-x :ball-y :ball-velocity :ball-size :ball-move :ball-flap :ball-draw + :make-pipe :pipe-x :pipe-height :pipe-gap :pipe-width :pipe-draw :pipe-collides)) (in-package :flappy-ball)