def testRootCause(self): n1 = self.prog.NewCFGNode() n2 = self.prog.NewCFGNode() self.assertEqual((None, None), debug.root_cause([], n1)) v = self.prog.NewVariable() b1 = v.AddBinding("foo", (), n2) # not connected to n1 self.assertEqual((b1, n1), debug.root_cause([b1], n1)) v = self.prog.NewVariable() b2 = v.AddBinding("foo", (b1, ), n1) self.assertEqual((b1, n1), debug.root_cause([b2], n1))
def testRootCauseNotVisible(self): v = self.prog.NewVariable() b = v.AddBinding("x", [], self.current_location) n = self.current_location.ConnectNew() v.AddBinding("y", [], n) self.assertEqual(debug.root_cause(b, n), (b, n))
def testRootCauseVisible(self): v = self.prog.NewVariable() b = v.AddBinding("x", [], self.current_location) self.assertEqual(debug.root_cause(b, self.current_location), (None, None))