Beispiel #1
0
   TST_tpCondRet TST_CompararBool( int    ValorEsperado ,
                                   int    ValorObtido   ,
                                   char * pMensagem      )
   {

      if ( ( ValorObtido   != 0 )
        && ( ValorEsperado == 0 ))
      {
         ContaFalhas ++ ;
         TST_ExibirPrefixo( SINALIZA_ERRO , pMensagem ) ;
         fprintf( pArqLog , "Deveria ser: FALSE É: TRUE" ,
                  ValorEsperado , ValorObtido ) ;
         return TST_CondRetErro ;
      } /* if */

      if ( ( ValorObtido   == 0 )
        && ( ValorEsperado != 0 ))
      {
         ContaFalhas ++ ;
         TST_ExibirPrefixo( SINALIZA_ERRO , pMensagem ) ;
         fprintf( pArqLog , "Deveria ser: TRUE É: FALSE" ,
                  ValorEsperado , ValorObtido ) ;
         return TST_CondRetErro ;
      } /* if */

      return TST_CondRetOK ;

   } /* Fim função: TSTG &Comparar booleano */
Beispiel #2
0
   void TST_Assert( int Expressao , int Linha , char * NomeArq )
   {

      char Msg[ DIM_MSG ] ;

      if ( Expressao )
      {
         return ;
      } /* if */

      sprintf( Msg , "Assertiva falhou:  linha %d  arquivo: %s" ,
                          Linha , NomeArq ) ;

      TST_ExibirPrefixo( "\n   " , "************************************\n" ) ;
      TST_NotificarFalha( Msg ) ;

      TST_ExibirPrefixo( "\n   " , "Assertiva  Assertiva  Assertiva\n" ) ;

      if ( pArqLog != stdout )
      {
         fclose( pArqLog ) ;
         pArqLog = stdout ;

         TST_ExibirPrefixo( "\n   " , "************************************\n" ) ;
         TST_NotificarFalha( Msg ) ;

         TST_ExibirPrefixo( "\n   " , "Assertiva  Assertiva  Assertiva\n" ) ;

      } /* if */

      exit( 4 ) ;

   } /* Fim função: TSTG &Assertiva controlada */
Beispiel #3
0
   void LER_ExibirParametro( char * Simbolo )
   {

      tpElemSimbolo * pElem ;

      #ifdef _DEBUG
         TST_ASSERT( Inicializado ) ;
      #endif

      pElem = ( tpElemSimbolo * ) TBS_ProcurarSimbolo( pTabela , Simbolo ) ;

      if ( pElem == NULL )
      {
         TST_ExibirPrefixo( INFO_LER , "Parâmetro não definido: " ) ;
         fprintf( TST_ObterArqLog( ) , "%s" , Simbolo ) ;
         return ;
      } /* if */

      TST_ExibirPrefixo( INFO_LER , "Parâmetro: " ) ;
      fprintf( TST_ObterArqLog( ) , "%s" , Simbolo ) ;
      TST_ExibirEspacoHexa( sizeof( tpElemSimbolo ) , pElem ) ;

      if ( ( pElem->idTipo == ID_TIPO_STRING )
        || ( pElem->idTipo == ID_TIPO_NOME ))
      {
         TST_ExibirEspacoHexa( strlen( pElem->ValorTipado.ValorString ) + 1 ,
                                       pElem->ValorTipado.ValorString ) ;
      } /* if */

   } /* Fim função: LER  &Exibir declaração de símbolo */
Beispiel #4
0
   TST_tpCondRet TST_CompararEspaco( void * ValorEsperado ,
                                     void * ValorObtido   ,
                                     int    TamEspaco     ,
                                     char * pMensagem       )
   {

      int i ;

      /* Tratar espaços não iguais */

         if ( memcmp( ValorObtido , ValorEsperado , TamEspaco ) != 0 )
         {

            ContaFalhas ++ ;
            TST_ExibirPrefixo( SINALIZA_ERRO , pMensagem ) ;
            fprintf( pArqLog , "\n" ) ;

            for( i = 0 ; i < TamEspaco ; i += DIM_LINHA )
            {
               fprintf( pArqLog , "\n   %05d Nao é: " , i ) ;
               ImprimirHexadecimal( ValorEsperado , i , TamEspaco ) ;

               fprintf( pArqLog , "\n         É    : " ) ;
               ImprimirHexadecimal( ValorObtido , i , TamEspaco ) ;

               fprintf( pArqLog , "\n" ) ;
            } /* for */

            return TST_CondRetErro ;

         } /* fim ativa: Tratar espaços não iguais */

      return TST_CondRetOK ;

   } /* Fim função: TSTG &Comparar espaço */
