示例#1
0
    def test_13(self):
        sample_data = day13.get_data(day13.SAMPLE_PATH)
        self.assertEqual(day13.part_1(sample_data), 295)
        self.assertEqual(day13.part_2(sample_data), 1068781)
        self.assertEqual(day13.part_2(sample_data), 1068781)

        challenge_data = day13.get_data(day13.INPUT_PATH)
        self.assertEqual(day13.part_1(challenge_data), 3882)
        self.assertEqual(day13.part_2(challenge_data), 867295486378319)
        self.assertEqual(day13.part_2(challenge_data), 867295486378319)
示例#2
0
    def test_13(self):
        sample_data = day13.get_data(day13.SAMPLE_PATH)
        self.assertEqual(day13.part_1(*sample_data), 17)
        self.assertEqual(day13.part_2(*sample_data),
                         "█████\n█   █\n█   █\n█   █\n█████")

        challenge_data = day13.get_data(day13.INPUT_PATH)
        self.assertEqual(day13.part_1(*challenge_data), 807)
        expected_code = ("█     ██  █  █ ████  ██  █  █ ████   ██\n"
                         "█    █  █ █  █ █    █  █ █  █ █       █\n"
                         "█    █    ████ ███  █    █  █ ███     █\n"
                         "█    █ ██ █  █ █    █ ██ █  █ █       █\n"
                         "█    █  █ █  █ █    █  █ █  █ █    █  █\n"
                         "████  ███ █  █ ████  ███  ██  ████  ██ ")
        self.assertEqual(day13.part_2(*challenge_data), expected_code)
示例#3
0
 def test_with_input(self):
     bus_ids = read_input_lines(13)[1]
     self.assertEqual(part_2(bus_ids), 210612924879242)
示例#4
0
 def test_with_part_2_example_4(self):
     self.assertEqual(part_2("67,7,x,59,61"), 1261476)
示例#5
0
 def test_with_part_2_example_5(self):
     self.assertEqual(part_2("1789,37,47,1889"), 1202161486)
示例#6
0
 def test_with_part_2_example_2(self):
     self.assertEqual(part_2("67,7,59,61"), 754018)
示例#7
0
 def test_with_part_2_example_3(self):
     self.assertEqual(part_2("67,x,7,59,61"), 779210)
示例#8
0
 def test_with_part_1_example(self):
     bus_ids = to_lines(PART_1_EXAMPLE)[1]
     self.assertEqual(part_2(bus_ids), 1068781)
示例#9
0
 def test_with_part_2_example_1(self):
     self.assertEqual(part_2("17,x,13,19"), 3417)
示例#10
0
 def test_part_2_sixth_example(self):
     result = part_2(["123", "1789,37,47,1889"])
     self.assertEqual(result, 1202161486)
示例#11
0
 def test_part_2_real_input(self):
     result = part_2(input)
     self.assertEqual(result, 600689120448303)
示例#12
0
 def test_part_2_fifth_example(self):
     result = part_2(["123", "67,7,x,59,61"])
     self.assertEqual(result, 1261476)
示例#13
0
 def test_part_2_fourth_example(self):
     result = part_2(["123", "67,x,7,59,61"])
     self.assertEqual(result, 779210)
示例#14
0
 def test_part_2_third_example(self):
     result = part_2(["123", "67,7,59,61"])
     self.assertEqual(result, 754018)
示例#15
0
 def test_part_2_second_example(self):
     result = part_2(["123", "17,x,13,19"])
     self.assertEqual(result, 3417)
示例#16
0
 def test_part_2_example_input(self):
     result = part_2(example_input)
     self.assertEqual(result, 1068781)