/***************************************************************************
*  Função: TAB Inicializar tabuleiro
*  ****/
   TAB_tpCondRet InicializarTabuleiro(TAB_tppTabuleiro pTabuleiro)
   {
	   int x, y;

      for (x = 0; x < LARGURA; x++)
      {
         for (y = 0; y < ALTURA; y++)
         {
            char *nome = NomeDaCasa(x, y);
            GRA_InserirVertice(pTabuleiro->pGrafo, nome, NULL);
            GRA_TornarCorrenteUmaOrigem(pTabuleiro->pGrafo);
         }
      }

      for (x = 0; x < LARGURA; x++)
      {
         for (y = 0; y < ALTURA; y++)
         {
            char *nome;
            nome = NomeDaCasa(x, y);
            GRA_InserirAresta(pTabuleiro->pGrafo, DirecaoComoString(NORTE)   , nome, NomeDaCasa(x, y-1));
            GRA_InserirAresta(pTabuleiro->pGrafo, DirecaoComoString(ESTE)    , nome, NomeDaCasa(x+1, y));
            GRA_InserirAresta(pTabuleiro->pGrafo, DirecaoComoString(SUL)     , nome, NomeDaCasa(x, y+1));
            GRA_InserirAresta(pTabuleiro->pGrafo, DirecaoComoString(OESTE)   , nome, NomeDaCasa(x-1, y));
            GRA_InserirAresta(pTabuleiro->pGrafo, DirecaoComoString(NORDESTE), nome, NomeDaCasa(x+1, y-1));
            GRA_InserirAresta(pTabuleiro->pGrafo, DirecaoComoString(SUDESTE) , nome, NomeDaCasa(x+1, y+1));
            GRA_InserirAresta(pTabuleiro->pGrafo, DirecaoComoString(SUDOESTE), nome, NomeDaCasa(x-1, y+1));
            GRA_InserirAresta(pTabuleiro->pGrafo, DirecaoComoString(NOROESTE), nome, NomeDaCasa(x-1, y-1));
         }
      }

      GRA_IrParaAOrigem(pTabuleiro->pGrafo, NomeDaCasa(0,0));

	   return TAB_CondRetOK ;
   }
Example #2
0
    GRA_tpCondRet GRA_InserirVizinhoCorrente( GRA_tppGrafo pGrafo , void* pValor, int idVertice, int idAresta ) {
        tpVertice * vizinho = NULL;
        tpVertice * u;
        tpVertice * v;
        GRA_tpCondRet r;

        /* Verifica se vertice pertence ao grafo; */
        if (pGrafo->corrente == -1) {
            return GRA_CondRetGrafoVazio;
        }
       
        vizinho = get_by_id(pGrafo,idVertice);
        /*
        por hipotese nao precisamos checar isso
        if(vizinho != NULL)
            return GRA_CondRetEhVertice;
        
        if(EhVizinho(pGrafo,get_by_id(pGrafo,pGrafo->corrente),vizinho))
           return GRA_CondRetEhVizinho;  
        */
        r = GRA_InserirVertice(pGrafo, pValor, idVertice);
        if(r != GRA_CondRetOK) return r;
        return GRA_InserirAresta(pGrafo,idVertice,pGrafo->corrente,idAresta);

    }
Example #3
0
/***********************************************************************
*
*  $FC Função: MEN CriarMenu
*
***********************************************************************/
    MEN_tpCondRet MEN_CriarMenu(MEN_tppMenus menus, int id, char* nome,int idpai) {
        MEN_tpCondRet cr;
        MEN_tppMenu m = (MEN_tppMenu)malloc(sizeof(Menu));
        if(m==NULL)
            return MEN_CondRetFaltouMemoria;
        m->opcoes = LIS_CriarLista(free);         
        if(m->opcoes==NULL){
            free(m);
            return MEN_CondRetFaltouMemoria;
        }
        m->nome = nome;
        m->id = id;
        m->pai = idpai;
        GRA_InserirVertice(menus->grafo,m,m->id);
        cr = MEN_CriarOpcao(menus, m->id,'0', "Ir para o menu acima\n\t\t (encerrar o programa caso o menu atual seja Inicio)",volta);
        if(cr!=MEN_CondRetOK)
        {
            LIS_DestruirLista(m->opcoes);
            free(m);
        }
        //tratar cond ret
        return cr;
    }
