lean2/tests/lua/localctx1.lua
Leonardo de Moura 554defe89d feat(lua): expose local_context objects in the Lua bindings
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-09 12:18:46 -08:00

24 lines
584 B
Lua

l = local_context()
assert(l:is_nil())
assert(is_local_context(l))
e = mk_inst(1, Const("a"))
assert(is_local_entry(e))
assert(e:is_inst())
assert(not e:is_lift())
assert(e:s() == 1)
assert(e:v() == Const("a"))
assert(e:v() ~= Const("b"))
assert(not e:is_lift())
e2 = mk_lift(0, 2);
assert(is_local_entry(e2))
assert(not e2:is_inst())
assert(e2:is_lift())
assert(e2:s() == 0)
assert(e2:n() == 2)
l = local_context(e, l)
l2 = local_context(e2, l)
assert(l2:head() == e2)
assert(l2:tail():head() == e)
assert(not l2:is_nil())
assert(is_local_context(l2))
assert(not is_local_entry(l2))