jak-project/test/old_goal_tests/tests/test-packed-inline-array.gc
2020-08-22 22:32:18 -04:00

30 lines
669 B
Plaintext

(test-setup 16 #f)
(deftype small-struct-packed (structure)
((v1 int32)
(v2 int32)
(v3 int32))
(:pack)
)
(deftype small-struct (structure)
((v1 int32)
(v2 int32)
(v3 int32))
(:no-pack)
)
(deftype test-struct-type (basic)
((packed small-struct-packed 10 :inline #t)
(not-packed small-struct 10 :inline #t)
)
)
(let* ((obj (new 'static 'test-struct-type))
(pack-diff (- (the integer (&-> obj packed 1 v1)) (the integer (&-> obj packed 0 v1))))
(unpack-diff (- (the integer (&-> obj not-packed 1 v1)) (the integer (&-> obj not-packed 0 v1))))
)
(expect-true (eq? 12 pack-diff))
unpack-diff
)