public void Example2(string word, bool expectedResult) { var evaluator = new WordEvaluator() { Rules = { new LetterDuplicationRule(2, 1), new RepeatingLetterRule() } }; var isNice = evaluator.IsNiceWord(word); Assert.Equal(expectedResult, isNice); }
public void Example1(string word, bool expectedResult) { var evaluator = new WordEvaluator() { Rules = { new LetterEvalRule(new[] { 'a', 'e', 'i', 'o', 'u' }, 3), new LetterDuplicationRule(2, 1), new WordExclusion("ab"), new WordExclusion("cd"), new WordExclusion("pq"), new WordExclusion("xy"), } }; var isNice = evaluator.IsNiceWord(word); Assert.Equal(expectedResult, isNice); }
public void Puzzle2() { var input = FileReader .GetResource("AdventOfCode.Tests._2015.Day5.PuzzleInput.txt"); var evaluator = new WordEvaluator { Rules = { new RepeatingPairRule(), new RepeatingLetterRule() } }; var count = input.Split(Environment.NewLine) .Count(word => evaluator.IsNiceWord(word)); Assert.Equal(53, count); }
public void Puzzle1() { var input = FileReader .GetResource("AdventOfCode.Tests._2015.Day5.PuzzleInput.txt"); var evaluator = new WordEvaluator { Rules = { new LetterEvalRule(new[] { 'a', 'e', 'i', 'o', 'u' }, 3), new LetterDuplicationRule(2, 1), new WordExclusion("ab"), new WordExclusion("cd"), new WordExclusion("pq"), new WordExclusion("xy"), } }; var count = input.Split(Environment.NewLine) .Count(word => evaluator.IsNiceWord(word)); Assert.Equal(258, count); }