~ubuntu-branches/ubuntu/intrepid/parted/intrepid

« back to all changes in this revision

Viewing changes to gnulib/tests/test-fprintf-posix.h

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2008-06-24 14:31:05 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080624143105-rd7yw67a9qnvh51i
Tags: 1.8.8.git.2008.03.24-7ubuntu1
* Resynchronise with Debian (LP: #237568). Remaining changes:
  - swap-uuid.dpatch: Create UUIDs on new swap partitions.
  - gptsync.dpatch: On Intel Mac systems, write a synced MBR rather than a
    protective MBR.
  - Add -fno-stack-protector on sparc.
  - sparc-new-label.dpatch: Fix sparc disk label generation. This is
    required for LDOM and parallel installations with Solaris 10.
  - loop-partitions.dpatch: Loop devices can only have one partition, so
    don't generate device names such as "/dev/loop0p1".
  - unpartitioned-disks.dpatch: Don't try to call BLKPG ioctls on
    unpartitionable disks (only implemented for loop devices at the
    moment), as they will always fail.
  - When building with gcc-4.3, add -Wno-array-bounds to CFLAGS.
  - Cell partition tables are misdetected as pc98, so disable pc98 support
    on powerpc.
  - array-bounds.dpatch: Backport patch from git to allow building with
    gcc-4.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Test of POSIX compatible vsprintf() and sprintf() functions.
 
2
   Copyright (C) 2007 Free Software Foundation, Inc.
 
3
 
 
4
   This program is free software; you can redistribute it and/or modify
 
5
   it under the terms of the GNU General Public License as published by
 
6
   the Free Software Foundation; either version 2, or (at your option)
 
7
   any later version.
 
8
 
 
9
   This program is distributed in the hope that it will be useful,
 
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
   GNU General Public License for more details.
 
13
 
 
14
   You should have received a copy of the GNU General Public License
 
15
   along with this program; if not, write to the Free Software Foundation,
 
16
   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
17
 
 
18
/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
 
19
 
 
20
static void
 
21
test_function (int (*my_fprintf) (FILE *, const char *, ...))
 
22
{
 
23
  /* Here we don't test output that may be platform dependent.
 
24
     The bulk of the tests is done as part of the 'vasnprintf-posix' module.  */
 
25
 
 
26
  /* Test support of size specifiers as in C99.  */
 
27
 
 
28
  my_fprintf (stdout, "%ju %d\n", (uintmax_t) 12345671, 33, 44, 55);
 
29
 
 
30
  my_fprintf (stdout, "%zu %d\n", (size_t) 12345672, 33, 44, 55);
 
31
 
 
32
  my_fprintf (stdout, "%tu %d\n", (ptrdiff_t) 12345673, 33, 44, 55);
 
33
 
 
34
  /* Test the support of the 'a' and 'A' conversion specifier for hexadecimal
 
35
     output of floating-point numbers.  */
 
36
 
 
37
  /* Positive zero.  */
 
38
  my_fprintf (stdout, "%a %d\n", 0.0, 33, 44, 55);
 
39
 
 
40
  /* Positive infinity.  */
 
41
  my_fprintf (stdout, "%a %d\n", 1.0 / 0.0, 33, 44, 55);
 
42
 
 
43
  /* Negative infinity.  */
 
44
  my_fprintf (stdout, "%a %d\n", -1.0 / 0.0, 33, 44, 55);
 
45
 
 
46
  /* FLAG_ZERO with infinite number.  */
 
47
  my_fprintf (stdout, "%010a %d\n", 1.0 / 0.0, 33, 44, 55);
 
48
 
 
49
  /* Test the support of the %f format directive.  */
 
50
 
 
51
  /* A positive number.  */
 
52
  my_fprintf (stdout, "%f %d\n", 12.75, 33, 44, 55);
 
53
 
 
54
  /* A larger positive number.  */
 
55
  my_fprintf (stdout, "%f %d\n", 1234567.0, 33, 44, 55);
 
56
 
 
57
  /* A negative number.  */
 
58
  my_fprintf (stdout, "%f %d\n", -0.03125, 33, 44, 55);
 
59
 
 
60
  /* Positive zero.  */
 
61
  my_fprintf (stdout, "%f %d\n", 0.0, 33, 44, 55);
 
62
 
 
63
  /* FLAG_ZERO.  */
 
64
  my_fprintf (stdout, "%015f %d\n", 1234.0, 33, 44, 55);
 
65
 
 
66
  /* Precision.  */
 
67
  my_fprintf (stdout, "%.f %d\n", 1234.0, 33, 44, 55);
 
68
 
 
69
  /* A positive number.  */
 
70
  my_fprintf (stdout, "%Lf %d\n", 12.75L, 33, 44, 55);
 
71
 
 
72
  /* A larger positive number.  */
 
73
  my_fprintf (stdout, "%Lf %d\n", 1234567.0L, 33, 44, 55);
 
74
 
 
75
  /* A negative number.  */
 
76
  my_fprintf (stdout, "%Lf %d\n", -0.03125L, 33, 44, 55);
 
77
 
 
78
  /* Positive zero.  */
 
79
  my_fprintf (stdout, "%Lf %d\n", 0.0L, 33, 44, 55);
 
80
 
 
81
  /* FLAG_ZERO.  */
 
82
  my_fprintf (stdout, "%015Lf %d\n", 1234.0L, 33, 44, 55);
 
83
 
 
84
  /* Precision.  */
 
85
  my_fprintf (stdout, "%.Lf %d\n", 1234.0L, 33, 44, 55);
 
86
 
 
87
  /* Test the support of the %F format directive.  */
 
88
 
 
89
  /* A positive number.  */
 
90
  my_fprintf (stdout, "%F %d\n", 12.75, 33, 44, 55);
 
91
 
 
92
  /* A larger positive number.  */
 
93
  my_fprintf (stdout, "%F %d\n", 1234567.0, 33, 44, 55);
 
94
 
 
95
  /* A negative number.  */
 
96
  my_fprintf (stdout, "%F %d\n", -0.03125, 33, 44, 55);
 
97
 
 
98
  /* Positive zero.  */
 
99
  my_fprintf (stdout, "%F %d\n", 0.0, 33, 44, 55);
 
100
 
 
101
  /* FLAG_ZERO.  */
 
102
  my_fprintf (stdout, "%015F %d\n", 1234.0, 33, 44, 55);
 
103
 
 
104
  /* Precision.  */
 
105
  my_fprintf (stdout, "%.F %d\n", 1234.0, 33, 44, 55);
 
106
 
 
107
  /* A positive number.  */
 
108
  my_fprintf (stdout, "%LF %d\n", 12.75L, 33, 44, 55);
 
109
 
 
110
  /* A larger positive number.  */
 
111
  my_fprintf (stdout, "%LF %d\n", 1234567.0L, 33, 44, 55);
 
112
 
 
113
  /* A negative number.  */
 
114
  my_fprintf (stdout, "%LF %d\n", -0.03125L, 33, 44, 55);
 
115
 
 
116
  /* Positive zero.  */
 
117
  my_fprintf (stdout, "%LF %d\n", 0.0L, 33, 44, 55);
 
118
 
 
119
  /* FLAG_ZERO.  */
 
120
  my_fprintf (stdout, "%015LF %d\n", 1234.0L, 33, 44, 55);
 
121
 
 
122
  /* Precision.  */
 
123
  my_fprintf (stdout, "%.LF %d\n", 1234.0L, 33, 44, 55);
 
124
 
 
125
  /* Test the support of the POSIX/XSI format strings with positions.  */
 
126
 
 
127
  my_fprintf (stdout, "%2$d %1$d\n", 33, 55);
 
128
}