Back to index

glibc  2.9
Defines | Functions | Variables
basic-test.c File Reference
#include <math.h>
#include <float.h>
#include <stdio.h>
#include "../test-skeleton.c"

Go to the source code of this file.

Defines

#define TEST_FUNC(NAME, FLOAT, NANFUNC, EPSILON, HUGEVAL)
#define TEST_TRUNC(NAME, FLOAT, DOUBLE)
#define TEST_FUNCTION   do_test ()

Functions

static void check (const char *testname, int result)
int do_test (void)

Variables

static int errors = 0

Define Documentation

#define TEST_FUNC (   NAME,
  FLOAT,
  NANFUNC,
  EPSILON,
  HUGEVAL 
)

Definition at line 36 of file basic-test.c.

#define TEST_FUNCTION   do_test ()

Definition at line 146 of file basic-test.c.

#define TEST_TRUNC (   NAME,
  FLOAT,
  DOUBLE 
)
Value:
void                                                                 \
NAME (void)                                                          \
{                                                                    \
  volatile DOUBLE Inf_var, NaN_var, zero_var, one_var;                      \
  FLOAT x1, x2;                                                             \
                                                                     \
  zero_var = 0.0;                                                    \
  one_var = 1.0;                                                     \
  NaN_var = zero_var / zero_var;                                     \
  Inf_var = one_var / zero_var;                                             \
                                                                     \
  (void) &NaN_var;                                                   \
  (void) &Inf_var;                                                   \
                                                                     \
  x1 = (FLOAT) NaN_var;                                                     \
  check (" "#FLOAT" x = ("#FLOAT") ("#DOUBLE") NaN", isnan (x1) != 0);             \
  x2 = (FLOAT) Inf_var;                                                     \
  check (" "#FLOAT" x = ("#FLOAT") ("#DOUBLE") Inf", isinf (x2) != 0);             \
}

Definition at line 100 of file basic-test.c.


Function Documentation

static void check ( const char *  testname,
int  result 
) [static]

Definition at line 28 of file basic-test.c.

{
  if (!result) {
    printf ("Failure: %s\n", testname);
    errors++;
  }
}

Here is the call graph for this function:

int do_test ( void  )

Definition at line 131 of file basic-test.c.

{
  float_test ();
  double_test ();
  truncdfsf_test();

#ifndef NO_LONG_DOUBLE
  ldouble_test ();

Variable Documentation

int errors = 0 [static]

Definition at line 24 of file basic-test.c.