示例#1
0
 def test_multiple_memoizations(self):
     f = Foobar()
     m1 = f.memoize(f.one())
     m2 = f.memoize(f.two())
     self.assertNodeOutput("$put(v0,$one())", m1)
     self.assertNodeOutput("$put(v0,$two())", m2)
     self.assertNodeOutput("$put(v0,$one())", m1)
     self.assertNodeOutput("$put(v0,$two())", m2)
     self.assertNodeOutput("$foo($put(v0,$one()),$bar($get(v0),$put(v1,$two())),$get(v1))",
                           f.foo(m1, f.bar(m1, m2), m2))
示例#2
0
 def test_multiple_memoizations(self):
     f = Foobar()
     m1 = f.memoize(f.one())
     m2 = f.memoize(f.two())
     self.assertNodeOutput("$put(v0,$one())", m1)
     self.assertNodeOutput("$put(v0,$two())", m2)
     self.assertNodeOutput("$put(v0,$one())", m1)
     self.assertNodeOutput("$put(v0,$two())", m2)
     self.assertNodeOutput(
         "$foo($put(v0,$one()),$bar($get(v0),$put(v1,$two())),$get(v1))",
         f.foo(m1, f.bar(m1, m2), m2))
示例#3
0
文件: test_math.py 项目: ycros/fbtf
 def test_subtract(self):
     f = Foobar()
     self.assertNodeOutput("$sub($one(),3)", f.one() - 3)
示例#4
0
文件: test_math.py 项目: ycros/fbtf
 def test_mul(self):
     f = Foobar()
     self.assertNodeOutput("$mul($one(),3)", f.one() * 3)
示例#5
0
文件: test_math.py 项目: ycros/fbtf
 def test_div(self):
     f = Foobar()
     self.assertNodeOutput("$div($one(),3)", f.one() / 3)
示例#6
0
文件: test_math.py 项目: ycros/fbtf
 def test_add(self):
     f = Foobar()
     self.assertNodeOutput("$add($one(),3)", f.one() + 3)
示例#7
0
 def test_add(self):
     f = Foobar()
     self.assertNodeOutput("$add($one(),3)", f.one() + 3)
示例#8
0
 def test_subtract(self):
     f = Foobar()
     self.assertNodeOutput("$sub($one(),3)", f.one() - 3)
示例#9
0
 def test_mul(self):
     f = Foobar()
     self.assertNodeOutput("$mul($one(),3)", f.one() * 3)
示例#10
0
 def test_div(self):
     f = Foobar()
     self.assertNodeOutput("$div($one(),3)", f.one() / 3)