LER_tpCondRet LER_AbrirArquivoScript( char * NomeArqParm ) { #ifdef _DEBUG TST_ASSERT( Inicializado ) ; #endif strcpy( NomeArqScript , NomeArqParm ) ; if ( TST_ObterInicioExtensao( NomeArqScript ) == NULL ) { strcat( NomeArqScript , DEFAULT_EXT_SCRIPT ) ; } /* if */ pArqScript = fopen( NomeArqScript , "rb" ) ; if ( pArqScript != NULL ) { printf( "\n Arquivo de teste: %s\n" , NomeArqParm ) ; AcabouScript = 0 ; return LER_CondRetOK ; } /* if */ NomeArqScript[ 0 ] = 0 ; return LER_CondRetNaoAbriu ; } /* Fim função: LER &Abrir arquivo script de teste */
tpCond AbrirArquivoLog( char * NomeArqParm ) { strcpy( NomeArqLog , NomeArqParm ) ; if ( TST_ObterInicioExtensao( NomeArqLog ) == NULL ) { strcat( NomeArqLog , DEFAULT_EXT_LOG ) ; } /* if */ pArqLog = fopen( NomeArqLog , "w" ) ; if ( pArqLog != NULL ) { return CondOK ; } /* if */ pArqLog = stdout ; NomeArqLog[ 0 ] = 0 ; return CondNaoAbriu ; } /* Fim função: TSTG -Abrir arquivo log */
void TerminarTeste( void ) { FILE * pArqAcumula = NULL ; int numMassasTeste = 0 ; int numCasosTeste = 0 ; int numCmdExecutados = 0 ; int numLinhasLidas = 0 ; int numFalhas = 0 ; /* Fechar o arquivo de script */ LER_TerminarLeitura( ) ; /* Acumular os resultados dos testes */ if ( NomeArquivoAcumulador[ 0 ] != 0 ) { if ( TST_ObterInicioExtensao( NomeArquivoAcumulador ) == NULL ) { strcat( NomeArquivoAcumulador , DEFAULT_EXT_ACUM ) ; } /* if */ pArqAcumula = fopen( NomeArquivoAcumulador , "r" ) ; if ( pArqAcumula != 0 ) { fscanf( pArqAcumula , " %d %d %d %d %d" , &numMassasTeste , &numCmdExecutados , &numCasosTeste , &numLinhasLidas , &numFalhas ) ; fclose( pArqAcumula ) ; } /* if */ numMassasTeste ++ ; numCasosTeste += ContaCasosTeste ; numCmdExecutados += ContaComandosExecutados ; numLinhasLidas += LER_ObterNumLinhas( ) ; numFalhas += ContaFalhas ; pArqAcumula = fopen( NomeArquivoAcumulador , "w" ) ; if ( pArqAcumula != 0 ) { fprintf( pArqAcumula , " %d %d %d %d %d" , numMassasTeste , numCmdExecutados , numCasosTeste , numLinhasLidas , numFalhas ) ; fclose( pArqAcumula ) ; } /* if */ } /* fim ativa: Acumular os resultados dos testes */ /* Exibir os resultados do teste */ ExibirResultados( pArqLog ) ; if ( pArqLog != stdout ) { ExibirResultados( stdout ) ; } /* if */ fprintf( pArqLog , "\n\n!!! Numero de espacos ainda alocados: %d", CED_ObterNumeroEspacosAlocados( ) ) ; /* Fechar o arquivo de log */ if ( pArqLog != stdout ) { fprintf( pArqLog , "\n" ) ; fclose( pArqLog ) ; pArqLog = stdout ; NomeArqLog[ 0 ] = 0 ; } /* fim ativa: Fechar o arquivo de log */ } /* Fim função: TSTG -Terminar a execução do módulo de teste */