Exemplo n.º 1
0
    def test_tree_repeat(self):

        self.assertEqual(
            Day3.tree_hit_count(self.day3_test_tree_repeating, 3, 1), 7)
        self.assertEqual(
            Day3.tree_hit_count(self.day3_test_tree_repeating, 1, 1), 2)
        self.assertEqual(
            Day3.tree_hit_count(self.day3_test_tree_repeating, 5, 1), 3)
        self.assertEqual(
            Day3.tree_hit_count(self.day3_test_tree_repeating, 7, 1), 4)
        self.assertEqual(
            Day3.tree_hit_count(self.day3_test_tree_repeating, 1, 2), 2)

        self.assertEqual(
            Day3.tree_hit_count(self.day3_test_tree_repeating, 3, 1) *
            Day3.tree_hit_count(self.day3_test_tree_repeating, 1, 1) *
            Day3.tree_hit_count(self.day3_test_tree_repeating, 5, 1) *
            Day3.tree_hit_count(self.day3_test_tree_repeating, 7, 1) *
            Day3.tree_hit_count(self.day3_test_tree_repeating, 1, 2), 336)
Exemplo n.º 2
0
    def setUp(self):

        with open('Day3_test_inputs.txt', 'r') as f:
            day3_test_list = f.readlines()
        day3_test_inputs = list(map(str.strip, day3_test_list))

        with open('day3_inputs.txt', 'r') as f:
            day3_list = f.readlines()
        day3_inputs = list(map(str.strip, day3_list))

        self.day3_test_tree_repeating = Day3.tree_repeat(day3_test_inputs)
def main():
    Day0.run()
    Day1.run()
    Day2.run()
    Day3.run()
    Day4.run()
    Day5.run()
    Day6.run()
    Day7.run()
    Day8.run()
    Day9.run()
    Day10.run()
    Day11.run()
    Day12.run()
    Day13.run()
    Day14.run()
    Day15.run()
    Day16.run()
    Day17.run()
    Day18.run()
    Day19.run()
Exemplo n.º 4
0
 def test_puzzledata1(self):
     self.assertEqual(Day3.solve("puzzledata.txt"), 121163)
Exemplo n.º 5
0
 def test_testdata1(self):
     self.assertEqual(Day3.solve("testdata1.txt"), 4)
Exemplo n.º 6
0
 def test2_norobo(self):
     testdata = '^>v<'
     self.assertEqual(Day3.total_delivered_houses(testdata, robosanta=False), 4)
Exemplo n.º 7
0
 def test3_robo(self):
     testdata = '^v^v^v^v^v'
     self.assertEqual(Day3.total_delivered_houses(testdata, robosanta=True), 11)
Exemplo n.º 8
0
 def test2_robo(self):
     testdata = '^>v<'
     self.assertEqual(Day3.total_delivered_houses(testdata, robosanta=True), 3)
Exemplo n.º 9
0
 def test_run_pt2(self):
     input_list = common.loadInput('testInput3.txt', True)
     testObject = Day3.Solution()
     self.assertEqual(336, testObject.part2(input_list))
Exemplo n.º 10
0
 def test_run(self):
     #remember to set the assert to the known examples and place the example test into testInput3.txt!
     input_list = common.loadInput('testInput3.txt', True)
     testObject = Day3.Solution()
     self.assertEqual(7, testObject.part1(input_list))