garden/test/types.fnl

20 lines
577 B
Plaintext
Raw Normal View History

2023-12-09 03:36:07 +00:00
(import-macros {: def : q : ttype : static : compile : uncompile} :terra)
(local t (require :faith))
(local tests {})
(fn tests.test-pointer []
(t.= :&int8 (tostring (ttype [int8])))
(t.= :&int8 (tostring (ttype (& int8))))
(t.= :&&int8 (tostring (ttype [[int8]])))
(t.= :&&int8 (tostring (ttype (& [int8]))))
(t.= :&&int8 (tostring (ttype (& (& int8))))))
(fn tests.test-array []
(t.= "int32[16]" (tostring (ttype [int32 16]))))
(fn tests.test-fnptr []
(t.= "&{&int8,int8} -> int8"
(tostring (ttype (-> [int8] int8 : int8)))))
tests