Beispiel #5
0
   TST_tpCondRet InterpretarComandos( char * ComandoTeste )
   {

      TST_tpCondRet CondRetornada = TST_CondRetErro ;

      int IntEsp   = -1 ,
          numLidos = -1  ;

      /* Tratar comando de recuperação de falhas acumuladas */

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

            numLidos = LER_LerParametros( "i" , &IntEsp ) ;
            if ( numLidos != 1 )
            {
               return TST_CondRetParm ;
            } /* if */

            if ( IntEsp == ContaFalhas )
            {
               ContaFalhas = 0 ;
               TST_ExibirPrefixo( "<<<" , "Falhas registradas eram esperadas e foram recuperadas." ) ;
               return TST_CondRetOK ;
            } /* if */

            return TST_CompararInt( IntEsp , ContaFalhas ,
                      "Número de falhas esperadas errado." ) ;

         } /* fim ativa: Tratar comando de recuperação de falhas acumuladas */

      /* Interpretar comandos de leitura */

         CondRetornada = LER_InterpretarComandos( ComandoTeste ) ;
         if ( CondRetornada != TST_CondRetNaoExecutou )
         {
            return CondRetornada ;
         } /* if */

      /* Interpretar comandos de contagem */

         CondRetornada = ICNT_EfetuarComadoContagem( ComandoTeste ) ;
         if ( CondRetornada != TST_CondRetNaoExecutou )
         {
            return CondRetornada ;
         } /* if */

      /* Interpretar comandos de controle de acesso */

         CondRetornada = ICED_InterpretarTesteEspaco( ComandoTeste ) ;
         if ( CondRetornada != TST_CondRetNaoExecutou )
         {
            return CondRetornada ;
         } /* if */

      /* Interpretar comandos específicos do módulo a testar */

         return TST_EfetuarComando( ComandoTeste ) ;

   } /* Fim função: TSTG -Efetuar os comandos de teste específicos */
Beispiel #6
0
   void ExibirErro( char * Msg )
   {

      TST_ContarFalhas( ) ;
      TST_ExibirPrefixo( ERRO_LER , Msg ) ;

   } /* Fim função: LER  -Exibir erro */
Beispiel #7
0
   TST_tpCondRet TST_NotificarFalha( char * pMensagem )
   {

      ContaFalhas ++ ;
      TST_ExibirPrefixo( SINALIZA_ERRO , pMensagem ) ;
      return TST_CondRetErro ;

   } /* Fim função: TSTG &Notificar falha */
Beispiel #8
0
   TST_tpCondRet TST_CompararPonteiro( void * PonteiroEsperado ,
                                       void * PonteiroObtido   ,
                                       char * pMensagem       )
   {

      if ( PonteiroObtido != PonteiroEsperado )
      {
         ContaFalhas ++ ;
         TST_ExibirPrefixo( SINALIZA_ERRO , pMensagem ) ;
         fprintf( pArqLog , "Deveria ser: %p  É: %p" ,
                  PonteiroEsperado , PonteiroObtido ) ;
         return TST_CondRetErro ;
      } /* if */
      return TST_CondRetOK ;

   } /* Fim função: TSTG &Comparar ponteiro */
Beispiel #9
0
   TST_tpCondRet TST_CompararString( char * ValorEsperado ,
                                     char * ValorObtido   ,
                                     char * pMensagem       )
   {

      if ( strcmp( ValorObtido , ValorEsperado ) != 0 )
      {
         ContaFalhas ++ ;
         TST_ExibirPrefixo( SINALIZA_ERRO , pMensagem ) ;
         fprintf( pArqLog , "Deveria ser: >%s<  É: >%s<" ,
                  ValorEsperado , ValorObtido ) ;
         return TST_CondRetErro ;
      } /* if */
      return TST_CondRetOK ;

   } /* Fim função: TSTG &Comparar string */
