Beispiel #1
0
 def testFalse(self):
     self.assertEqual(bdd.Node.F,bdd.Node.F)
     self.assertNotEqual(bdd.Node.F,bdd.Node.T)
     self.assertEqual(bdd.Node.F,eval(repr(bdd.Node.F)))
     self.assertEqual(bdd.evaluate(bdd.Node.F,'a variable',False),bdd.Node.F)
     self.assertEqual(bdd.evaluate(bdd.Node.F,'a variable',True),bdd.Node.F)
     self.assertTrue(bdd.isTerminal(bdd.Node.F))
     self.assertEqual(bdd.getTerminal(False),bdd.Node.F)
     self.assertEqual(bdd.getTerminal([]),bdd.Node.F)
     self.assertEqual(bdd.negate(bdd.Node.F),bdd.Node.T)
Beispiel #2
0
 def testFalse(self):
     self.assertEqual(bdd.Node.F, bdd.Node.F)
     self.assertNotEqual(bdd.Node.F, bdd.Node.T)
     self.assertEqual(bdd.Node.F, eval(repr(bdd.Node.F)))
     self.assertEqual(bdd.evaluate(bdd.Node.F, 'a variable', False),
                      bdd.Node.F)
     self.assertEqual(bdd.evaluate(bdd.Node.F, 'a variable', True),
                      bdd.Node.F)
     self.assertTrue(bdd.isTerminal(bdd.Node.F))
     self.assertEqual(bdd.getTerminal(False), bdd.Node.F)
     self.assertEqual(bdd.getTerminal([]), bdd.Node.F)
     self.assertEqual(bdd.negate(bdd.Node.F), bdd.Node.T)
Beispiel #3
0
 def testSingleNode(self):
     n1=bdd.Node('x1',bdd.Node.T,bdd.Node.F)
     self.assertFalse(bdd.isTerminal(n1))
     self.assertEqual(bdd.countPhysicalNodes(n1),3)
     self.assertEqual(bdd.countLogicalNodes(n1),3)
     self.assertEqual(n1,n1)
     self.assertEqual(n1,eval(repr(n1)))
     self.assertEqual(hash(n1),hash(eval(repr(n1))))
     self.assertEqual(bdd.evaluate(n1,'x1',True),bdd.Node.T)
     self.assertEqual(bdd.evaluate(n1,'x1',False),bdd.Node.F)
     self.assertEqual(bdd.evaluate(n1,'not x1',True),n1)
     n2=bdd.Node('x2',bdd.Node.T,bdd.Node.F)
     self.assertNotEqual(n1,n2)
     n3=bdd.Node('x1',bdd.Node.T,bdd.Node.T)
     self.assertNotEqual(n1,n3)
     self.assertEqual(bdd.countPhysicalNodes(n3),2)
     self.assertEqual(bdd.countLogicalNodes(n3),2)
     n4=bdd.Node('x1',bdd.Node.F,bdd.Node.T)
     self.assertNotEqual(n1,n4)
     n5=bdd.Node('x1',bdd.Node.F,bdd.Node.F)
     self.assertNotEqual(n1,n5)
Beispiel #4
0
 def testSingleNode(self):
     n1 = bdd.Node('x1', bdd.Node.T, bdd.Node.F)
     self.assertFalse(bdd.isTerminal(n1))
     self.assertEqual(bdd.countPhysicalNodes(n1), 3)
     self.assertEqual(bdd.countLogicalNodes(n1), 3)
     self.assertEqual(n1, n1)
     self.assertEqual(n1, eval(repr(n1)))
     self.assertEqual(hash(n1), hash(eval(repr(n1))))
     self.assertEqual(bdd.evaluate(n1, 'x1', True), bdd.Node.T)
     self.assertEqual(bdd.evaluate(n1, 'x1', False), bdd.Node.F)
     self.assertEqual(bdd.evaluate(n1, 'not x1', True), n1)
     n2 = bdd.Node('x2', bdd.Node.T, bdd.Node.F)
     self.assertNotEqual(n1, n2)
     n3 = bdd.Node('x1', bdd.Node.T, bdd.Node.T)
     self.assertNotEqual(n1, n3)
     self.assertEqual(bdd.countPhysicalNodes(n3), 2)
     self.assertEqual(bdd.countLogicalNodes(n3), 2)
     n4 = bdd.Node('x1', bdd.Node.F, bdd.Node.T)
     self.assertNotEqual(n1, n4)
     n5 = bdd.Node('x1', bdd.Node.F, bdd.Node.F)
     self.assertNotEqual(n1, n5)