improve unittest for core-ast

This commit is contained in:
Simon Cruanes 2022-07-27 22:40:36 -04:00
parent 8950601fb2
commit 2db3343bcd
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 34 additions and 0 deletions

View file

@ -2,3 +2,11 @@ type0 : type
typeof(type0) : type_1 typeof(type0) : type_1
type tower: [type;type_1;type_2;type_3;type_4;type_5;type_6;type_7;type_8; type tower: [type;type_1;type_2;type_3;type_4;type_5;type_6;type_7;type_8;
type_9] type_9]
a: a, b: b, typeof(a): Bool
pi Bool Bool
b2b: (Bool -> Bool)
p(a): p a
p(b): p b
q(a): q a
q(b): q b
typeof(p a): Bool

View file

@ -11,3 +11,29 @@ let l =
let () = Fmt.printf "type tower: %a@." (Fmt.Dump.list pp_debug) l let () = Fmt.printf "type tower: %a@." (Fmt.Dump.list pp_debug) l
let () = assert (equal (type_ store) (type_ store)) let () = assert (equal (type_ store) (type_ store))
let bool = Str_const.const store "Bool" ~ty:(type_ store)
let a = Str_const.const store "a" ~ty:bool
let a' = Str_const.const store "a" ~ty:bool
let b = Str_const.const store "b" ~ty:bool
let () =
Fmt.printf "a: %a, b: %a, typeof(a): %a@." pp_debug a pp_debug b pp_debug
(ty_exn a)
let () = assert (equal a a)
let () = assert (not (equal a b))
let ty_b2b = arrow store bool bool
let () = Fmt.printf "b2b: %a@." pp_debug ty_b2b
let p = Str_const.const store "p" ~ty:ty_b2b
let q = Str_const.const store "q" ~ty:ty_b2b
let pa = app store p a
let pb = app store p b
let qa = app store q a
let qb = app store q b
let () = Fmt.printf "p(a): %a@." pp_debug pa
let () = Fmt.printf "p(b): %a@." pp_debug pb
let () = Fmt.printf "q(a): %a@." pp_debug qa
let () = Fmt.printf "q(b): %a@." pp_debug qb
let () = assert (equal pa (app store p a))
let ty_pa = ty_exn pa
let () = Fmt.printf "typeof(p a): %a@." pp_debug ty_pa