示例#1
0
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)
    )
示例#2
0
def test_step1(input1,steps1):
    donut = Donut(input1)
    assert donut.shortest_path() == steps1
示例#3
0
def test_step2(input2, steps2):
    donut = Donut(join(dirname(realpath(__file__)), input2))
    assert donut.shortest_path(True) == steps2
示例#4
0
def test_step2(input2,steps2):
    donut = Donut(input2)
    assert donut.shortest_path(True) == steps2
示例#5
0
def test_step1(input1, steps1):
    donut = Donut(join(dirname(realpath(__file__)), input1))
    assert donut.shortest_path() == steps1