jak-project/test/old_goal_tests/goal-test-utils.gc

39 lines
1,011 B
Plaintext
Raw Normal View History

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; COMPILER TEST
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; macro to set up the target and compiler for a test
(defmacro test-setup (expected-value reset-required)
`(begin
;; first, reboot and connect
;; this uses a "compile time" conditional, as (:r) does the reset when it is _compiled_.
;; so we want to compile the (:r) only if the reset is wanted.
(#when ,reset-required (:r))
;; set expected value in GOOS
(seval (define *test-expected* ,expected-value))
;; make sure that *test-result* is an object to avoid typing errors with future tests.
(define-extern *test-result* object)
)
)
(defmacro test-result (value)
value)
(defmacro expect (v1 v2)
`(if (not (eq? ,v1 ,v2))
(format #t "TEST FAILURE!~%")
)
)
(defmacro expect-true (value)
`(if (not (eq? ,value #t))
(format #t "TEST FAILTURE!~%")
)
)
(defmacro expect-false (value)
`(if (not (eq? ,value #f))
(format #t "TEST FAILTURE!~%")
)
)