コード例 #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)
コード例 #2
0
ファイル: tests.py プロジェクト: veioenza/advent2016
 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)
コード例 #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)
コード例 #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")
コード例 #5
0
ファイル: tests.py プロジェクト: veioenza/advent2016
 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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)])
コード例 #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")
コード例 #12
0
ファイル: tests.py プロジェクト: veioenza/advent2016
 def test_answers(self):
     self.assertEqual(d19p1.run(3004953), 1815603)
     self.assertEqual(d19p2.run(3004953), 1410630)
コード例 #13
0
 def test_answers(self):
     self.assertEqual(d12p1.run(self.path + "input.txt"), 318020)
     self.assertEqual(d12p2.run(self.path + "input.txt"), 9227674)
コード例 #14
0
 def test_full(self):
     self.assertEqual(d11p1.run(True), 11)
コード例 #15
0
ファイル: tests.py プロジェクト: veioenza/advent2016
 def test_parts(self):
     self.assertEqual(d23p1.run(self.path + "testinput1.txt"), 42)
     self.assertEqual(d23p1.run(self.path + "testinput2.txt"), 3)
コード例 #16
0
ファイル: tests.py プロジェクト: veioenza/advent2016
 def test_answers(self):
     self.assertEqual(d20p1.run(self.path), 22887907)
     self.assertEqual(d20p2.run(self.path), 109)
コード例 #17
0
 def test_answers(self):
     self.assertEqual(d5p1.run("uqwqemis")[0], "1a3099aa")
     self.assertEqual(d5p2.run("uqwqemis")[0], "694190cd")
コード例 #18
0
ファイル: tests.py プロジェクト: veioenza/advent2016
 def test_part1(self):
     self.assertEqual(d6p1.run(self.path + "testinput.txt")[:6], "easter")
コード例 #19
0
ファイル: tests.py プロジェクト: veioenza/advent2016
 def test_answers(self):
     self.assertEqual(d6p1.run(self.path + "input.txt"), "umejzgdw")
     self.assertEqual(d6p2.run(self.path + "input.txt"), "aovueakv")
コード例 #20
0
 def test_part1(self):
     self.assertEqual(d22p1.run(self.path + "testinput.txt"), 7)
コード例 #21
0
ファイル: tests.py プロジェクト: veioenza/advent2016
 def test_answers(self):
     self.assertEqual(d13p1.run(), 90)
     self.assertEqual(d13p2.run(), 135)
コード例 #22
0
 def test_answers(self):
     self.assertEqual(d22p1.run(self.path + "input.txt"), 901)
コード例 #23
0
 def test_answers(self):
     self.assertEqual(d14p1.run(), 15035)
コード例 #24
0
 def test_answers(self):
     self.assertEqual(d21p1.run(self.path), "dgfaehcb")
     self.assertEqual(d21p2.run(self.path), "fdhgacbe")
コード例 #25
0
ファイル: tests.py プロジェクト: veioenza/advent2016
 def test_answers(self):
     self.assertEqual(d23p1.run(self.path + "input.txt"), 318020)
コード例 #26
0
 def test_parts(self):
     self.assertEqual(d12p1.run(self.path + "testinput.txt"), 42)
     self.assertEqual(d12p2.run(self.path + "testinput.txt"), 42)
コード例 #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)] )
コード例 #28
0
ファイル: tests.py プロジェクト: veioenza/advent2016
 def test_answers(self):
     self.assertEqual(d15p1.run(self.path + "input.txt"), 376777)
     self.assertEqual(d15p2.run(self.path + "input.txt"), 3903937)