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))
 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'))
Beispiel #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))
 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))
Beispiel #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))
Beispiel #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'))