mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-06 11:15:43 -05:00
test: add basic unit-test for core-ast
This commit is contained in:
parent
410c5b1ee2
commit
e52a7ac0ea
3 changed files with 21 additions and 0 deletions
4
unittest/core-ast/dune
Normal file
4
unittest/core-ast/dune
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(tests
|
||||
(names t1)
|
||||
(flags :standard -open Sidekick_util)
|
||||
(libraries containers sidekick.util sidekick.core-ast))
|
||||
4
unittest/core-ast/t1.expected
Normal file
4
unittest/core-ast/t1.expected
Normal 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
13
unittest/core-ast/t1.ml
Normal 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))
|
||||
Loading…
Add table
Reference in a new issue