Example #4
0
TST_tpCondRet TST_EfetuarComando( char * ComandoTeste )
{

    int inxGrafo  = -1 ,
        numLidos   = -1 ,
        CondRetEsp = -1 ,
        param, numErros;

    char idVertice;
    char idVertice2;

    char StringDado[ DIM_VALOR ];

    VER_tppVertice novoVertice;

    TST_tpCondRet CondRet ;

    void * pDado ;

    char * pValor;

    /* Testar criar Grafo */
    if ( strcmp( ComandoTeste , CRIAR_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "ii" , &inxGrafo, &CondRetEsp ) ;

        if ( ( numLidos != 2 ) || ( ValidarInxGrafo( inxGrafo , NAO_VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        CondRet = GRA_CriarGrafo( &vtGRAFO[ inxGrafo ], DestruirValor );

        return TST_CompararInt( CondRetEsp , CondRet ,
                                "Condicao de retorno errada ao criar grafo."  ) ;

    } /* fim ativa: Testar criar Grafo */

    /* Testar destruir Grafo */
    else if ( strcmp( ComandoTeste , DESTRUIR_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "ii" , &inxGrafo, &CondRetEsp ) ;

        if ( ( numLidos != 2 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        CondRet = GRA_DestruirGrafo( vtGRAFO[ inxGrafo ] );

        vtGRAFO[ inxGrafo ] = NULL;

        return TST_CompararInt( CondRetEsp , CondRet ,
                                "Condicao de retorno errada ao destruir grafo."  ) ;

    } /* fim ativa: Testar destruir Grafo */

    /* Testar esvaziar Grafo */
    else if ( strcmp( ComandoTeste , ESV_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "ii" , &inxGrafo, &CondRetEsp ) ;

        if ( ( numLidos != 2 ) || (ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        CondRet = GRA_EsvaziarGrafo( vtGRAFO[ inxGrafo ] );

        return TST_CompararInt( CondRetEsp , CondRet ,
                                "Condicao de retorno errada ao esvaziar grafo."  ) ;

    } /* fim ativa: Testar esvaziar Grafo */

    /* Testar obter vertice corrente em Grafo */
    else if ( strcmp( ComandoTeste , CORR_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "isi" , &inxGrafo, StringDado, &CondRetEsp ) ;

        if ( ( numLidos != 3 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */


        CondRet = GRA_ObterValorCorrente( vtGRAFO[ inxGrafo ], &novoVertice );

        if(CondRet != GRA_CondRetOK)
            return TST_CompararInt( CondRetEsp , CondRet ,
                                    "Condicao de retorno errada ao obter valor corrente."  ) ;

        VER_ObterValor( novoVertice, &pValor);

        return TST_CompararString( StringDado , pValor ,
                                   "Retorno errado ao obter valor corrente."  ) ;

    } /* fim ativa: Testar obter vertice corrente em Grafo */

    /* Testar alterar vertice corrente em Grafo */
    else if ( strcmp( ComandoTeste , ALTCORR_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "isi" , &inxGrafo, StringDado, &CondRetEsp ) ;

        if ( ( numLidos != 3 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        VER_CriarVertice( &novoVertice );

#ifdef _DEBUG
        CED_DefinirTipoEspaco( novoVertice, ID_VER_tppVertice );
#endif

        VER_AtribuirValor( novoVertice, StringDado ) ;

        CondRet = GRA_AlterarValorCorrente( vtGRAFO[ inxGrafo ], novoVertice );

        if(CondRet != GRA_CondRetOK)
            VER_DestruirVertice(novoVertice);

        return TST_CompararInt( CondRetEsp , CondRet ,
                                "Condicao de retorno errada ao alterar corrente."  ) ;

    } /* fim ativa: Testar alterar vertice corrente em Grafo */

    /* Testar alterar vertice corrente para null em Grafo */
    else if ( strcmp( ComandoTeste , ALTCORRNULL_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "ii" , &inxGrafo, &CondRetEsp ) ;

        if ( ( numLidos != 2 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */


        CondRet = GRA_AlterarValorCorrente( vtGRAFO[ inxGrafo ], NULL );

        return TST_CompararInt( CondRetEsp , CondRet ,
                                "Condicao de retorno errada ao alterar corrente."  ) ;

    } /* fim ativa: Testar alterar vertice corrente em Grafo */

    /* Testar ir para vertice em Grafo */
    else if ( strcmp( ComandoTeste , IRVER_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "ici" , &inxGrafo, &idVertice, &CondRetEsp ) ;

        if ( ( numLidos != 3 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        CondRet = GRA_IrParaVertice( vtGRAFO[ inxGrafo ], idVertice );

        return TST_CompararInt( CondRetEsp , CondRet ,
                                "Condicao de retorno errada ao ir para vertice."  ) ;

    } /* fim ativa: Testar ir para vertice em Grafo */

    /* Testar andar para vertice em Grafo */
    else if ( strcmp( ComandoTeste , ANDARVER_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "ici" , &inxGrafo, &idVertice, &CondRetEsp ) ;

        if ( ( numLidos != 3 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        CondRet = GRA_AndarParaVertice( vtGRAFO[ inxGrafo ], idVertice );

        return TST_CompararInt( CondRetEsp , CondRet ,
                                "Condicao de retorno errada ao andar para vertice."  ) ;

    } /* fim ativa: Testar andar para vertice em Grafo */

    /* Testar inserir vertice em Grafo */
    else if ( strcmp( ComandoTeste , INSVER_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "isci" , &inxGrafo, StringDado, &idVertice, &CondRetEsp ) ;

        if ( ( numLidos != 4 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        VER_CriarVertice( &novoVertice );

#ifdef _DEBUG
        CED_EhEspacoAtivo( novoVertice );
        CED_DefinirTipoEspaco( novoVertice, ID_VER_tppVertice );
#endif

        VER_AtribuirValor( novoVertice, StringDado ) ;

        CondRet = GRA_InserirVertice( vtGRAFO[ inxGrafo ], novoVertice, idVertice );

        return TST_CompararInt( CondRetEsp , CondRet ,
                                "Condicao de retorno errada ao inserir vertice."  ) ;

    } /* fim ativa: Testar inserir vertice em Grafo */

    /* Testar inserir vertice de valor null em Grafo */
    else if ( strcmp( ComandoTeste , INSVERNULL_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "ici" , &inxGrafo, &idVertice, &CondRetEsp ) ;

        if ( ( numLidos != 3 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        CondRet = GRA_InserirVertice( vtGRAFO[ inxGrafo ], NULL, idVertice );

        return TST_CompararInt( CondRetEsp , CondRet ,
                                "Condicao de retorno errada ao inserir vertice."  ) ;

    } /* fim ativa: Testar inserir vertice de valor null em Grafo */

    /* Testar excluir vertice corrente em Grafo */
    else if ( strcmp( ComandoTeste , EXCCORR_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "ii" , &inxGrafo,  &CondRetEsp) ;

        if ( ( numLidos != 2 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        CondRet = GRA_ExcluirVerticeCorrente( vtGRAFO[ inxGrafo ] );

        return TST_CompararInt( CondRetEsp , CondRet ,
                                "Condicao de retorno errada ao excluir vertice corrente."  ) ;

    } /* fim ativa: Testar excluir vertice corrente em Grafo */

    /* Testar inserir aresta em Grafo */
    else if ( strcmp( ComandoTeste , INSAR_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "iccsi" , &inxGrafo, &idVertice, &idVertice2, StringDado, &CondRetEsp) ;

        if ( ( numLidos != 5 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        CondRet = GRA_InserirAresta( vtGRAFO[ inxGrafo ], idVertice, idVertice2, StringDado );

        return TST_CompararInt( CondRetEsp , CondRet ,
                                "Condicao de retorno errada ao inserir aresta."  ) ;

    } /* fim ativa: Testar inserir aresta em Grafo */

    /* Testar inserir aresta em origem no Grafo */
    else if ( strcmp( ComandoTeste , INSARO_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "icsi" , &inxGrafo, &idVertice, StringDado, &CondRetEsp) ;

        if ( ( numLidos != 4 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        CondRet = GRA_InserirArestaOrigemCorrente( vtGRAFO[ inxGrafo ], idVertice, StringDado );

        return TST_CompararInt( CondRetEsp , CondRet ,
                                "Condicao de retorno errada ao inserir aresta na origem corrente."  ) ;

    } /* fim ativa: Testar inserir aresta em origem no Grafo */

    /* Testar excluir aresta em Grafo */
    else if ( strcmp( ComandoTeste , EXCAR_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "isi" , &inxGrafo, StringDado, &CondRetEsp) ;

        if ( ( numLidos != 3 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        CondRet = GRA_ExcluirAresta( vtGRAFO[ inxGrafo ], StringDado );

        return TST_CompararInt( CondRetEsp , CondRet ,
                                "Condicao de retorno errada ao excluir aresta."  ) ;

    } /* fim ativa: Testar excluir aresta em Grafo */

    /* Testar adicionar origem em Grafo */
    else if ( strcmp( ComandoTeste , ADDOR_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "ici" , &inxGrafo, &idVertice, &CondRetEsp) ;

        if ( ( numLidos != 3 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        CondRet = GRA_AdicionarOrigem( vtGRAFO[ inxGrafo ], idVertice );

        return TST_CompararInt( CondRetEsp , CondRet ,
                                "Condicao de retorno errada ao adicionar origem."  ) ;

    } /* fim ativa: Testar adicionar origem em Grafo */

    /* Testar remover origem em Grafo */
    else if ( strcmp( ComandoTeste , RMVOR_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "ici" , &inxGrafo, &idVertice, &CondRetEsp) ;

        if ( ( numLidos != 3 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        CondRet = GRA_RemoverOrigem( vtGRAFO[ inxGrafo ], idVertice );

        return TST_CompararInt( CondRetEsp , CondRet ,
                                "Condicao de retorno errada ao remover origem."  ) ;

    } /* fim ativa: Testar remover origem em Grafo */

#ifdef _DEBUG
    /* Realizar deturpacao */
    else if ( strcmp( ComandoTeste , DETURPAR_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "ii" , &inxGrafo, &param) ;

        if ( ( numLidos != 2 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        return TST_CompararInt( GRA_CondRetOK , GRA_Deturpar(vtGRAFO[ inxGrafo ], param),
                                "Erro ao deturpar."  ) ;

    } /* fim ativa: Realizar deturpacao */

    /* Realizar verificao estrututral */
    else if ( strcmp( ComandoTeste , VERIFICAR_GRAFO_CMD  ) == 0 ) {

        numLidos = LER_LerParametros( "ii" , &inxGrafo, &param) ;

        if ( ( numLidos != 2 ) || ( ValidarInxGrafo( inxGrafo , VAZIO ) ) )
        {
            return TST_CondRetParm ;
        } /* if */

        GRA_VerificarEstrutura( vtGRAFO[ inxGrafo ], &numErros );

        return TST_CompararInt( param , numErros ,
                                "Total de erros errado ao verificar estrutura."  ) ;

    } /* fim ativa: Realizar verificao estrututral */

#endif

} /* Fim função: TGRA &Testar grafo */
   TST_tpCondRet TST_EfetuarComando(char *ComandoTeste)
   {
      int numLidos   = -1,
          CondRetEsp = -1;

      TST_tpCondRet CondRet;

      /*Testar CriarGrafo */

         if (strcmp (ComandoTeste, CRIAR_GRAFO_CMD) == 0)
         {

            numLidos = LER_LerParametros("i", &CondRetEsp);

            if (numLidos != 1)
            {
               return TST_CondRetParm;
            }

            CondRet = GRA_CriarGrafo(&pGrafo, DestruirValor);

            if(CondRet ==  GRA_CondRetOK)
            {
               CondRet = TST_CompararPonteiroNulo(1, pGrafo, "Erro em ponteiro de nova lista.");
               return CondRet;
            }

            return TST_CondRetErro;

         }

     /*Testar Destruir grafo */

         else if (strcmp(ComandoTeste, DESTRUIR_GRAFO_CMD) == 0)
         {

            numLidos = LER_LerParametros("i", &CondRetEsp);

            if (numLidos != 1)
            {
               return TST_CondRetParm;
            }

            CondRet = GRA_DestruirGrafo(&pGrafo);

            return TST_CompararInt(CondRetEsp, CondRet, "Erro ao destruir grafo");

         }
     
      /*Testar inserir vertice */

         else if (strcmp(ComandoTeste, INS_VERT_CMD) == 0)
         {
            char *nome = AlocarEspacoParaNome();
            char *pDado = AlocarEspacoParaNome();

            numLidos = LER_LerParametros("ssi", nome, pDado, &CondRetEsp);

            if (numLidos != 3)
            {
               return TST_CondRetParm;
            }

            CondRet = GRA_InserirVertice(pGrafo, nome, pDado);

            return TST_CompararInt(CondRetEsp, CondRet, "Condicao de retorno errada ao inserir vértice.");

         }
    
      /*Testar inserir aresta */

         else if (strcmp(ComandoTeste, INS_ARESTA_CMD) == 0)
         {
            char *nomeAresta = AlocarEspacoParaNome();
            char *nomeVerticeOrig = AlocarEspacoParaNome();
            char *nomeVerticeDest = AlocarEspacoParaNome();

            numLidos = LER_LerParametros("sssi", nomeAresta, nomeVerticeOrig, nomeVerticeDest, &CondRetEsp);

            if (numLidos != 4)
            {
               return TST_CondRetParm;
            }
   
            CondRet = GRA_InserirAresta(pGrafo, nomeAresta, nomeVerticeOrig, nomeVerticeDest);

            MEM_Free(nomeVerticeOrig);
            MEM_Free(nomeVerticeDest);

            return TST_CompararInt(CondRetEsp, CondRet, "Condicao de retorno errada ao inserir aresta.");
         }

      /*Testar obter valor do vértice corrente */

         else if (strcmp(ComandoTeste, OBTER_VALOR_CMD) == 0)
         {
            char *pDadoEsperado = AlocarEspacoParaNome();
            char *pDadoObtido;

            numLidos = LER_LerParametros("si", pDadoEsperado, &CondRetEsp);

            if (numLidos != 2)
            {
               MEM_Free(pDadoEsperado);
               return TST_CondRetParm;
            }

            if (strcmp(pDadoEsperado, SIMBOLO_PARA_NULL) == 0)
            {
               pDadoEsperado = NULL;
            }

            CondRet = GRA_ObterValorCorrente(pGrafo, (void**) &pDadoObtido);


            if (CondRetEsp == TST_CondRetOK)
            {
               CondRet = TST_CompararString(pDadoEsperado, pDadoObtido, "Valor do elemento errado.");
               MEM_Free(pDadoEsperado);
               return CondRet;
            }
            else
            {
               MEM_Free(pDadoEsperado);
               if (pDadoObtido != NULL)
               {
                  return TST_NotificarFalha("Não foi obtido null como conteudo ao ocorrer um erro."); 
               }

               return TST_CompararInt(CondRetEsp, CondRet, "Não ocorreu o erro esperado na obtenção do conteudo.");
            }
         }

       /*Testar alterar valor do vértice corrente */

         else if (strcmp(ComandoTeste, ALTER_VALOR_CMD) == 0)
         {
            char *pNovoValor = AlocarEspacoParaNome();
            char *pAntigoValor;

            numLidos = LER_LerParametros("si", pNovoValor, &CondRetEsp);

            if (numLidos != 2)
            {
               return TST_CondRetParm;
            }
            
            GRA_ObterValorCorrente(pGrafo, (void**) &pAntigoValor);
            MEM_Free(pAntigoValor);

            CondRet = GRA_AlterarValorCorrente(pGrafo, pNovoValor);

            return TST_CompararInt(CondRetEsp, CondRet, "Ocorreu um erro ao alterar o valor.");
         }


       /*Testar tornar corrente uma origem */

         else if (strcmp(ComandoTeste, TORNAR_ORIGEM_CMD) == 0)
         {
            numLidos = LER_LerParametros("i", &CondRetEsp);

            if (numLidos != 1)
            {
               return TST_CondRetParm;
            }

            CondRet = GRA_TornarCorrenteUmaOrigem(pGrafo);

            return TST_CompararInt(CondRetEsp, CondRet, "Ocorreu um erro ao tornar o corrente uma origem.");
         }


       /*Testar tornar corrente uma origem */

         else if (strcmp(ComandoTeste, DEIXAR_ORIGEM_CMD) == 0)
         {
            numLidos = LER_LerParametros("i", &CondRetEsp);

            if (numLidos != 1)
            {
               return TST_CondRetParm;
            }

            CondRet = GRA_DeixarDeSerOrigem(pGrafo);

            return TST_CompararInt(CondRetEsp, CondRet, "Ocorreu um erro remover uma origem.");
         }


        /*Testar seguir pela aresta */

       else if (strcmp(ComandoTeste, IR_ARESTA_CMD) == 0)
         {
            char *nomeDaAresta = AlocarEspacoParaNome();

            numLidos = LER_LerParametros("si", nomeDaAresta, &CondRetEsp);

            if (numLidos != 2)
            {
               return TST_CondRetParm;
            }

            CondRet = GRA_SeguirPelaAresta(pGrafo, nomeDaAresta);

            MEM_Free(nomeDaAresta);

            return TST_CompararInt(CondRetEsp, CondRet, "Ocorreu um erro ao ir para vértice adjacente.");
         }

       /*Testar ir vertice adjacente */

       else if (strcmp(ComandoTeste, IR_VERTICE_CMD) == 0)
         {
            char *nomeVertice = AlocarEspacoParaNome();

            numLidos = LER_LerParametros("si", nomeVertice, &CondRetEsp);

            if (numLidos != 2)
            {
               return TST_CondRetParm;
            }

            CondRet = GRA_IrParaVerticeAdjacente(pGrafo, nomeVertice);

            MEM_Free(nomeVertice);

            return TST_CompararInt(CondRetEsp, CondRet, "Ocorreu um erro ao ir para vértice adjacente.");
         }

        /*Testar ir para origem */

       else if (strcmp(ComandoTeste, IR_ORIGEM_CMD) == 0)
         {
            char *nomeVertice = AlocarEspacoParaNome();

            numLidos = LER_LerParametros("si", nomeVertice, &CondRetEsp);

            if (numLidos != 2)
            {
               return TST_CondRetParm;
            }

            CondRet = GRA_IrParaAOrigem(pGrafo, nomeVertice);

            MEM_Free(nomeVertice);

            return TST_CompararInt(CondRetEsp, CondRet, "Ocorreu um erro ao ir para origem.");
         }

         /*Testar ir destruir aresta adjacente */

       else if (strcmp(ComandoTeste, DESTRUIR_ARESTA_CMD) == 0)
         {
            char *nomeAresta = AlocarEspacoParaNome();

            numLidos = LER_LerParametros("si", nomeAresta, &CondRetEsp);

            if (numLidos != 2)
            {
               return TST_CondRetParm;
            }

            CondRet = GRA_DestruirArestaAdjacente(pGrafo, nomeAresta);

            MEM_Free(nomeAresta);

            return TST_CompararInt(CondRetEsp, CondRet, "Ocorreu um erro ao destruir aresta adjacente.");
         }

          /*Testar ir destruir aresta adjacente */

       else if (strcmp(ComandoTeste, DESTRUIR_VERT_CMD) == 0)
         {
            numLidos = LER_LerParametros("i", &CondRetEsp);

            if (numLidos != 1)
            {
               return TST_CondRetParm;
            }

            CondRet = GRA_DestruirVerticeCorrente(pGrafo);

            return TST_CompararInt(CondRetEsp, CondRet, "Ocorreu um erro ao destruir vertice corrente.");
         }

        /* Finalizar o teste */

       else if (strcmp(ComandoTeste, FIM_CMD) == 0)
         {
            MEM_LiberarTodaMemoriaAlocada();

            return TST_CondRetOK;
         }

      return TST_CondRetNaoConhec;

   }