test(lua): add integer datatype test
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
6587d0f8f3
commit
cba52b76c7
1 changed files with 19 additions and 0 deletions
19
tests/lua/int1.lua
Normal file
19
tests/lua/int1.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
local env = environment()
|
||||
local nat = Const("nat")
|
||||
local int = Const("int")
|
||||
|
||||
env = add_inductive(env,
|
||||
"nat", Type,
|
||||
"zero", nat,
|
||||
"succ", mk_arrow(nat, nat))
|
||||
|
||||
env = add_inductive(env,
|
||||
"int", Type,
|
||||
"pos", mk_arrow(nat, int),
|
||||
"neg", mk_arrow(nat, int))
|
||||
function display_type(env, t)
|
||||
print(tostring(t) .. " : " .. tostring(type_checker(env):check(t)))
|
||||
end
|
||||
|
||||
display_type(env, Const("nat_rec", {0}))
|
||||
display_type(env, Const("int_rec", {0}))
|
Loading…
Reference in a new issue