Example #1
0
def test_check_elem_action_seq():
    wh = Warehouse()
    wh.load_warehouse("./warehouses/warehouse_01.txt")
    # first test
    answer = check_elem_action_seq(wh, ['Right', 'Right', 'Down'])
    expected_answer = '####  \n# .#  \n#  ###\n#*   #\n#  $@#\n#  ###\n####  '
    fcn = test_check_elem_action_seq
    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 = check_elem_action_seq(wh, ['Right', 'Right', 'Right'])
    expected_answer = 'Impossible'
    fcn = test_check_elem_action_seq
    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_check_elem_action_seq():
    problem_file = "./warehouses/warehouse_01.txt"
    wh = Warehouse()
    wh.read_warehouse_file(problem_file)
    answer = check_elem_action_seq(wh, ['Right', 'Right','Down'])
    assert( answer == expected_answer_1)