示例#1
0
 def test_random(self):
     chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
     for i in range(100):
         base = random.randint(1, 4)
         res_string = ''
         error_count = 0
         error_flag = 0
         for i in chars:
             error = random.randint(-1, 2)
             if -(base) != error:
                 if error == 1 or error == -1:
                     error_count += 1
                 if error == 2:
                     error_flag += 1
                 res_string += i * (base + error)
         
         data = res_string
         if error_count > 1 or error_flag > 0:
             res = False
         else:
             res = True
         self.assertEqual(SherlockValidString(data), res)
示例#2
0
 def test_xyzaa_true(self):
     data = 'xyzaa'
     res = True
     self.assertEqual(SherlockValidString(data), res)
示例#3
0
 def test_xyyzzz_false(self):
     data = 'xyyzzz'
     res = False
     self.assertEqual(SherlockValidString(data), res)
示例#4
0
 def test_xxxxxyyyyyy_true (self):
     data = 'xxxxxyyyyyy'
     res = True
     self.assertEqual(SherlockValidString(data), res)