executa_caso_fatal
Gerada por tools/gerar_documentacao.py. Definição: tests/test_biblioteca.c:464.
Despacha um modo de teste que deve terminar em erro fatal ou, em representação alternativa, código 3.
Tipo: função C · Visibilidade: interna (static) · Arquivo: tests/test_biblioteca.c.
Assinatura e expansão
static int executa_caso_fatal(const char *caso)
Parâmetros formais: const char *caso.
Como funciona
Compara o argumento com nomes de modo e chama a primitiva correspondente. O runner verifica status 1 e trecho de stderr; nos casos de representabilidade também aceita status 3 sem stderr.
Implementação completa · 85 linhas
{
if (strcmp(caso, "erro") == 0) {
bg_erro("teste.c", 37, "falha esperada");
} else if (strcmp(caso, "passo") == 0) {
(void) bg_passo_zero("teste.c", 38);
} else if (strcmp(caso, "divide-zero") == 0) {
(void) bg_divide_i(1, 0, "teste.c", 39);
} else if (strcmp(caso, "divide-estouro") == 0) {
#if INT_MIN == -INT_MAX
return 3; /* representacao alternativa de sinal: magnitude cabe */
#endif /* INT_MIN == -INT_MAX */
(void) bg_divide_i(INT_MIN, -1, "teste.c", 40);
} else if (strcmp(caso, "divide-estouro-l") == 0) {
#if LONG_MIN == -LONG_MAX
return 3; /* representacao alternativa de sinal: magnitude cabe */
#endif /* LONG_MIN == -LONG_MAX */
(void) bg_divide_l(LONG_MIN, -1L, "teste.c", 56);
} else if (strcmp(caso, "divide-estouro-ll") == 0) {
#if LLONG_MIN == -LLONG_MAX
return 3; /* representacao alternativa de sinal: magnitude cabe */
#endif /* LLONG_MIN == -LLONG_MAX */
(void) bg_divide_ll(LLONG_MIN, -1LL, "teste.c", 57);
} else if (strcmp(caso, "divide-zero-l") == 0) {
(void) bg_divide_l(1L, 0L, "teste.c", 43);
} else if (strcmp(caso, "divide-zero-ll") == 0) {
(void) bg_divide_ll(1LL, 0LL, "teste.c", 44);
} else if (strcmp(caso, "divide-zero-u") == 0) {
(void) bg_divide_u(1U, 0U, "teste.c", 45);
} else if (strcmp(caso, "divide-zero-ul") == 0) {
(void) bg_divide_ul(1UL, 0UL, "teste.c", 46);
} else if (strcmp(caso, "divide-zero-ull") == 0) {
(void) bg_divide_ull(1ULL, 0ULL, "teste.c", 47);
} else if (strcmp(caso, "divide-zero-f") == 0) {
(void) bg_divide_f(1.0F, 0.0F, "teste.c", 48);
} else if (strcmp(caso, "divide-zero-d") == 0) {
(void) bg_divide_d(1.0, 0.0, "teste.c", 49);
} else if (strcmp(caso, "divide-zero-ld") == 0) {
(void) bg_divide_ld(1.0L, 0.0L, "teste.c", 50);
} else if (strcmp(caso, "resto-zero") == 0) {
(void) bg_resto_i(1, 0, "teste.c", 41);
} else if (strcmp(caso, "resto-estouro") == 0) {
#if INT_MIN == -INT_MAX
return 3; /* representacao alternativa de sinal: magnitude cabe */
#endif /* INT_MIN == -INT_MAX */
(void) bg_resto_i(INT_MIN, -1, "teste.c", 42);
} else if (strcmp(caso, "resto-estouro-l") == 0) {
#if LONG_MIN == -LONG_MAX
return 3; /* representacao alternativa de sinal: magnitude cabe */
#endif /* LONG_MIN == -LONG_MAX */
(void) bg_resto_l(LONG_MIN, -1L, "teste.c", 58);
} else if (strcmp(caso, "resto-estouro-ll") == 0) {
#if LLONG_MIN == -LLONG_MAX
return 3; /* representacao alternativa de sinal: magnitude cabe */
#endif /* LLONG_MIN == -LLONG_MAX */
(void) bg_resto_ll(LLONG_MIN, -1LL, "teste.c", 59);
} else if (strcmp(caso, "resto-zero-l") == 0) {
(void) bg_resto_l(1L, 0L, "teste.c", 51);
} else if (strcmp(caso, "resto-zero-ll") == 0) {
(void) bg_resto_ll(1LL, 0LL, "teste.c", 52);
} else if (strcmp(caso, "resto-zero-u") == 0) {
(void) bg_resto_u(1U, 0U, "teste.c", 53);
} else if (strcmp(caso, "resto-zero-ul") == 0) {
(void) bg_resto_ul(1UL, 0UL, "teste.c", 54);
} else if (strcmp(caso, "resto-zero-ull") == 0) {
(void) bg_resto_ull(1ULL, 0ULL, "teste.c", 55);
} else if (strcmp(caso, "abs-minimo") == 0) {
#if INT_MIN == -INT_MAX
return 3; /* nesta representação, a magnitude ainda cabe em int */
#endif /* INT_MIN == -INT_MAX */
(void) bg_abs_i(INT_MIN);
} else if (strcmp(caso, "abs-minimo-l") == 0) {
#if LONG_MIN == -LONG_MAX
return 3;
#endif /* LONG_MIN == -LONG_MAX */
(void) bg_abs_l(LONG_MIN);
} else if (strcmp(caso, "abs-minimo-ll") == 0) {
#if LLONG_MIN == -LLONG_MAX
return 3;
#endif /* LLONG_MIN == -LLONG_MAX */
(void) bg_abs_ll(LLONG_MIN);
} else {
return 2;
}
return 0; /* um caso fatal não deve chegar aqui */
}
Nomes internos referenciados: bg_abs_i, bg_abs_l, bg_abs_ll, bg_divide_d, bg_divide_f, bg_divide_i, bg_divide_l, bg_divide_ld, bg_divide_ll, bg_divide_u, bg_divide_ul, bg_divide_ull, bg_erro, bg_passo_zero, bg_resto_i, bg_resto_l, bg_resto_ll, bg_resto_u, bg_resto_ul, bg_resto_ull.
Como este símbolo aparece nos testes
1 ocorrência(s) em 1 arquivo(s) de teste. Os links apontam para linhas exatas; os trechos mostram o contexto local. Uma menção não prova que todos os ramos foi executado.
tests/test_biblioteca.c
Contexto: test_biblioteca.c. Linhas: 563. Tipo de evidência: código; via executa_caso_fatal.
Linhas 561–565 · abrir contexto
}
if (argc == 2) {
return executa_caso_fatal(argv[1]);
}
Compiladores, padrão C e sistema operacional
Nenhum ramo condicional externo foi detectado para este símbolo. Diretivas dentro do corpo:
#if INT_MIN == -INT_MAX#if LONG_MIN == -LONG_MAX#if LLONG_MIN == -LLONG_MAX#if INT_MIN == -INT_MAX#if LONG_MIN == -LONG_MAX#if LLONG_MIN == -LLONG_MAX#if INT_MIN == -INT_MAX#if LONG_MIN == -LONG_MAX#if LLONG_MIN == -LLONG_MAX
Diretivas próximas no fonte (podem afetar atributos/diagnósticos ao redor da definição):
#if INT_MIN == -INT_MAX#endif /* INT_MIN == -INT_MAX */#if LONG_MIN == -LONG_MAX#endif /* LONG_MIN == -LONG_MAX */#if LLONG_MIN == -LLONG_MAX#endif /* LLONG_MIN == -LLONG_MAX */#if INT_MIN == -INT_MAX#endif /* INT_MIN == -INT_MAX */#if LONG_MIN == -LONG_MAX#endif /* LONG_MIN == -LONG_MAX */#if LLONG_MIN == -LLONG_MAX#endif /* LLONG_MIN == -LLONG_MAX */#if INT_MIN == -INT_MAX#endif /* INT_MIN == -INT_MAX */#if LONG_MIN == -LONG_MAX#endif /* LONG_MIN == -LONG_MAX */#if LLONG_MIN == -LLONG_MAX#endif /* LLONG_MIN == -LLONG_MAX */
Marcadores de plataforma/representação presentes: INT_MIN, LLONG_MIN, LONG_MIN.
- Ramos #if MIN == -MAX reconhecem representações alternativas de sinal previstas por C.
A matriz histórica distingue executado, compilado, avaliado e não testado. Consulte a matriz, os compiladores e os logs atuais dos workflows antes de chamar um alvo de suportado.
Perguntas frequentes
Perguntas reunidas a partir da definição, do contrato editorial e dos testes de executa_caso_fatal. As respostas repetem apenas o que o repositório mostra; quando não há evidência, isso é dito.
Em uma frase, o que executa_caso_fatal faz?
Despacha um modo de teste que deve terminar em erro fatal ou, em representação alternativa, código 3.
Qual é a assinatura e o tipo de retorno de executa_caso_fatal?
Assinatura extraída de tests/test_biblioteca.c; visibilidade interna (static).
static int executa_caso_fatal(const char *caso)
Como executa_caso_fatal aparece em código real deste repositório?
Uso extraído de tests/test_biblioteca.c:561, com as linhas vizinhas preservadas:
}
if (argc == 2) {
return executa_caso_fatal(argv[1]);
}
Onde executa_caso_fatal é exercitado nos testes?
Há 1 ocorrência(s) em 1 arquivo(s): tests/test_biblioteca.c. Os links da seção de evidência apontam para a linha exata; uma menção não prova que todos os ramos foram executados.
executa_caso_fatal depende de compilador, padrão C ou sistema operacional?
executa_caso_fatal é código interno em C: compila com C11 nos alvos exercitados, mas não faz parte da API pública nem da matriz de portabilidade da linguagem.
Ressalvas registradas: Ramos #if MIN == -MAX reconhecem representações alternativas de sinal previstas por C.
O que acontece em caso de falha ou uso inválido?
Não há ressalva editorial específica para este nome. O comportamento em falha é o do corpo/expansão mostrado acima; não invente validação que o fonte não faz.