def test_examples_for_part_one(self): self.assertTrue(Solver.is_nice_string_one('ugknbfddgicrmopn')) self.assertTrue(Solver.is_nice_string_one('aaa')) self.assertFalse(Solver.is_nice_string_one('jchzalrnumimnmhp')) self.assertFalse(Solver.is_nice_string_one('haegwjzuvuyypxyu')) self.assertFalse(Solver.is_nice_string_one('dvszwmarrgswjxmb'))
def test_examples_for_part_two(self): self.assertTrue(Solver.is_nice_string_two('qjhvhtzxzqqjkmpb')) self.assertTrue(Solver.is_nice_string_two('xxyxx')) self.assertFalse(Solver.is_nice_string_two('uurcxstgmygtbstg')) self.assertFalse(Solver.is_nice_string_two('ieodomkazucvgmuy'))
def test_solution(self): (one, two) = Solver(from_file='input/dec05.in').solve() self.assertEqual(one, 238) self.assertEqual(two, 69)
def test_solution(self): (one, two) = Solver(from_file="input/december05.input").solve() self.assertEqual(one, 10132) self.assertEqual(two, 4572)
def test_example_one(self): s = Solver(from_str="dabAcCaCBAcCcaDA") self.assertEqual(s.react(s.puzzle_input), "dabCBAcaDA") (one, two) = s.solve() self.assertEqual(one, 10) self.assertEqual(two, 4)
def test_react(self): s = Solver(from_str="...") self.assertEqual(s.react("AAa"), "A") self.assertEqual(s.react("bAAa"), "bA") self.assertEqual(s.react("AA"), "AA") self.assertEqual(s.react("aa"), "aa") self.assertEqual(s.react("aA"), "") self.assertEqual(s.react("Aa"), "") self.assertEqual(s.react("abBA"), "") self.assertEqual(s.react("aABb"), "") self.assertEqual(s.react("CaABbC"), "CC") self.assertEqual(s.react("CCaABbC"), "CCC") self.assertEqual(s.react("abAB"), "abAB") self.assertEqual(s.react("aabAAB"), "aabAAB")
def test_solution(self): s = Solver(from_str="reyedfim") (one, two) = s.solve() self.assertEqual(one, "f97c354d") self.assertEqual(two, "863dde27")
def test_valid_password(self): (one, two) = Solver(from_str="abc").solve() self.assertEqual(one, "18f47a30") self.assertEqual(two, "05ace8e3")