lean2/tests/lua/choice.lua
Leonardo de Moura 4f83b1a50b feat(library): add choice expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 14:35:34 -07:00

14 lines
453 B
Lua

local f = Const("f")
local a = Const("a")
local c = mk_choice(f(a), a, f(f(a)))
print(c)
assert(is_choice(c))
assert(get_num_choices(c) == 3)
assert(get_choice(c, 0) == f(a))
assert(get_choice(c, 1) == a)
assert(get_choice(c, 2) == f(f(a)))
assert(mk_choice(f(a)) == f(a))
check_error(function() mk_choice() end)
check_error(function() get_num_choices(f(a)) end)
check_error(function() get_choice(f(a)) end)
check_error(function() get_choice(c, 3) end)