def test_part2(): with open('input.txt') as f: specs = f.readlines() bots = [day23.Nanobot(spec) for spec in specs] point = day23.in_range_of_most(bots) assert day23.distance(point, np.array([0, 0, 0])) == 107272899
def test_part1(): with open('input.txt') as f: specs = f.readlines() bots = [day23.Nanobot(spec) for spec in specs] bot = day23.get_strongest_bot(bots) bots_in_range = bot.in_range(bots) assert len(bots_in_range) == 433
def test_in_range_of_most_and_dist(): bots = [day23.Nanobot(spec) for spec in part2_test_input.split('\n')] point = day23.in_range_of_most(bots) assert day23.distance(point, np.array([0, 0, 0])) == 36
def test_in_range_of_most(): bots = [day23.Nanobot(spec) for spec in part2_test_input.split('\n')] point = day23.in_range_of_most(bots) assert np.array_equal(point, np.array([12, 12, 12]))
def test2(): bots = [day23.Nanobot(spec) for spec in test_input.split('\n')] bot = day23.get_strongest_bot(bots) bots_in_range = bot.in_range(bots) assert len(bots_in_range) == 7
def test1(): bots = [day23.Nanobot(spec) for spec in test_input.split('\n')] bot = day23.get_strongest_bot(bots) assert np.all(np.array([0, 0, 0]) == bot.pos) assert bot.range == 4