jak-project/test/goalc/source_templates/with_game/test-new-static-basic.gc
water111 11a82bbf08
[Compiler] Add static data features (#162)
* support static pairs

* also support strings

* reorganize static stuff

* add test

* support inlined fields

* add missing type check
2020-12-19 15:21:29 -05:00

29 lines
1.1 KiB
Common Lisp

(start-test "new-static-basic")
(deftype static-test-basic-type (basic)
((s8 int8)
(s16 int16)
(thing basic)
(thing-2 basic)
(thing-3 basic)
(thing-4 float)
(u64 uint64))
)
(define test-static-basic (new 'static 'static-test-basic-type :s8 -122 :s16 -23123 :thing-4 1.2 :u64 434343 :thing 'bean :thing-2 #t :thing-3 #f))
(expect-true (< (the int test-static-basic) (-> debug current))) ;; should be in debug segment?
(expect-true (> (the int test-static-basic) (-> debug base)))
(expect-true (= (-> test-static-basic s8) -122))
(expect-true (= (-> test-static-basic s16) -23123))
(expect-true (= (-> test-static-basic u64) 434343))
(expect-true (eq? (-> test-static-basic thing) 'bean))
(expect-true (eq? (-> test-static-basic thing-2) #t))
(expect-true (eq? (-> test-static-basic thing-3) #f))
(expect-true (neq? (-> test-static-basic thing) 'not-bean))
(expect-true (eq? (-> test-static-basic type symbol) 'static-test-basic-type))
(expect-true (eq? (-> test-static-basic type) static-test-basic-type))
(expect-true (eq? (-> test-static-basic thing-4) 1.2))
(finish-test)