Beispiel #10
0
   TST_tpCondRet TST_CompararInt( long   ValorEsperado ,
                                  long   ValorObtido   ,
                                  char * pMensagem       )
   {

      if ( ValorObtido != ValorEsperado )
      {
         ContaFalhas ++ ;
         TST_ExibirPrefixo( SINALIZA_ERRO , pMensagem ) ;
         fprintf( pArqLog , "Deveria ser: %ld  É: %ld" ,
                  ValorEsperado , ValorObtido ) ;
         return TST_CondRetErro ;
      } /* if */
      return TST_CondRetOK ;

   } /* Fim função: TSTG &Comparar inteiro */
Beispiel #11
0
   TST_tpCondRet TST_CompararChar( char   ValorEsperado ,
                                   char   ValorObtido   ,
                                   char * pMensagem       )
   {

      if ( ValorObtido != ValorEsperado )
      {
         ContaFalhas ++ ;
         TST_ExibirPrefixo( SINALIZA_ERRO , pMensagem ) ;
         fprintf( pArqLog , "Deveria ser: '%c'  É: '%c'" ,
                  ValorEsperado , ValorObtido ) ;
         return TST_CondRetErro ;
      } /* if */
      return TST_CondRetOK ;

   } /* Fim função: TSTG &Comparar caractere */
Beispiel #12
0
   TST_tpCondRet TST_CompararPonteiroNulo( int    ModoEsperado ,
                                           void * PonteiroObtido   ,
                                           char * pMensagem       )
   {

      if ( (( ModoEsperado == 0 ) && ( PonteiroObtido != NULL ))
        || (( ModoEsperado != 0 ) && ( PonteiroObtido == NULL )) )
      {
         ContaFalhas ++ ;
         TST_ExibirPrefixo( SINALIZA_ERRO , pMensagem ) ;
         if ( ModoEsperado )
         {
            fprintf( pArqLog , "Deveria ser: não NULL  É: NULL" ) ;
         } else
         {
            fprintf( pArqLog , "Deveria ser: NULL  É: %p" ,
                     PonteiroObtido ) ;
         } /* if */
         return TST_CondRetErro ;
      } /* if */
      return TST_CondRetOK ;

   } /* Fim função: TSTG &Comparar ponteiro nulo */
Beispiel #13
0
   TST_tpCondRet TST_CompararFloat( double   ValorEsperado ,
                                    double   ValorObtido   ,
                                    double   Tolerancia    ,
                                    char *   pMensagem      )
   {

      double Razao ;

      Razao = ValorEsperado / ValorObtido ;
         
      if ( ( Razao < 1.0 - Tolerancia )
        || ( Razao > 1.0 + Tolerancia ))
      {
         ContaFalhas ++ ;
         TST_ExibirPrefixo( SINALIZA_ERRO , pMensagem ) ;
         fprintf( pArqLog , "Tolerância %lg, esperado: %lg , obtido: %lg" ,
                  Tolerancia , ValorEsperado , ValorObtido ) ;
         return TST_CondRetErro ;
      } /* if */
      return TST_CondRetOK ;
         

   } /* Fim função: TSTG &Comparar flutuante */
