from os.path import dirname from os.path import realpath from os.path import join from donut import Donut import time if __name__ == "__main__": dir_path = dirname(realpath(__file__)) file_location = join(dir_path, "../data/input.txt") t0 = time.time() donut = Donut(file_location) part_one = donut.shortest_path() time_part_one = round((time.time() - t0) * 1e3) print( "Solution to part one: %s (time taken %s[ms])" % (part_one, time_part_one) ) t0 = time.time() part_two = donut.shortest_path(True) time_part_two = round((time.time() - t0) * 1e3) print( "Solution to part two: %s (time taken %s[ms])" % (part_two, time_part_two) )
def test_step1(input1,steps1): donut = Donut(input1) assert donut.shortest_path() == steps1
def test_step2(input2, steps2): donut = Donut(join(dirname(realpath(__file__)), input2)) assert donut.shortest_path(True) == steps2
def test_step2(input2,steps2): donut = Donut(input2) assert donut.shortest_path(True) == steps2
def test_step1(input1, steps1): donut = Donut(join(dirname(realpath(__file__)), input1)) assert donut.shortest_path() == steps1