def test_working_on_grid_with_improved_instructions(): test_grid = generate_grid(1000, 1000) process_command(test_grid, split_command("turn on 0,0 through 0,0", improved_action_factory)) assert 1 == sum_brightness(test_grid) test_grid = generate_grid(1000, 1000) process_command(test_grid, split_command("toggle 0,0 through 999,999", improved_action_factory)) assert 2000000 == sum_brightness(test_grid)
def test_work_on_grid(): test_grid = generate_grid(5, 5) assert count_activated_lamps(test_grid) == 0 process_command(test_grid, Command(toggle, (2, 2), (3, 3))) print_grid(test_grid) assert 4 == count_activated_lamps(test_grid) assert test_grid[2][2] assert test_grid[2][3] assert test_grid[3][2] assert test_grid[3][3] process_command(test_grid, Command(toggle, (2, 2), (3, 3))) print_grid(test_grid) assert 0 == count_activated_lamps(test_grid)