Exemple #1
0
    def test_get_matrix_size(self):
        s = Solver(from_str="#123 @ 3,2: 5x4")
        (h, w) = s.get_sizes()
        self.assertEqual(h, 6)
        self.assertEqual(w, 8)

        s = Solver(from_str=self.example_input)
        (h, w) = s.get_sizes()
        self.assertEqual(h, 7)
        self.assertEqual(w, 7)
 def test_solution(self):
     (one, two) = Solver(from_file="input/december03.input").solve()
     self.assertEqual(one, 869)
     self.assertEqual(two, 1544)
 def test_no_valid_triangles(self):
     valid_triangles = Solver(from_str="5 10 25").solve_part_one()
     self.assertEqual(valid_triangles, 0)
 def test_valid_triangle(self):
     self.assertFalse(Solver.is_valid([5, 10, 25]))
Exemple #5
0
 def test_examples_for_part_one(self):
     self.assertEqual(Solver.santa_deliveries('>'), 2)
     self.assertEqual(Solver.santa_deliveries('^>v<'), 4)
     self.assertEqual(Solver.santa_deliveries('^v^v^v^v^v'), 2)
Exemple #6
0
 def test_solution(self):
     (one, two) = Solver(from_file='input/dec03.in').solve()
     self.assertEqual(one, 2081)
     self.assertEqual(two, 2341)
Exemple #7
0
 def test_examples_for_part_two(self):
     self.assertEqual(Solver.robo_santa_deliveries('^v'), 3)
     self.assertEqual(Solver.robo_santa_deliveries('^>v<'), 3)
     self.assertEqual(Solver.robo_santa_deliveries('^v^v^v^v^v'), 11)
Exemple #8
0
 def test_example_part_two(self):
     two = Solver(from_str=self.example_input).solve_part_two()
     self.assertEqual(two, 3)
Exemple #9
0
 def test_example_part_one(self):
     one = Solver(from_str=self.example_input).solve_part_one()
     self.assertEqual(one, 4)