Beispiel #14
0
   TST_tpCondRet RealizarTeste( char * Construto )
   {

      int NumLidos ,
          SaltaComandos ;

      int EhCasoTesteVazio = 0 ;

      char ComandoTeste[ DIM_COMANDO_TESTE ] ;

      int Dummy ;

      TST_tpCondRet CondRetornada = TST_CondRetErro ;

      if ( pArqLog == stdout )
      {
         fprintf( pArqLog , "\n" ) ;

      } else
      {
         fprintf( pArqLog , "\n%s Inicio dos testes" ,
                  SINALIZA_COMENTARIO ) ;
         fprintf( pArqLog , "\n%s      Construto sob teste: %s" ,
                  SINALIZA_COMENTARIO , Construto ) ;
         fprintf( pArqLog , "\n%s      Script de teste:     %s\n" ,
                  SINALIZA_COMENTARIO , LER_ObterNomeArqScript( )) ;
      } /* if */

      SaltaComandos = 1 ;
      NumLidos = LER_LerLinhaScript( ) ;

      CED_InicializarControlador( ) ;

      while ( NumLidos >= 0 ) {

      /* Obter comando de teste */

         if ( LER_TamBuffer > 0 )
         {

            ComandoTeste[ 0 ] = 0 ;
            ComandoTeste[ DIM_COMANDO_TESTE - 1 ] = 0 ;
            ComandoTeste[ DIM_COMANDO_TESTE - 2 ] = '\xA9' ; /* controles de extravasão do buffer de leitura */

            if ( sscanf( LER_Buffer , "%s" , ComandoTeste ) != 1 )
            {
               ContaFalhas ++ ;
               TST_ExibirPrefixo( SINALIZA_ERRO , "Linha não contém comando:" ) ;
               fprintf( pArqLog , " %s" , LER_Buffer ) ;
               LER_TamBuffer = -1 ;

            } else if ( ( ComandoTeste[ DIM_COMANDO_TESTE - 1 ] != 0 )
                     && ( ComandoTeste[ DIM_COMANDO_TESTE - 2 ] != '\xA9' ))
            {
               ContaFalhas ++ ;
               TST_ExibirPrefixo( SINALIZA_ERRO , "Comando extravasou o espaço para leitura:" ) ;
               fprintf( pArqLog , " %s" , LER_Buffer ) ;
               LER_TamBuffer = -1 ;
               break ;
            } /* if */

         } /* fim ativa: Obter comando de teste */

      /* Tratar linha em branco */

         if ( LER_TamBuffer <= 0 )
         {

         } /* fim ativa: Tratar linha em branco */

      /* Tratar comentário */

         else if ( memcmp( ComandoTeste , COMMENT_CMD , strlen( COMMENT_CMD )) == 0 )
         {

            TST_ExibirPrefixo( SINALIZA_COMENTARIO , LER_Buffer ) ;

         } /* fim ativa: Tratar comentário */

      /* Tratar comando breakpoint */

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

            Dummy = 0 ;

         } /* fim ativa: Tratar comando breakpoint */

      /* Tratar de comando de cancelamento */

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

            ContaFalhas ++ ;
            TST_ExibirPrefixo( SINALIZA_COMENTARIO ,
                      "Solicitado o cancelamento da execução do script de teste." ) ;
            break ;

         } /* fim ativa: Tratar de comando de cancelamento */

      /* Tratar início de caso de teste */

         else if ( memcmp( ComandoTeste , INICIO_CMD , strlen( INICIO_CMD )) == 0 )
         {

            if ( EhCasoTesteVazio != 0 )
            {
               ContaFalhas ++ ;
               TST_ExibirPrefixo( SINALIZA_ERRO , "O caso de teste anterior está vazio." ) ;
            } /* if */

            fprintf( pArqLog , "\n%5d  %s" , LER_ObterNumLinhas( ) , LER_Buffer ) ;
            ContaCasosTeste ++ ;
            SaltaComandos    = 0 ;

            EhCasoTesteVazio = 1 ;

         } /* fim ativa: Tratar início de caso de teste */

      /* Interpretar comandos de teste específicos */

         else if ( SaltaComandos == 0 )
         {

            EhCasoTesteVazio = 0 ;
            CondRetornada = InterpretarComandos( ComandoTeste ) ;

            switch ( CondRetornada ) {

            /* Tratar retorno OK */

               case TST_CondRetOK :
               {

                  ContaComandosExecutados ++ ;

                  break ;

               } /* fim ativa: Tratar retorno OK */

            /* Tratar retorno função testada não retornou OK */

               case TST_CondRetErro :
               {

                  NumLidos = LER_LerLinhaScript( ) ;

                  if ( memcmp( LER_Buffer , RECUPERA_CMD , strlen( RECUPERA_CMD )) == 0 )
                  {
                     ContaFalhas -- ;
                     TST_ExibirPrefixo( SINALIZA_RECUPERA , "Falha esperada foi recuperada." ) ;
                  } else {
                     if ( LER_Buffer[ 0 ] != 0 )
                     {
                        ContaFalhas ++ ;
                        TST_ExibirPrefixo( SINALIZA_ERRO , "Não é comando recuperar:" ) ;
                        fprintf( pArqLog , " %s" , LER_Buffer ) ;
                        SaltaComandos = 1 ;
                     } /* if */
                  } /* if */

                  break ;

               } /* fim ativa: Tratar retorno função testada não retornou OK */

            /* Tratar retorno erro de parâmetro em comando */

               case TST_CondRetParm :
               {

                  ContaFalhas ++ ;
                  TST_ExibirPrefixo( SINALIZA_ERRO , "Erro nos parâmetros do comando:" ) ;
                  fprintf( pArqLog , " %s" , LER_Buffer ) ;

                  NumLidos = LER_LerLinhaScript( ) ;

                  if ( memcmp( LER_Buffer , RECUPERA_CMD , strlen( RECUPERA_CMD )) == 0 )
                  {
                     ContaFalhas -- ;
                     TST_ExibirPrefixo( SINALIZA_RECUPERA , "Falha esperada foi recuperada." ) ;
                  } else {
                     SaltaComandos = 1 ;
                  } /* if */

                  break ;

               } /* fim ativa: Tratar retorno erro de parâmetro em comando */

            /* Tratar comando ainda não implementado */

               case TST_CondRetNaoImplementado :
               {

                  ContaFalhas ++ ;
                  TST_ExibirPrefixo( SINALIZA_ERRO , "Comando de teste ainda não implementado:" ) ;
                  fprintf( pArqLog , " %s" , LER_Buffer ) ;
                  SaltaComandos = 1 ;

                  break ;

               } /* fim ativa: Tratar comando ainda não implementado */

            /* Tratar retorno comando desconhecido */

               case TST_CondRetNaoConhec :
               case TST_CondRetNaoExecutou :
               {

                  ContaFalhas ++ ;
                  TST_ExibirPrefixo( SINALIZA_ERRO , "Comando não conhecido:" ) ;
                  fprintf( pArqLog , " %s" , LER_Buffer ) ;
                  SaltaComandos = 1 ;

                  break ;

               } /* fim ativa: Tratar retorno comando desconhecido */

            /* Tratar retorno faltou memória */

               case TST_CondRetMemoria :
               {

                  ContaFalhas ++ ;
                  TST_ExibirPrefixo( SINALIZA_ERRO , "Faltou memória para o comando:" ) ;
                  fprintf( pArqLog , " %s" , LER_Buffer ) ;
                  SaltaComandos = 1 ;

                  break ;

               } /* fim ativa: Tratar retorno faltou memória */

            /* Tratar retorno desconhecido */

               default :
               {

                  ContaFalhas ++ ;
                  TST_ExibirPrefixo( SINALIZA_ERRO , "Condição de retorno não conhecida:" ) ;
                  fprintf( pArqLog , " %d" , CondRetornada ) ;
                  SaltaComandos = 1 ;

                  break ;

               } /* fim ativa: Tratar retorno desconhecido */

            } /* fim seleciona: Interpretar comandos de teste específicos */

         } /* fim ativa: Interpretar comandos de teste específicos */

      /* Tratar salto de comandos */

         else
         {

            ContaFalhas ++ ;
            TST_ExibirPrefixo( SINALIZA_ERRO , "Comando de teste ignorado:" ) ;
            fprintf( pArqLog , " %s" , LER_Buffer ) ;

         } /* fim ativa: Tratar salto de comandos */

      /* Avançar para a próxima linha */

         NumLidos = LER_LerLinhaScript( ) ;

      } /* fim repete: Raiz de TSTG -Interpretar toda a massa de teste */

      if ( ContaFalhas > 0 )
      {
         return TST_CondRetErro ;
      } else {
         return TST_CondRetOK ;
      } /* if */

   } /* Fim função: TSTG -Interpretar toda a massa de teste */
