Exemplo n.º 1
0
 def testUnordered(self):
     p = typegraph.Program()
     n0 = p.NewCFGNode("n0")
     n1 = n0.ConnectNew("n1")
     x = p.NewVariable()
     y = p.NewVariable()
     x0 = x.AddBinding(0, [], n0)
     x1 = x.AddBinding(1, [], n0)
     x2 = x.AddBinding(2, [], n0)
     y0 = y.AddBinding(0, [x0], n1)
     y1 = y.AddBinding(1, [x1], n1)
     y2 = y.AddBinding(2, [x2], n1)
     p.entrypoint = n0
     self.assertTrue(explain.Explain([x0], n0))
     self.assertTrue(explain.Explain([x1], n0))
     self.assertTrue(explain.Explain([x2], n0))
     self.assertTrue(explain.Explain([y0], n1))
     self.assertTrue(explain.Explain([y1], n1))
     self.assertTrue(explain.Explain([y2], n1))
Exemplo n.º 2
0
 def testBadSources(self):
   self.assertFalse(explain.Explain([self.zab], self.n4))
Exemplo n.º 3
0
 def testConflicting(self):
   self.assertFalse(explain.Explain([self.xa, self.xb], self.n4))
Exemplo n.º 4
0
 def testBadApple(self):
   # x = 'a' spoils y = 'b'
   self.assertFalse(explain.Explain([self.xa, self.yb], self.n4))
Exemplo n.º 5
0
 def testValid(self):
   self.assertTrue(explain.Explain([self.xa, self.ya], self.n4))