lean2/tests/lua/old/context1.lua
Leonardo de Moura a6116e3156 test(lua): reactivate some of the Lua unit tests
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-04-29 10:36:57 -07:00

25 lines
650 B
Lua

c = context()
assert(c:is_empty())
print(c)
e = context_entry("x", Const("N"))
assert(e:get_name() == name("x"))
assert(e:get_domain() == Const("N"))
assert(not e:get_body())
print(e:get_body())
c = context(c, e)
print(c)
assert(not c:is_empty())
c = context(c, "y", Const("M"))
assert(#c == 2)
assert(c:size() == 2)
e, c1 = lookup(c, 0)
assert(c1:size() == 1)
assert(e:get_name() == name("y"))
c = context(c, "z", Const("N"), Const("a"))
print(c)
check_error(function() lookup(c, 10) end)
assert(lookup(c, 0):get_body() == Const("a"))
assert(not is_context_entry(c))
assert(is_context(c))
assert(is_context_entry(e))
assert(not is_context_entry(c))