Tests and csm build options
This commit is contained in:
parent
ed879f61a8
commit
6ec898f96c
5 changed files with 49 additions and 5 deletions
37
test/engine.scm
Normal file
37
test/engine.scm
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
(module (test engine) ()
|
||||
(import scheme
|
||||
(chicken base)
|
||||
(engine core)
|
||||
(srfi 69)
|
||||
(srfi 78)
|
||||
(srfi 99))
|
||||
|
||||
(define-record-type <point> (make-point x y) point? (x point-x) (y point-y))
|
||||
|
||||
;; Entity addition and world state modification
|
||||
(check (hash-table-size world) => 0) ;; World state starts empty
|
||||
(check (hash-table-size component-sets) => 0)
|
||||
|
||||
(create-named-entity 'ball (make-point 1 1))
|
||||
(check (hash-table-size world) => 0) ;; World state empty before next frame
|
||||
(check (hash-table-size component-sets) => 0)
|
||||
|
||||
(resolve-queues) ;; TODO: swap this for (next-frame) and remove (resolve-queues) once we have a full game loop setup
|
||||
(check (hash-table-size world) => 1) ;; World state updates after next frame
|
||||
(check (hash-table-size component-sets) => 1)
|
||||
(check (hash-table-exists? world 'ball) => #t)
|
||||
(check (hash-table-exists? component-sets '<point>) => #t)
|
||||
|
||||
(clear-world)
|
||||
(check (hash-table-size world) => 1) ;; World state does not immediately clear
|
||||
|
||||
(resolve-queues)
|
||||
(check (hash-table-size world) => 0) ;; World state is empty after clear
|
||||
(check (hash-table-size component-sets) => 1) ;; Component-sets doesn't clear
|
||||
|
||||
(create-named-entity 'ball (make-point 1 1))
|
||||
(resolve-queues)
|
||||
(remove-entity 'ball)
|
||||
(resolve-queues)
|
||||
(check (hash-table-size world) => 0) ;; Entity is properly removed
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue