Example #1
0
 def test_ANDed_pair(self):
     """logicutils - ANDed pair should be in CNF"""
     self.assertEqual(to_cnf(expr('a & b')),
                      Expr('&', 'a', 'b'))
Example #2
0
 def test_singleton(self):
     """logicutils - singletons are already in CNF"""
     self.assertEqual(to_cnf(expr('a')),
                      Expr('a'))
Example #3
0
 def test_ORed_pair(self):
     """logicutils - ORed pair should be in CNF"""
     self.assertEqual(to_cnf(expr('a | b')),
                      Expr('|', 'a', 'b'))
Example #4
0
 def test_trivial_expr(self):
     """logicutils - create trivial Expr with expr()"""
     self.assertEqual(expr('a | b'), Expr('|', 'a', 'b'))
Example #5
0
 def test_deep_expr(self):
     """logicutils - create deep Expr with expr()"""
     self.assertEqual(expr('a | b | c | d | e'),
                      Expr('|', Expr('|', Expr('|', Expr('|', 'a', 'b'), 'c'), 'd'), 'e'))
Example #6
0
 def test_ANDed_pair(self):
     """logicutils - ANDed pair should be in CNF"""
     self.assertEqual(to_cnf(expr('a & b')),
                      Expr('&', 'a', 'b'))
Example #7
0
 def test_ORed_pair(self):
     """logicutils - ORed pair should be in CNF"""
     self.assertEqual(to_cnf(expr('a | b')),
                      Expr('|', 'a', 'b'))
Example #8
0
 def test_singleton(self):
     """logicutils - singletons are already in CNF"""
     self.assertEqual(to_cnf(expr('a')),
                      Expr('a'))
Example #9
0
 def test_deep_expr(self):
     """logicutils - create deep Expr with expr()"""
     self.assertEqual(expr('a | b | c | d | e'),
                      Expr('|', Expr('|', Expr('|', Expr('|', 'a', 'b'), 'c'), 'd'), 'e'))
Example #10
0
 def test_trivial_expr(self):
     """logicutils - create trivial Expr with expr()"""
     self.assertEqual(expr('a | b'), Expr('|', 'a', 'b'))