Back to index

glibc  2.9
Defines | Functions | Variables
tst-strfmon1.c File Reference
#include <monetary.h>
#include <locale.h>
#include <stdio.h>
#include <string.h>
#include "../test-skeleton.c"

Go to the source code of this file.

Defines

#define ntests   (sizeof (tests) / sizeof (tests[0]))
#define TEST_FUNCTION   do_test ()

Functions

static int do_test (void)

Variables

struct {
const char * locale
const char * expected
tests []

Define Documentation

#define ntests   (sizeof (tests) / sizeof (tests[0]))

Definition at line 17 of file tst-strfmon1.c.

#define TEST_FUNCTION   do_test ()

Definition at line 41 of file tst-strfmon1.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 21 of file tst-strfmon1.c.

{
  int res = 0;
  for (int i = 0; i < ntests; ++i)
    {
      char buf[500];
      if (setlocale (LC_ALL, tests[i].locale) == NULL)
       {
         printf ("failed to set locale %s\n", tests[i].locale);
         res = 1;
         continue;
       }
      strfmon (buf, sizeof (buf), "|%n|%!n|", -12.34, -12.34);
      int fail = strcmp (buf, tests[i].expected) != 0;
      printf ("%s%s\n", buf, fail ? " *** FAIL ***" : "");
      res |= fail;
    }
  return res;
}

Here is the call graph for this function:


Variable Documentation

struct { ... } tests[] [static]