Pular para o conteúdo principal

testa_matematica

Página gerada do fonte

Gerada por tools/gerar_documentacao.py. Definição: tests/test_biblioteca.c:308.

Grupo executável do harness da biblioteca padrão.

Tipo: função C · Visibilidade: interna (static) · Arquivo: tests/test_biblioteca.c.

Assinatura e expansão​

static void testa_matematica(void)

Parâmetros formais: void.

Como funciona​

Prepara cenários de sucesso, fronteira e falha, chama a API e registra condições com VERIFICA ou retorna um código de erro ao modo de integração. O fonte completo e as referências extraídas aparecem abaixo.

Implementação completa · 73 linhas
{
const char *arquivo = "teste.c";

VERIFICA(bg_divide_i(-7, 2, arquivo, 1) == -3);
VERIFICA(bg_divide_l(7L, 2L, arquivo, 1) == 3L);
VERIFICA(bg_divide_ll(7LL, 2LL, arquivo, 1) == 3LL);
VERIFICA(bg_divide_u(7U, 2U, arquivo, 1) == 3U);
VERIFICA(bg_divide_ul(7UL, 2UL, arquivo, 1) == 3UL);
VERIFICA(bg_divide_ull(7ULL, 2ULL, arquivo, 1) == 3ULL);
VERIFICA(bg_divide_f(7.0f, 2.0f, arquivo, 1) == 3.5f);
VERIFICA(bg_divide_d(7.0, 2.0, arquivo, 1) == 3.5);
VERIFICA(bg_divide_ld(7.0L, 2.0L, arquivo, 1) == 3.5L);
#if INT_MIN == -INT_MAX
VERIFICA(bg_divide_i(INT_MIN, -1, arquivo, 1) == INT_MAX);
#endif /* INT_MIN == -INT_MAX */
#if LONG_MIN == -LONG_MAX
VERIFICA(bg_divide_l(LONG_MIN, -1L, arquivo, 1) == LONG_MAX);
#endif /* LONG_MIN == -LONG_MAX */
#if LLONG_MIN == -LLONG_MAX
VERIFICA(bg_divide_ll(LLONG_MIN, -1LL, arquivo, 1) == LLONG_MAX);
#endif /* LLONG_MIN == -LLONG_MAX */

VERIFICA(bg_resto_i(-7, 3, arquivo, 1) == -1);
VERIFICA(bg_resto_l(7L, 3L, arquivo, 1) == 1L);
VERIFICA(bg_resto_ll(7LL, 3LL, arquivo, 1) == 1LL);
VERIFICA(bg_resto_u(7U, 3U, arquivo, 1) == 1U);
VERIFICA(bg_resto_ul(7UL, 3UL, arquivo, 1) == 1UL);
VERIFICA(bg_resto_ull(7ULL, 3ULL, arquivo, 1) == 1ULL);
#if INT_MIN == -INT_MAX
VERIFICA(bg_resto_i(INT_MIN, -1, arquivo, 1) == 0);
#endif /* INT_MIN == -INT_MAX */
#if LONG_MIN == -LONG_MAX
VERIFICA(bg_resto_l(LONG_MIN, -1L, arquivo, 1) == 0L);
#endif /* LONG_MIN == -LONG_MAX */
#if LLONG_MIN == -LLONG_MAX
VERIFICA(bg_resto_ll(LLONG_MIN, -1LL, arquivo, 1) == 0LL);
#endif /* LLONG_MIN == -LLONG_MAX */

VERIFICA(bg_abs_i(-7) == 7);
VERIFICA(bg_abs_l(-7L) == 7L);
VERIFICA(bg_abs_ll(-7LL) == 7LL);
VERIFICA(bg_abs_f(-2.5f) == 2.5f);
VERIFICA(bg_abs_d(-2.5) == 2.5);
#if INT_MIN == -INT_MAX
VERIFICA(bg_abs_i(INT_MIN) == INT_MAX);
#endif /* INT_MIN == -INT_MAX */
#if LONG_MIN == -LONG_MAX
VERIFICA(bg_abs_l(LONG_MIN) == LONG_MAX);
#endif /* LONG_MIN == -LONG_MAX */
#if LLONG_MIN == -LLONG_MAX
VERIFICA(bg_abs_ll(LLONG_MIN) == LLONG_MAX);
#endif /* LLONG_MIN == -LLONG_MAX */
VERIFICA(signbit(bg_abs_d(-0.0)) == 0);
VERIFICA(bg_min_i(3, 9) == 3);
VERIFICA(bg_min_l(3L, 9L) == 3L);
VERIFICA(bg_min_d(3.0, 9.0) == 3.0);
VERIFICA(bg_max_i(3, 9) == 9);
VERIFICA(bg_max_l(3L, 9L) == 9L);
VERIFICA(bg_max_d(3.0, 9.0) == 9.0);
VERIFICA(bg_round_l(2.5) == 3LL);
VERIFICA(bg_round_l(-2.5) == -3LL);

VERIFICA(ABS(-7) == 7);
VERIFICA(MINIMO(3, 9) == 3);
VERIFICA(MAXIMO(3, 9) == 9);
VERIFICA(fabs(POTENCIA(2.0, 10.0) - 1024.0) < 0.0001);
VERIFICA(RAIZ(144.0) == 12.0);
VERIFICA(ARREDONDA(-2.5) == -3LL);
VERIFICA(PISO(2.9) == 2.0);
VERIFICA(TETO(2.1) == 3.0);
VERIFICA(DIVIDE(-7, 2) == -3);
VERIFICA(RESTO(-7, 3) == -1);
}

Nomes internos referenciados: ABS, ARREDONDA, DIVIDE, MAXIMO, MINIMO, PISO, POTENCIA, RAIZ, RESTO, TETO, VERIFICA, bg_abs_d, bg_abs_f, 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_max_d, bg_max_i, bg_max_l, bg_min_d, bg_min_i, bg_min_l, bg_resto_i, bg_resto_l, bg_resto_ll, bg_resto_u, bg_resto_ul, bg_resto_ull, bg_round_l.

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: 570. Tipo de evidência: código; via testa_matematica.

Linhas 568–572 · abrir contexto
testa_texto();
testa_caracteres();
testa_matematica();
testa_utilidades();

Ver no GitHub

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.

Não confunda implementação com certificação

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 testa_matematica. As respostas repetem apenas o que o repositório mostra; quando não há evidência, isso é dito.

Em uma frase, o que testa_matematica faz?​

Grupo executável do harness da biblioteca padrão.

Qual é a assinatura e o tipo de retorno de testa_matematica?​

Assinatura extraída de tests/test_biblioteca.c; visibilidade interna (static).

static void testa_matematica(void)

Como testa_matematica aparece em código real deste repositório?​

Uso extraído de tests/test_biblioteca.c:568, com as linhas vizinhas preservadas:

testa_texto();
testa_caracteres();
testa_matematica();
testa_utilidades();

Onde testa_matematica é 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.

testa_matematica depende de compilador, padrão C ou sistema operacional?​

testa_matematica é 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.

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.