Example #1
0
 def test_returns_zero_when_no_patterns(self):
     self.assertEqual(0, count_patterns("abc"))
     self.assertEqual(0, count_patterns("1abc1"))
     self.assertEqual(0, count_patterns("10abc1"))
     self.assertEqual(0, count_patterns("10abc100"))
Example #2
0
 def test_returns_number_of_patterns_for_overlaping_patterns(self):
     self.assertEqual(3, count_patterns("1a10001b10101"))
Example #3
0
 def test_returns_zero_for_empty_string(self):
     self.assertEqual(0, count_patterns(""))
Example #4
0
 def test_returns_number_of_patterns_for_multiple_patterns(self):
     self.assertEqual(3, count_patterns("1a10001b101c1101"))
Example #5
0
 def test_returns_one_for_single_pattern_with_multiple_zeros(self):
     self.assertEqual(1, count_patterns("a10001bc1"))
Example #6
0
 def test_returns_one_for_single_pattern_in_the_end(self):
     self.assertEqual(1, count_patterns("1abc1101"))
Example #7
0
 def test_returns_one_for_single_pattern_in_the_middle(self):
     self.assertEqual(1, count_patterns("1a101bc1"))
Example #8
0
 def test_returns_one_for_single_pattern_in_the_beginning(self):
     self.assertEqual(1, count_patterns("101abc1"))