garden/test/types.fnl
2023-12-08 22:36:07 -05:00

20 lines
577 B
Fennel

(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