def test_example_long(self): grid = Grid('..# #.. ...'.split()) virus = Virus(grid, (1, 1)) for _ in range(10000): virus._burst() assert virus._infect_count == 5587
def test_is_current_node_is_infected(self): grid = Grid('... .#. ...'.split()) virus = Virus(grid, (1, 1)) assert virus._is_current_node_infected() virus = Virus(grid, (0, 0)) assert not virus._is_current_node_infected()
def test_move_forward(self): virus = Virus(None, (0, 0)) virus._move_forward() assert virus._position == (0, -1)
def test_turn_right(self): virus = Virus(None, (0, 0)) for _ in range(4): virus._move_forward() virus._turn_right() assert virus._position == (0, 0)
def virus(): grid = build_grid(['.']) return Virus(grid)