Exemple #1
0
 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)
Exemple #2
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)
Exemple #3
0
 def testblock2(self):
   eq_(eval(block('a', exit_block('a', 2), 3)), 2)
Exemple #4
0
 def test_unwind_protect2(self):
   eq_(eval(block('foo', unwind_protect(exit_block('foo', 1), 
                           prin(2), prin(3)))), 1)
Exemple #5
0
 def test_block2(self):
     eq_(preparse(block.a[v.i << 1]), special.block('a', special.set(i, 1)))
Exemple #6
0
 def testblock(self):
   f = Var('f')
   eq_(eval(block('foo', let([(f, lambda_((), exit_block('foo',1)))], 
                           mul(2,block('foo', f()))))), 
       1)
Exemple #7
0
 def test_block2(self):
   eq_(preparse(block.a[ v.i << 1 ]), special.block('a', special.set(i,1))) 
Exemple #8
0
 def test_block(self):
     eq_(preparse(block.a[1]), special.block('a', 1))
Exemple #9
0
 def test_block(self):
   eq_(preparse(block.a[1]), special.block('a', 1)) 
Exemple #10
0
def make_block(name, body):
    body = tuple(preparse(x) for x in body)
    return special.block(name, *body)
Exemple #11
0
 def test_loop2(self):
     eq_(tag_loop_label(LoopForm((1, next(), 2))), block("$1", 1, continue_block("$1"), 2, continue_block("$1")))
Exemple #12
0
 def test_loop1(self):
     eq_(tag_loop_label(LoopForm((1, 2, exit()))), block("$1", 1, 2, exit_block("$1"), continue_block("$1")))
Exemple #13
0
def make_block(name, body):
  body = tuple(preparse(x) for x in body)
  return special.block(name, *body)