Back to index

glibc  2.9
Classes | Functions | Variables
tst-fphex.c File Reference
#include <stdio.h>
#include <string.h>
#include "../test-skeleton.c"

Go to the source code of this file.

Classes

struct  testcase

Functions

static int do_test (int argc, char **argv)

Variables

static struct testcase []

Class Documentation

struct testcase

Definition at line 31 of file tst-efgcvt.c.

Class Members
int decpt
const char * expect
const char * fmt
int ndigit
char result
double value

Function Documentation

static int do_test ( int  argc,
char **  argv 
) [static]

Definition at line 29 of file tst-fphex.c.

{
  const struct testcase *t;
  int result = 0;

  for (t = testcases;
       t < &testcases[sizeof testcases / sizeof testcases[0]];
       ++t)
    {
      char buf[1024];
      int n = snprintf (buf, sizeof buf, t->fmt, t->value);
      if (n != strlen (t->expect) || strcmp (buf, t->expect) != 0)
       {
         printf ("%s\tExpected \"%s\" (%Zu)\n\tGot      \"%s\" (%d, %Zu)\n",
                t->fmt, t->expect, strlen (t->expect), buf, n, strlen (buf));
         result = 1;
       }
    }

  return result;
}

Here is the call graph for this function:


Variable Documentation

struct testcase[] [static]
Initial value:
  {
    { 0x0.0030p+0, "%a",    "0x1.8p-11" },
    { 0x0.0040p+0, "%a",    "0x1p-10" },
    { 0x0.0030p+0, "%040a", "0x00000000000000000000000000000001.8p-11" },
    { 0x0.0040p+0, "%040a", "0x0000000000000000000000000000000001p-10" },
    { 0x0.0040p+0, "%40a",  "                                 0x1p-10" },
    { 0x0.0040p+0, "%#40a", "                                0x1.p-10" },
    { 0x0.0040p+0, "%-40a", "0x1p-10                                 " },
    { 0x0.0040p+0, "%#-40a",       "0x1.p-10                                " },
    { 0x0.0030p+0, "%040e", "00000000000000000000000000007.324219e-04" },
    { 0x0.0040p+0, "%040e", "00000000000000000000000000009.765625e-04" },
  }

Definition at line 13 of file tst-fphex.c.