コード例 #1
0
 def test_or_substitution(self):
     # The only normal case
     input = ('a or b')
     result = booleansimplifier.replace_operations(input)
     self.assertTrue(result and '|' in result,
                     'Failed with argument "%s", result "%s"' % (input, result))
     failureInputs = ('or b', 'a or', 'aor ', ' orb')
     for input in failureInputs:
         result = booleansimplifier.replace_operations(input)
         self.assertFalse(result and '|' in result,
                         'Failed with argument "%s", result "%s"' % (input, result))
コード例 #2
0
 def test_and_substitution(self):
     # The only normal case
     input = (' and ')
     result = booleansimplifier.replace_operations(input)
     self.assertTrue(result and '&' in result,
                     'Failed with argument "%s", result "%s"' % (input, result))
     failureInputs = ('and b', 'a and', 'aand ', ' andb')
     for input in failureInputs:
         result = booleansimplifier.replace_operations(input)
         self.assertFalse(result and '&' in result,
                         'Failed with argument "%s", result "%s"' % (input, result))
     self.assertEqual('checkin & ! interactive', booleansimplifier.replace_operations('checkin and not interactive'))
コード例 #3
0
 def test_or_substitution(self):
     # The only normal case
     input = ('a or b')
     result = booleansimplifier.replace_operations(input)
     self.assertTrue(
         result and '|' in result,
         'Failed with argument "%s", result "%s"' % (input, result))
     failureInputs = ('or b', 'a or', 'aor ', ' orb')
     for input in failureInputs:
         result = booleansimplifier.replace_operations(input)
         self.assertFalse(
             result and '|' in result,
             'Failed with argument "%s", result "%s"' % (input, result))
コード例 #4
0
 def test_not_substitution(self):
     # The only normal case
     successInputs = (' not ', 'not ')
     for input in successInputs:
         result = booleansimplifier.replace_operations(input)
         self.assertTrue(result and '!' in result,
                         'Failed with argument "%s", result "%s"' %
                         (input, result))
     failureInputs = ('notb', 'inot')
     for input in failureInputs:
         result = booleansimplifier.replace_operations(input)
         self.assertFalse(result and '!' in result,
                         'Failed with argument "%s", result "%s"' %
                         (input, result))
コード例 #5
0
 def test_not_substitution(self):
     # The only normal case
     successInputs = (' not ', 'not ')
     for input in successInputs:
         result = booleansimplifier.replace_operations(input)
         self.assertTrue(
             result and '!' in result,
             'Failed with argument "%s", result "%s"' % (input, result))
     failureInputs = ('notb', 'inot')
     for input in failureInputs:
         result = booleansimplifier.replace_operations(input)
         self.assertFalse(
             result and '!' in result,
             'Failed with argument "%s", result "%s"' % (input, result))
コード例 #6
0
 def test_and_substitution(self):
     # The only normal case
     input = (' and ')
     result = booleansimplifier.replace_operations(input)
     self.assertTrue(
         result and '&' in result,
         'Failed with argument "%s", result "%s"' % (input, result))
     failureInputs = ('and b', 'a and', 'aand ', ' andb')
     for input in failureInputs:
         result = booleansimplifier.replace_operations(input)
         self.assertFalse(
             result and '&' in result,
             'Failed with argument "%s", result "%s"' % (input, result))
     self.assertEqual(
         'checkin & ! interactive',
         booleansimplifier.replace_operations(
             'checkin and not interactive'))