Exemplo n.º 1
0
    def test_part_two(self):
        "Test part two example of Phone object"

        # 1. Create Phone object from text
        myobj = phone.Phone(part2=True, text=aoc_05.from_text(PART_TWO_TEXT))

        # 2. Check the part two result
        self.assertEqual(myobj.part_two(verbose=False), PART_TWO_RESULT)
Exemplo n.º 2
0
    def test_part_one(self):
        "Test part one example of Phone object"

        # 1. Create Phone object from text
        myobj = phone.Phone(text=aoc_05.from_text(PART_ONE_TEXT))

        # 2. Check the part one result
        self.assertEqual(myobj.part_one(verbose=False), PART_ONE_RESULT)
Exemplo n.º 3
0
    def test_text_init(self):
        "Test the Vents object creation from text"

        # 1. Create Vents object from text
        myobj = vents.Vents(text=aoc_05.from_text(EXAMPLE_TEXT))

        # 2. Make sure it has the expected values
        self.assertEqual(myobj.part2, False)
        self.assertEqual(len(myobj.text), 10)
Exemplo n.º 4
0
    def test_text_init(self):
        "Test the Phone object creation from text"

        # 1. Create Phone object from text
        myobj = phone.Phone(text=aoc_05.from_text(EXAMPLE_TEXT))

        # 2. Make sure it has the expected values
        self.assertEqual(myobj.part2, False)
        self.assertEqual(len(myobj.text), 4)
        self.assertEqual(len(myobj.passes), 4)
Exemplo n.º 5
0
    def test_text_two(self):
        "Test the Thelist object creation from text"

        # 1. Create Thelist object from text
        myobj = thelist.Thelist(text=aoc_05.from_text(EXAMPLE_TWO), part2=True)

        # 2. Make sure it has the expected values
        self.assertEqual(myobj.part2, True)
        self.assertEqual(len(myobj.text), 4)

        # 3. Check methods
        self.assertEqual(myobj.is_nice('qjhvhtzxzqqjkmpb'), True)
        self.assertEqual(myobj.is_nice('xxyxx'), True)
        self.assertEqual(myobj.is_nice('ieodomkazucvgmuy'), False)
        self.assertEqual(myobj.is_nice('haegwjzuvuyypxyu'), False)
Exemplo n.º 6
0
    def test_text_init(self):
        "Test the Thelist object creation from text"

        # 1. Create Thelist object from text
        myobj = thelist.Thelist(text=aoc_05.from_text(EXAMPLE_TEXT))

        # 2. Make sure it has the expected values
        self.assertEqual(myobj.part2, False)
        self.assertEqual(len(myobj.text), 5)

        # 3. Check methods
        self.assertEqual(myobj.is_nice('ugknbfddgicrmopn'), True)
        self.assertEqual(myobj.is_nice('aaa'), True)
        self.assertEqual(myobj.is_nice('jchzalrnumimnmhp'), False)
        self.assertEqual(myobj.is_nice('haegwjzuvuyypxyu'), False)
        self.assertEqual(myobj.is_nice('dvszwmarrgswjxmb'), False)
Exemplo n.º 7
0
    def test_text_init(self):
        """Test Jumps creation from text"""

        # 1. Create Jumps object from text
        myjumps = jumps.Jumps(text=aoc_05.from_text(P1_EXAMPLES_TEXT))

        # 2. Make sure it has the specified values
        self.assertEqual(myjumps.part2, False)
        self.assertEqual(myjumps.location, 0)
        self.assertEqual(len(myjumps.offsets), 5)

        # 3. Check methods
        self.assertEqual(myjumps.escaped(), False)
        self.assertEqual(myjumps.goto_the_exit(), 5)
        self.assertEqual(myjumps.location, 5)
        self.assertEqual(myjumps.escaped(), True)
        self.assertEqual(myjumps.offsets, [2, 5, 0, 1, -2])
Exemplo n.º 8
0
    def test_part_two(self):
        """Test Part Two"""

        # 1. Create Jumps object from text for part two
        myjumps = jumps.Jumps(text=aoc_05.from_text(P1_EXAMPLES_TEXT),
                              part2=True)

        # 2. Make sure it has the specified values
        self.assertEqual(myjumps.part2, True)
        self.assertEqual(myjumps.location, 0)
        self.assertEqual(len(myjumps.offsets), 5)

        # 3. Check methods
        self.assertEqual(myjumps.escaped(), False)
        self.assertEqual(myjumps.goto_the_exit(), 10)
        self.assertEqual(myjumps.location, 5)
        self.assertEqual(myjumps.escaped(), True)
        self.assertEqual(myjumps.offsets, [2, 3, 2, 3, -1])