test-format.c 1.27 KB
Newer Older
1
#include <config.h>
2
#include <gnome.h>
3 4 5
#include <stdio.h>
#include <string.h>
#include <time.h>
6 7
#include <math.h>
#include "format.h"
8 9 10 11 12 13

void
test()
{
  double timec = 36022.63582;
  
Miguel de Icaza's avatar
Miguel de Icaza committed
14 15 16 17 18 19 20 21 22 23
  printf( "%s|\n", format_number( 12.0,  "0", NULL ) );
  printf( "%s|\n", format_number( 12.3456789,  "??0000.00?", NULL ) );
  printf( "%s|\n", format_number( 12.3,        "??0000.00?", NULL ) );
  printf( "%s|\n", format_number( 12345.6789,  "??0000.00?", NULL ) );
  printf( "%s|\n", format_number( 0.123456789, "???????.00", NULL ) );
  printf( "%s|\n", format_number( 12200000,    "???0.000??#,,", NULL ) );
  printf( "%s|\n", format_number( timec, "hh:mm:ss", NULL ) );
  printf( "%s|\n", format_number( timec, "mmmm dd, yyyy", NULL ) );
  printf( "%s|\n", format_number( timec, "mmm d, yy h:m:s", NULL ) );
  printf( "%s|\n", format_number( timec, "mmm d, yy h:m:s PM", NULL ) );
24
  timec += 2 / 24.0;
Miguel de Icaza's avatar
Miguel de Icaza committed
25 26 27 28
  printf( "%s|\n", format_number( timec, "hh:mm:ss", NULL ) );
  printf( "%s|\n", format_number( timec, "mmmm dd, yyyy", NULL ) );
  printf( "%s|\n", format_number( timec, "mmm d, yy h:m:s", NULL ) );
  printf( "%s|\n", format_number( timec, "mmm d, yy h:m:s PM", NULL ) );
29 30 31 32 33 34 35 36 37 38 39
}

int
main( int argc, gchar *argv[] )
{
  bindtextdomain(PACKAGE, GNOMELOCALEDIR);
  textdomain(PACKAGE);
  test();
  return 0;
}