예제 #1
0
 def test_step(self):
     octopus_array = day11.load_into_array("example_small/example.txt")
     octopus_array_after_two_steps = day11.load_into_array(
         "example_small/after_step_02.txt")
     day11.step(octopus_array, 2)
     self.assertEqual(
         np.array_equal(octopus_array, octopus_array_after_two_steps), True)
예제 #2
0
 def test_step_final_little_by_little(self):
     for step_count in range(1, 10):
         octopus_array = day11.load_into_array("example_large/example.txt")
         step_filename = f"example_large/after_step_{str(step_count).zfill(2)}.txt"
         expected_array = day11.load_into_array(step_filename)
         day11.step(octopus_array, step_count)
         self.assertEqual(np.array_equal(octopus_array, expected_array),
                          True)
예제 #3
0
    def test_check_simultaneous_flash(self):
        octopus_array = day11.load_into_array("example3/example_true.txt")
        self.assertTrue(day11.check_simultaneous_flash(octopus_array))

        octopus_array = day11.load_into_array("example3/example_false1.txt")
        self.assertFalse(day11.check_simultaneous_flash(octopus_array))

        octopus_array = day11.load_into_array("example3/example_false2.txt")
        self.assertFalse(day11.check_simultaneous_flash(octopus_array))
예제 #4
0
 def test_get_simultaneous_flash_step(self):
     octopus_array = day11.load_into_array("example_large/example.txt")
     self.assertEqual(day11.get_simultaneous_flash_step(octopus_array), 195)
예제 #5
0
    def test_step_count_final(self):
        octopus_array = day11.load_into_array("example_large/example.txt")
        self.assertEqual(day11.step(octopus_array, 10), 204)

        octopus_array = day11.load_into_array("example_large/example.txt")
        self.assertEqual(day11.step(octopus_array, 100), 1656)
예제 #6
0
 def test_step_count(self):
     octopus_array = day11.load_into_array("example_small/example.txt")
     self.assertEqual(day11.step(octopus_array, 2), 9)