Example #1
0
def test_can_go_there():
    puzzle_t1 = '#######\n#@ $. #\n#######'
    wh = Warehouse()
    wh.extract_locations(puzzle_t1.split(sep='\n'))
    # first test
    answer = can_go_there(wh, (1, 2))
    expected_answer = True
    fcn = test_can_go_there
    print('<<  First test of {} >>'.format(fcn.__name__))
    if answer == expected_answer:
        print(fcn.__name__, ' passed!  :-)\n')
    else:
        print(fcn.__name__, ' failed!  :-(\n')
        print('Expected ')
        print(expected_answer)
        print('But, received ')
        print(answer)
    # second test
    answer = can_go_there(wh, (1, 5))
    expected_answer = False
    print('<<  Second test of {} >>'.format(fcn.__name__))
    if answer == expected_answer:
        print(fcn.__name__, ' passed!  :-)\n')
    else:
        print(fcn.__name__, ' failed!  :-(\n')
        print('Expected ')
        print(expected_answer)
        print('But, received ')
        print(answer)
Example #2
0
def test_can_go_there():
    problem_file = "./warehouses/warehouse_01.txt"
    wh = Warehouse()
    wh.read_warehouse_file(problem_file)
    answer = can_go_there(wh, (30, 2))
    assert (answer == False)
    answer = can_go_there(wh, (6, 2))
    assert (answer == True)
Example #3
0
def test_can_go_there():
    problem_file = "./warehouses/warehouse_02.txt"
    wh = Warehouse()
    wh.read_warehouse_file(problem_file)
    print(wh)
    answer = can_go_there(wh,(2,6))
    #assert( answer ==  False)
    answer = can_go_there(wh,(2,6))
    #assert( answer ==  True)
    print(answer)
def test_can_go_there():
    problem_file = "./warehouses/warehouse_01.txt"
    wh = Warehouse()
    wh.read_warehouse_file(problem_file)
    answer = can_go_there(wh, (30, 2))
    if answer == False:
        print("Test_can_go_there() test 1 pass")
    answer = can_go_there(wh, (6, 2))
    if answer == True:
        print("Test_can_go_there() test 2 pass")
Example #5
0
def test_can_go_there():
    problem_file = "./warehouses/warehouse_01.txt"
    wh = Warehouse()
    wh.read_warehouse_file(problem_file)
    print(wh)
    print(wh.worker)
    answer = can_go_there(wh,(30,2))
    assert( answer ==  False)
    answer = can_go_there(wh,(6,4))
    assert( answer ==  True)
    print('We did it!')
Example #6
0
def test_can_go_there(test, dst, expected):
    wh = Warehouse()
    print(test)
    # removes unneccessary \n
    wh.from_lines(test.split(sep='\n'))
    answer = can_go_there(wh, dst)
    print(wh.worker, '->', dst, '=', answer)
    if answer is expected:
        print("Test Passed")
    else:
        print("Test Failed")