Ejemplo n.º 1
0
 def test_answers(self):
     import os
     if "day9_Decompression" in os.getcwd():
         path = "python/"
     else:
         path = "day9_Decompression/python/"
     self.assertEqual(d9p1.run(path + "input.txt"), 74532)
Ejemplo n.º 2
0
 def test_answers(self):
     import os
     if "day8_Two_factor" in os.getcwd():
         path = "python/"
     else:
         path = "day8_Two_factor/python/"
     self.assertEqual(d8p1.run(path + "input.txt")[0], 110)
Ejemplo n.º 3
0
 def test_answers(self):
     outputs, handover = d10p1.run(self.path + "input.txt")
     zero = outputs[0].chips[0]
     one = outputs[1].chips[0]
     two = outputs[2].chips[0]
     self.assertEqual(handover, 157)
     self.assertEqual(zero * one * two, 1085)
Ejemplo n.º 4
0
 def test_answers(self):
     import os
     if "day2" in os.getcwd():
         path = "python/"
     else:
         path = "day2_Keypad/python/"
     self.assertEqual(d2p1.run(path=path), "47978")
     self.assertEqual(d2p2.run(path=path), "659AD")
Ejemplo n.º 5
0
 def test_answers(self):
     import os
     if "day7_TLS_SSL" in os.getcwd():
         path = "python/"
     else:
         path = "day7_TLS_SSL/python/"
     self.assertEqual(d7p1.run(path), 118)
     self.assertEqual(d7p2.run(path), 260)
Ejemplo n.º 6
0
 def test_answers(self):
     import os
     if "day4_Shift_cipher" in os.getcwd():
         path = "python/"
     else:
         path = "day4_Shift_cipher/python/"
     self.assertEqual(d4p1.run(path)[1], 361724)
     self.assertEqual(int(d4p2.run(path)[1]), 482)
Ejemplo n.º 7
0
 def test_answers(self):
     import os
     if "day3_Triangles" in os.getcwd():
         path = "python/"
     else:
         path = "day3_Triangles/python/"
     self.assertEqual(d3p1.run(path=path), 983)
     self.assertEqual(d3p2.run(path=path), 1836)
Ejemplo n.º 8
0
 def test_simple_network(self):
     outputs, _ = d10p1.run(self.path + "testinput.txt")
     zero = outputs[0].chips[0]
     one = outputs[1].chips[0]
     two = outputs[2].chips[0]
     self.assertEqual(zero, 5)
     self.assertEqual(one, 2)
     self.assertEqual(two, 3)
     self.assertEqual(zero * one * two, 30)
Ejemplo n.º 9
0
 def test_part1(self):
     input_string = "abc5017308"
     self.assertEqual(d5p1.hash(input_string), "000008f82")
     assert_keys = [3231929, 5017308, 5278568, 5357525,
             5708769, 6082117, 8036669, 8605828]
     password, test_keys = d5p1.run("abc")
     self.assertEqual(password, "18f47a30")
     self.assertEqual(len(assert_keys), len(test_keys))
     for a,b in zip(assert_keys, test_keys):
         self.assertEqual(a, b)
Ejemplo n.º 10
0
    def test_full_test(self):
        test_locations = {0:[1, 1], 1: [1, 3], 3: [3, 9],
                       2: [1, 9], 4: [3, 1]}
        assert_dict = {
                       0: {1: 2, 3: 10, 2: 8, 4: 2},
                       1: {0: 2, 3: 8, 2: 6, 4: 4},
                       2: {1: 6, 0: 8, 3: 2, 4: 10},
                       3: {1: 8, 0: 10, 2: 2, 4: 8},
                       4: {1: 4, 0: 2, 3: 8, 2: 10}
       }

        self.assertEqual(d24p1.find_edges(test_locations, self.test_maze),
                        assert_dict)
        self.assertEqual(d24p1.shortest_path(assert_dict), [14, (4,1,2,3)])
        self.assertEqual(d24p1.run(self.path + "testinput.txt"),
                        [14, (4,1,2,3)])
Ejemplo n.º 11
0
 def test_part1_full_example(self):
     test_str = "10000"
     input_list = [int(i) for i in test_str]
     output = ""
     output = "".join(str(i) for i in d16p1.run(input_list, 20))
     self.assertEqual(output, "01100")
Ejemplo n.º 12
0
 def test_answers(self):
     self.assertEqual(d19p1.run(3004953), 1815603)
     self.assertEqual(d19p2.run(3004953), 1410630)
Ejemplo n.º 13
0
 def test_answers(self):
     self.assertEqual(d12p1.run(self.path + "input.txt"), 318020)
     self.assertEqual(d12p2.run(self.path + "input.txt"), 9227674)
Ejemplo n.º 14
0
 def test_full(self):
     self.assertEqual(d11p1.run(True), 11)
Ejemplo n.º 15
0
 def test_parts(self):
     self.assertEqual(d23p1.run(self.path + "testinput1.txt"), 42)
     self.assertEqual(d23p1.run(self.path + "testinput2.txt"), 3)
Ejemplo n.º 16
0
 def test_answers(self):
     self.assertEqual(d20p1.run(self.path), 22887907)
     self.assertEqual(d20p2.run(self.path), 109)
Ejemplo n.º 17
0
 def test_answers(self):
     self.assertEqual(d5p1.run("uqwqemis")[0], "1a3099aa")
     self.assertEqual(d5p2.run("uqwqemis")[0], "694190cd")
Ejemplo n.º 18
0
 def test_part1(self):
     self.assertEqual(d6p1.run(self.path + "testinput.txt")[:6], "easter")
Ejemplo n.º 19
0
 def test_answers(self):
     self.assertEqual(d6p1.run(self.path + "input.txt"), "umejzgdw")
     self.assertEqual(d6p2.run(self.path + "input.txt"), "aovueakv")
Ejemplo n.º 20
0
 def test_part1(self):
     self.assertEqual(d22p1.run(self.path + "testinput.txt"), 7)
Ejemplo n.º 21
0
 def test_answers(self):
     self.assertEqual(d13p1.run(), 90)
     self.assertEqual(d13p2.run(), 135)
Ejemplo n.º 22
0
 def test_answers(self):
     self.assertEqual(d22p1.run(self.path + "input.txt"), 901)
Ejemplo n.º 23
0
 def test_answers(self):
     self.assertEqual(d14p1.run(), 15035)
Ejemplo n.º 24
0
 def test_answers(self):
     self.assertEqual(d21p1.run(self.path), "dgfaehcb")
     self.assertEqual(d21p2.run(self.path), "fdhgacbe")
Ejemplo n.º 25
0
 def test_answers(self):
     self.assertEqual(d23p1.run(self.path + "input.txt"), 318020)
Ejemplo n.º 26
0
 def test_parts(self):
     self.assertEqual(d12p1.run(self.path + "testinput.txt"), 42)
     self.assertEqual(d12p2.run(self.path + "testinput.txt"), 42)
Ejemplo n.º 27
0
 def test_answers(self):
     self.assertEqual(d24p1.run(self.path + "input.txt"),
                     [430, (1, 7, 3, 6, 5, 2, 4)] )
     self.assertEqual(d24p2.run(self.path + "input.txt"),
                     [430, (1, 7, 3, 6, 5, 2, 4)] )
Ejemplo n.º 28
0
 def test_answers(self):
     self.assertEqual(d15p1.run(self.path + "input.txt"), 376777)
     self.assertEqual(d15p2.run(self.path + "input.txt"), 3903937)