1
/* Test of sprintf(), float version, very long strings.
2
$Id: sprintf_flt-big.c,v 1.2 2007/03/10 04:44:34 dmix Exp $ */
9
PROGMEM static const struct sprf_s {
24
{ "%255.7e", 1.2345678,
43
"00000000000000000000000000000000" /* 32 */
44
"00000000000000000000000000000000" /* 32 */
45
"00000000000000000000000000000000" /* 32 */
46
"00000000000000000000000000000000" /* 32 */
47
"00000000000000000000000000000000" /* 32 */
48
"00000000000000000000000000000000" /* 32 */
49
"00000000000000000000000000000000" /* 32 */
50
"00000000000000000001.234567e+00" },
51
{ "%+0255e", 1.234567,
52
"+0000000000000000000000000000000" /* 32 */
53
"00000000000000000000000000000000" /* 32 */
54
"00000000000000000000000000000000" /* 32 */
55
"00000000000000000000000000000000" /* 32 */
56
"00000000000000000000000000000000" /* 32 */
57
"00000000000000000000000000000000" /* 32 */
58
"00000000000000000000000000000000" /* 32 */
59
"00000000000000000001.234567e+00" },
60
{ "%+0255e", -1.234567,
61
"-0000000000000000000000000000000" /* 32 */
62
"00000000000000000000000000000000" /* 32 */
63
"00000000000000000000000000000000" /* 32 */
64
"00000000000000000000000000000000" /* 32 */
65
"00000000000000000000000000000000" /* 32 */
66
"00000000000000000000000000000000" /* 32 */
67
"00000000000000000000000000000000" /* 32 */
68
"00000000000000000001.234567e+00" },
89
"1.250000000000000000000000000000"
90
"00000000000000000000000000000000" /* 32 */
91
"00000000000000000000000000000000" /* 32 */
92
"00000000000000000000000000000000" /* 32 */
93
"00000000000000000000000000000000" /* 32 */
94
"00000000000000000000000000000000" /* 32 */
95
"00000000000000000000000000000000" /* 32 */
96
"000000000000000000000000000000000" },
98
"00000000000000000000000000000000" /* 32 */
99
"00000000000000000000000000000000" /* 32 */
100
"00000000000000000000000000000000" /* 32 */
101
"00000000000000000000000000000000" /* 32 */
102
"00000000000000000000000000000000" /* 32 */
103
"00000000000000000000000000000000" /* 32 */
104
"00000000000000000000000000000000" /* 32 */
105
"000000000000000000000001.250000" },
116
/* the smallest nonzero */
117
{ "%.45f", 0x1p-149f,
118
"0.000000000000000000000000000000000000000000001" },
119
{ "%.50f", 0x1p-149f,
120
"0.00000000000000000000000000000000000000000000140130" },
124
void run_sprf (const struct sprf_s *pt, int testno)
131
n = sprintf_P (s, pt->fmt, pgm_read_dword (& pt->val));
133
n = sprintf (s, pt->fmt, pt->val);
135
if (n != (int)strlen_P (pt->pattern))
136
code = testno + 1000;
137
else if (strcmp_P (s, pt->pattern))
141
#if !defined(__AVR__)
142
printf ("\ntestno %3d: expect: %3d, \"%s\","
143
"\n output: %3d, \"%s\"\n",
144
testno, strlen(pt->pattern), pt->pattern, n, s);
145
exit (code < 256 ? testno : 255);
155
for (i = 0; (unsigned)i != sizeof(t)/sizeof(t[0]); i++)