Exemplo n.º 1
0
def test_normal_nopath(capsys):

    argv = ['./304pacman', 'tests/deps/map_nopath', '+', ' ']
    argMan = Pacman(argv[2], argv[3]).run(argv[1])

    redir = capsys.readouterr()
    assert redir.out == "{}\n".format(MAP_NOPATH_OUTPUT)
Exemplo n.º 2
0
def test_tricky_case(capsys):

    argv = ['./304pacman', 'tests/deps/map2', '@', ' ']
    argMan = Pacman(argv[2], argv[3]).run(argv[1])

    redir = capsys.readouterr()
    assert redir.out == "{}\n".format(MAP2_OUTPUT)
Exemplo n.º 3
0
def main():

    argsManager = ArgumentManager()

    if argsManager.needHelp(argv):
        Usage()
    elif argsManager.checkArgs(argv) == 84:
        exit(84)
    else:
        Pacman(argv[2], argv[3]).run(argv[1])
Exemplo n.º 4
0
def test_several_pacmen(capsys):

    argv = ['./304pacman', 'tests/deps/map2pacmen', '+', ' ']

    try:
        argMan = Pacman(argv[2], argv[3]).run(argv[1])
    except SystemExit:
        redir = capsys.readouterr()
        assert redir.out == "Too many pacmans.\n"
    else:
        assert True is False    # Test has failed
Exemplo n.º 5
0
def test_no_ghost(capsys):

    argv = ['./304pacman', 'tests/deps/mapNoGhost', '+', ' ']

    try:
        argMan = Pacman(argv[2], argv[3]).run(argv[1])
    except SystemExit:
        redir = capsys.readouterr()
        assert redir.out == "No ghost in map.\n"
    else:
        assert True is False    # Test has failed