Beispiel #15
0
   TST_tpCondRet ICNT_EfetuarComadoContagem( char * ComandoTeste )
   {

      char   NomeArquivo[  DIM_NOME_ARQ ] ;
      char   NomeContador[ DIM_NOME_CONTADOR ] ;

      int    numLidos ,
             IntEsp   ,
             IntObtido ;

      CNT_tpCondRet CondRetEsp ,
                    CondRetEh ;

      /* Tratar CNT  &Inicializar contadores */

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

            /*
               CNT_tpCondRet CNT_InicializarContadores( FILE * pArqLog , char * NomeArquivo )
            */

            CondRetEsp = CNT_CondRetOK ;

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

            if ( numLidos < 1 )
            {
               CondRetEsp = CNT_CondRetErro ;
            } /* if */

            if ( ( NomeArquivo[ 0 ] == 0   )
              || ( numLidos < 1            ))
            {
               CondRetEh = CNT_InicializarContadores( NULL ) ;
            } else {
               CondRetEh = CNT_InicializarContadores( NomeArquivo ) ;
            } /* if */

            return TST_CompararInt( CondRetEsp , CondRetEh ,
                    "Condição de retorno errada." ) ;

         } /* fim ativa: Tratar CNT  &Inicializar contadores */

      /* Tratar CNT  &Terminar contadores */

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

            /*
               CNT_tpCondRet CNT_TerminarContadores( )
            */

            CondRetEsp = CNT_CondRetOK ;

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

            return TST_CompararInt( CondRetEsp , CNT_TerminarContadores( ) ,
                             CondRetErrada ) ;

         } /* fim ativa: Tratar CNT  &Terminar contadores */

      /* Tratar CNT  &Registrar arquivo acumulador */

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

            /*
               void CNT_RegistrarAcumulador( char * NomeArquivo ) ;
            */

            numLidos = LER_LerParametros( "s" ,
                               NomeArquivo ) ;
            if ( numLidos != 1 )
            {
               return TST_CondRetParm ;
            } /* if */

            if ( NomeArquivo[ 0 ] == 0 )
            {
               CNT_RegistrarAcumulador( NULL ) ;
            } else {
               CNT_RegistrarAcumulador( NomeArquivo ) ;
            } /* if */

            return TST_CondRetOK ;

         } /* fim ativa: Tratar CNT  &Registrar arquivo acumulador */

      /* Tratar CNT  &Ler arquivo de definição de contadores */

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

            /*
               int CNT_LerContadores( char * NomeArquivoDefinicao )
            */
            IntEsp = 0 ;

            numLidos = LER_LerParametros( "si" ,
                               NomeArquivo , &IntEsp ) ;

            if ( ( numLidos < 1 )
              || ( IntEsp   < 0 ))
            {
               return TST_CondRetParm ;
            } /* if */

            return TST_CompararInt( IntEsp , CNT_LerContadores( NomeArquivo ) ,
                      "Número de erros de leitura errado." ) ;

         } /* fim ativa: Tratar CNT  &Ler arquivo de definição de contadores */

      /* Tratar CNT  &Gravar arquivo de contagem acumulada */

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

            /*
               int CNT_GravarContadores( char * NomeArquivo )
            */
            IntEsp = 0 ;

            numLidos = LER_LerParametros( "si" ,
                               NomeArquivo , &IntEsp ) ;

            if ( ( numLidos < 1 )
              || ( IntEsp   < 0 ))
            {
               return TST_CondRetParm ;
            } /* if */

            return TST_CompararInt( IntEsp , CNT_GravarContadores( NomeArquivo ) ,
                      "Número de erros de gravação errado." ) ;

         } /* fim ativa: Tratar CNT  &Gravar arquivo de contagem acumulada */

      /* Tratar CNT  &Zerar todos contadores */

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

            /*
               CNT_tpCondRet CNT_ZerarContadores( )
            */

            CondRetEsp = CNT_CondRetOK ;

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

            return TST_CompararInt( CondRetEsp , CNT_ZerarContadores( ) ,
                      CondRetErrada ) ;

         } /* fim ativa: Tratar CNT  &Zerar todos contadores */

      /* Tratar CNT  &Zerar contador dado */

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

            /*
               CNT_tpCondRet CNT_ZerarContador( char * NomeContador )
            */

            CondRetEsp = CNT_CondRetOK ;

            numLidos = LER_LerParametros( "si" ,
                               NomeContador , &CondRetEsp ) ;
            if ( numLidos < 1 )
            {
               return TST_CondRetParm ;
            } /* if */

            return TST_CompararInt( CondRetEsp , CNT_ZerarContador( NomeContador ) ,
                      CondRetErrada ) ;

         } /* fim ativa: Tratar CNT  &Zerar contador dado */

      /* Tratar CNT  &Iniciar a contagem */

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

            /*
               void CNT_IniciarContagem( )
            */

            CNT_IniciarContagem( ) ;

            return TST_CondRetOK ;

         } /* fim ativa: Tratar CNT  &Iniciar a contagem */

      /* Tratar CNT  &Parar contagem */

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

            /*
               void CNT_PararContagem( )
            */

            CNT_PararContagem( ) ;

            return TST_CondRetOK ;

         } /* fim ativa: Tratar CNT  &Parar contagem */

      /* Tratar CNT  &Obter valor de contagem */

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

            /*
               long CNT_ObterContagem( char * NomeContador )
            */

            numLidos = LER_LerParametros( "si" ,
                               NomeContador , &IntEsp ) ;
            if ( numLidos != 2 )
            {
               return TST_CondRetParm ;
            } /* if */

            return TST_CompararInt( IntEsp ,
                      ( int ) CNT_ObterContagem( NomeContador ) ,
                      "Valor de contagem errado." ) ;

         } /* fim ativa: Tratar CNT  &Obter valor de contagem */

      /* Tratar Exibir valor de contagem */

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

            /*
               long CNT_ObterContagem( char * NomeContador )
            */

            numLidos = LER_LerParametros( "s" ,
                               NomeContador ) ;
            if ( numLidos != 1 )
            {
               return TST_CondRetParm ;
            } /* if */

            IntObtido = ( int ) CNT_ObterContagem( NomeContador ) ;
            if ( IntObtido == CNT_CondRetNaoContador )
            {
               TST_NotificarFalha( "Contador desconhecido: " ) ;
               fprintf( TST_ObterArqLog( ) , "\"%s\"" , NomeContador ) ;
               return TST_CondRetErro ;
            } /* if */

            TST_ExibirPrefixo( SINALIZA_COMENTARIO , "" ) ;
            fprintf( TST_ObterArqLog( ) , "Valor do contador \"%s\" é: %d " ,
                               NomeContador , IntObtido ) ;

            return TST_CondRetOK ;

         } /* fim ativa: Tratar Exibir valor de contagem */

      /* Tratar CNT  &Obter número de contadores */

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

            /*
               int CNT_ObterNumeroContadores( )
            */

            numLidos = LER_LerParametros( "i" ,
                               &IntEsp ) ;
            if ( numLidos != 1 )
            {
               return TST_CondRetParm ;
            } /* if */

            return TST_CompararInt( IntEsp , CNT_ObterNumeroContadores( ) ,
                      "Número de contadores errado." ) ;

         } /* fim ativa: Tratar CNT  &Obter número de contadores */

      /* Tratar CNT  &Obter total de contagem */

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

            /*
               long CNT_ObterContagemTotal( )
            */

            numLidos = LER_LerParametros( "i" ,
                               &IntEsp ) ;
            if ( numLidos != 1 )
            {
               return TST_CondRetParm ;
            } /* if */

            return TST_CompararInt( IntEsp ,
                      ( int ) CNT_ObterContagemTotal( ) ,
                      "Contagem total errada." ) ;

         } /* fim ativa: Tratar CNT  &Obter total de contagem */

      /* Tratar CNT  &Verificar contagem */

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

            /*
               int CNT_VerificarContagem( )
            */

            numLidos = LER_LerParametros( "i" ,
                               &IntEsp ) ;
            if ( numLidos != 1 )
            {
               return TST_CondRetParm ;
            } /* if */

            return TST_CompararInt( IntEsp ,
                      CNT_VerificarContagem( ) ,
                      "Número de contadores zero errado." ) ;

         } /* fim ativa: Tratar CNT  &Verificar contagem */

      return TST_CondRetNaoExecutou ;

   } /* Fim função: ICNT &Interpretar comandos de contagem */