public void FindPatterns_NotAllowOverlapping_0Founded_PatternLenghtTooBig() { var service = new FindPatternService(); var result = service.FindPatterns("asdfghjkl", 7); Assert.That(result.Length, Is.EqualTo(0)); }
public void FindPatterns_NotAllowOverlapping_1Overlapping_1Founded() { var service = new FindPatternService(); var result = service.FindPatterns("abcdeabccde", 3); Assert.That(result.Length, Is.EqualTo(1)); Assert.That(result.FirstOrDefault(x => x.Pattern == "abc")?.Occurrence, Is.EqualTo(2)); }
public void FindPatterns_NotAllowOverlapping() { var service = new FindPatternService(); var result = service.FindPatterns("zf3kabxcde224lkzf3mabxc51+crsdtzf3nab=", 3); Assert.That(result.Length, Is.EqualTo(2)); Assert.That(result.FirstOrDefault(x => x.Pattern == "zf3")?.Occurrence, Is.EqualTo(3)); Assert.That(result.FirstOrDefault(x => x.Pattern == "abx")?.Occurrence, Is.EqualTo(2)); }
public void FindPatterns_NotAllowOverlapping_1Overlapping_1Founded_2() { var service = new FindPatternService(); var result = service.FindPatterns("abcdecdeabc", 3); foreach (var pattern in result) { Console.WriteLine($"Patterns: {pattern.Pattern} occur {pattern.Occurrence} times."); } Assert.That(result.Length, Is.EqualTo(1)); Assert.That(result.FirstOrDefault(x => x.Pattern == "cde")?.Occurrence, Is.EqualTo(2)); }