def testeVM(jarAssembler, jarVM, testDir, vmDir, nasmDir, hackDir, gui,
            verbose):

    clearbin(nasmDir)
    clearbin(hackDir)

    print("------------------------------")
    print("- Translating src files       ")
    print("- to I-VMTranslator/bin/nasm/ ")
    print("------------------------------")
    compileVM(False, jarVM, vmDir + 'vm/', nasmDir)
    #compileVM(False, jarVM, vmDir+'vmExamples/', nasmDir)

    # montador
    print("-------------------------")
    print("- Assembling files .... ")
    print("-------------------------")
    sError, sLog = assemblerFromTestDir(jarAssembler, testDir, nasmDir,
                                        hackDir)

    # simulando
    print("-------------------------")
    print("- Simulating .... ")
    print("-------------------------")
    sError, sLog = simulateFromTestDir(testDir, hackDir, gui, verbose)
    if sError != ERRO_NONE:
        testeAssemblySimulateNotif(sError, sLog)
        sys.exit(1)

    # testAssembling files
    print("-------------------------")
    print("- Testando .... ")
    print("-------------------------")
    tError, tLog = compareFromTestDir(testDir)
def testeAssembly(jar, testDir, nasmDir, hackDir, gui, verbose):
    # global path
    os.path.abspath(nasm)
    os.path.abspath(hack)

    print("\n ==== Montando ============================")
    cError, cLog = assemblerFromTestDir(jar, testDir, nasmDir, hackDir)

    if cError > 0:
        compileAllNotify(cError, cLog)

    if cError == 0:
        print("\n-------------------------")
        print("- Simulando              ")
        print("-------------------------")
        clearTestDir(testDir)
        sError, sLog = simulateFromTestDir(testDir,
                                           hackDir,
                                           gui,
                                           verbose,
                                           rtlDir=PROJ_G_PATH +
                                           '/Z01-Simulator-RTL/')
        if sError != ERRO_NONE:
            testeAssemblySimulateNotif(sError, sLog)
            sys.exit(1)

        # testAssembling files
        print("\n-------------------------")
        print("- Testando               ")
        print("-------------------------")
        tError, tLog = compareFromTestDir(testDir)
        if tError:
            testeAssemblySimulateNotif(tError, tLog[:])
        return (tError, tLog)

    else:
        print("\n-------------------------")
        print("- DICA                   ")
        print("-------------------------")
        print(
            " \n --> OS TESTES SÓ SERÃO EXECUTADOS QUANDO NÃO TIVER MAIS ERROS DE COMPILACÃO \n"
        )
        print(
            " Para realizar os testes não podemos ter error de compilacão no assembly."
        )
        print(" Verifique o codigo com (erro de compilacao) e o corrija.")
        print(
            " Reveja a sintaxe em: https://github.com/insper/z01.1/wiki/AssemblyZ1 \n"
        )
        return (cError, cLog)
    return (0)