def test_part1(): with open('input.txt', 'r') as file: map = file.readlines() map = [line.strip() for line in map] vmap = VirusMap(map) vmap.do_bursts(10000) assert vmap.infection_counter == 5305
def test_burst(n, string): with open('test_input.txt', 'r') as file: map = file.readlines() map = [line.strip() for line in map] vmap = VirusMap(map) vmap.do_bursts(n) assert string_to_pattern(string) == vmap
def test_evolved_10million(): with open('test_input.txt', 'r') as file: map = file.readlines() map = [line.strip() for line in map] vmap = VirusMap(map, evolved=True) vmap.do_bursts(10000000) assert vmap.infection_counter == 2511944
def string_to_pattern(string): return VirusMap(string.split('\n'))