test: add basic unit-test for core-ast

This commit is contained in:
Simon Cruanes 2022-07-27 21:41:59 -04:00
parent 410c5b1ee2
commit e52a7ac0ea
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
3 changed files with 21 additions and 0 deletions

4
unittest/core-ast/dune Normal file
View file

@ -0,0 +1,4 @@
(tests
(names t1)
(flags :standard -open Sidekick_util)
(libraries containers sidekick.util sidekick.core-ast))

View file

@ -0,0 +1,4 @@
type0 : type
typeof(type0) : type_1
type tower: [type;type_1;type_2;type_3;type_4;type_5;type_6;type_7;type_8;
type_9]

13
unittest/core-ast/t1.ml Normal file
View file

@ -0,0 +1,13 @@
open Sidekick_core_ast
let store = Store.create ()
let t0 = type_ store
let () = Fmt.printf "type0 : %a@." pp_debug t0
let () = Fmt.printf "typeof(type0) : %a@." pp_debug (get_ty store t0)
let l =
CCSeq.unfold (fun ty -> Some (ty, get_ty store ty)) t0
|> CCSeq.take 10 |> CCSeq.to_list
let () = Fmt.printf "type tower: %a@." (Fmt.Dump.list pp_debug) l
let () = assert (equal (type_ store) (type_ store))