def testloop(self): eq_(eval(let([(i,3)], block(a, set(i, sub(i, 1)), if_(eq(i, 0), exit_block(a, 1)), continue_block(a)), i)), 0)
def test_unwind_protect_loop(self): eq_(eval(let([(i,3)], block(a, set(i, sub(i, 1)), if_(eq(i, 0), exit_block(a, 1)), unwind_protect(continue_block(a), prin(2))), i)), 0)
def testblock2(self): eq_(eval(block('a', exit_block('a', 2), 3)), 2)
def test_unwind_protect2(self): eq_(eval(block('foo', unwind_protect(exit_block('foo', 1), prin(2), prin(3)))), 1)
def test_block2(self): eq_(preparse(block.a[v.i << 1]), special.block('a', special.set(i, 1)))
def testblock(self): f = Var('f') eq_(eval(block('foo', let([(f, lambda_((), exit_block('foo',1)))], mul(2,block('foo', f()))))), 1)
def test_block2(self): eq_(preparse(block.a[ v.i << 1 ]), special.block('a', special.set(i,1)))
def test_block(self): eq_(preparse(block.a[1]), special.block('a', 1))
def make_block(name, body): body = tuple(preparse(x) for x in body) return special.block(name, *body)
def test_loop2(self): eq_(tag_loop_label(LoopForm((1, next(), 2))), block("$1", 1, continue_block("$1"), 2, continue_block("$1")))
def test_loop1(self): eq_(tag_loop_label(LoopForm((1, 2, exit()))), block("$1", 1, 2, exit_block("$1"), continue_block("$1")))