2 * Conformance tests for *printf functions.
4 * Copyright 2002 Uwe Bonnes
5 * Copyright 2004 Aneurin Price
6 * Copyright 2005 Mike McCormack
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 /* With Visual Studio >= 2005, swprintf() takes an extra parameter unless
24 * the following macro is defined.
26 #define _CRT_NON_CONFORMING_SWPRINTFS
30 #include "wine/test.h"
32 static void test_sprintf( void )
36 double pnumber=789456123;
38 WCHAR wide[] = { 'w','i','d','e',0};
41 r = sprintf(buffer,format,pnumber);
43 ok(!strcmp(buffer,"+7.894561230000000e+008"),"exponent format incorrect\n");
45 ok( r==23, "return count wrong\n");
48 r = sprintf(buffer,format,((ULONGLONG)0xffffffff)*0xffffffff);
49 ok(!strcmp(buffer,"-8589934591"),"Problem with long long\n");
50 ok( r==11, "return count wrong\n");
53 r = sprintf(buffer,format,(LONGLONG)100);
54 ok(!strcmp(buffer," +100") && r==8,"+8I64d failed: '%s'\n", buffer);
57 r = sprintf(buffer,format,(LONGLONG)100);
58 ok(!strcmp(buffer,"+00000100") && r==9,"+.8I64d failed: '%s'\n", buffer);
60 format = "%+10.8I64d";
61 r = sprintf(buffer,format,(LONGLONG)100);
62 ok(!strcmp(buffer," +00000100") && r==10,"+10.8I64d failed: '%s'\n", buffer);
64 r = sprintf(buffer,format,(LONGLONG)100);
65 ok(!strcmp(buffer,"_1I64d") && r==6,"_1I64d failed\n");
68 r = sprintf(buffer,format,(LONGLONG)-100);
69 ok(!strcmp(buffer,"-00100") && r==6,"-1.5I64d failed: '%s'\n", buffer);
72 r = sprintf(buffer,format,(LONGLONG)100);
73 ok(!strcmp(buffer," 100") && r==5,"5I64d failed: '%s'\n", buffer);
76 r = sprintf(buffer,format,(LONGLONG)-100);
77 ok(!strcmp(buffer," -100") && r==5,"5I64d failed: '%s'\n", buffer);
80 r = sprintf(buffer,format,(LONGLONG)100);
81 ok(!strcmp(buffer,"100 ") && r==5,"-5I64d failed: '%s'\n", buffer);
84 r = sprintf(buffer,format,(LONGLONG)-100);
85 ok(!strcmp(buffer,"-100 ") && r==5,"-5I64d failed: '%s'\n", buffer);
88 r = sprintf(buffer,format,(LONGLONG)100);
89 ok(!strcmp(buffer,"00100") && r==5,"-.5I64d failed: '%s'\n", buffer);
92 r = sprintf(buffer,format,(LONGLONG)-100);
93 ok(!strcmp(buffer,"-00100") && r==6,"-.5I64d failed: '%s'\n", buffer);
96 r = sprintf(buffer,format,(LONGLONG)100);
97 ok(!strcmp(buffer,"00100 ") && r==8,"-8.5I64d failed: '%s'\n", buffer);
100 r = sprintf(buffer,format,(LONGLONG)-100);
101 ok(!strcmp(buffer,"-00100 ") && r==8,"-8.5I64d failed: '%s'\n", buffer);
104 r = sprintf(buffer,format,(LONGLONG)100);
105 ok(!strcmp(buffer,"00100") && r==5,"05I64d failed: '%s'\n", buffer);
108 r = sprintf(buffer,format,(LONGLONG)-100);
109 ok(!strcmp(buffer,"-0100") && r==5,"05I64d failed: '%s'\n", buffer);
112 r = sprintf(buffer,format,(LONGLONG)100);
113 ok(!strcmp(buffer," 100") && r==4,"' I64d' failed: '%s'\n", buffer);
116 r = sprintf(buffer,format,(LONGLONG)-100);
117 ok(!strcmp(buffer,"-100") && r==4,"' I64d' failed: '%s'\n", buffer);
120 r = sprintf(buffer,format,(LONGLONG)100);
121 ok(!strcmp(buffer," 100") && r==5,"' 5I64d' failed: '%s'\n", buffer);
124 r = sprintf(buffer,format,(LONGLONG)-100);
125 ok(!strcmp(buffer," -100") && r==5,"' 5I64d' failed: '%s'\n", buffer);
128 r = sprintf(buffer,format,(LONGLONG)100);
129 ok(!strcmp(buffer," 00100") && r==6,"' .5I64d' failed: '%s'\n", buffer);
132 r = sprintf(buffer,format,(LONGLONG)-100);
133 ok(!strcmp(buffer,"-00100") && r==6,"' .5I64d' failed: '%s'\n", buffer);
135 format = "% 8.5I64d";
136 r = sprintf(buffer,format,(LONGLONG)100);
137 ok(!strcmp(buffer," 00100") && r==8,"' 8.5I64d' failed: '%s'\n", buffer);
139 format = "% 8.5I64d";
140 r = sprintf(buffer,format,(LONGLONG)-100);
141 ok(!strcmp(buffer," -00100") && r==8,"' 8.5I64d' failed: '%s'\n", buffer);
144 r = sprintf(buffer,format,(LONGLONG)0);
145 ok(r==0,".0I64d failed: '%s'\n", buffer);
147 format = "%#+21.18I64x";
148 r = sprintf(buffer,format,(LONGLONG)-100);
149 ok(!strcmp(buffer," 0x00ffffffffffffff9c") && r==21,"#+21.18I64x failed: '%s'\n", buffer);
151 format = "%#.25I64o";
152 r = sprintf(buffer,format,(LONGLONG)-100);
153 ok(!strcmp(buffer,"0001777777777777777777634") && r==25,"#.25I64o failed: '%s'\n", buffer);
155 format = "%#+24.20I64o";
156 r = sprintf(buffer,format,(LONGLONG)-100);
157 ok(!strcmp(buffer," 01777777777777777777634") && r==24,"#+24.20I64o failed: '%s'\n", buffer);
159 format = "%#+18.21I64X";
160 r = sprintf(buffer,format,(LONGLONG)-100);
161 ok(!strcmp(buffer,"0X00000FFFFFFFFFFFFFF9C") && r==23,"#+18.21I64X failed: '%s '\n", buffer);
163 format = "%#+20.24I64o";
164 r = sprintf(buffer,format,(LONGLONG)-100);
165 ok(!strcmp(buffer,"001777777777777777777634") && r==24,"#+20.24I64o failed: '%s'\n", buffer);
167 format = "%#+25.22I64u";
168 r = sprintf(buffer,format,(LONGLONG)-1);
169 ok(!strcmp(buffer," 0018446744073709551615") && r==25,"#+25.22I64u conversion failed: '%s'\n", buffer);
171 format = "%#+25.22I64u";
172 r = sprintf(buffer,format,(LONGLONG)-1);
173 ok(!strcmp(buffer," 0018446744073709551615") && r==25,"#+25.22I64u failed: '%s'\n", buffer);
175 format = "%#+30.25I64u";
176 r = sprintf(buffer,format,(LONGLONG)-1);
177 ok(!strcmp(buffer," 0000018446744073709551615") && r==30,"#+30.25I64u failed: '%s'\n", buffer);
179 format = "%+#25.22I64d";
180 r = sprintf(buffer,format,(LONGLONG)-1);
181 ok(!strcmp(buffer," -0000000000000000000001") && r==25,"+#25.22I64d failed: '%s'\n", buffer);
183 format = "%#-8.5I64o";
184 r = sprintf(buffer,format,(LONGLONG)100);
185 ok(!strcmp(buffer,"00144 ") && r==8,"-8.5I64o failed: '%s'\n", buffer);
187 format = "%#-+ 08.5I64d";
188 r = sprintf(buffer,format,(LONGLONG)100);
189 ok(!strcmp(buffer,"+00100 ") && r==8,"'#-+ 08.5I64d failed: '%s'\n", buffer);
191 format = "%#-+ 08.5I64d";
192 r = sprintf(buffer,format,(LONGLONG)100);
193 ok(!strcmp(buffer,"+00100 ") && r==8,"#-+ 08.5I64d failed: '%s'\n", buffer);
196 r = sprintf(buffer,format,(LONGLONG)1);
197 ok(r==80,"%s format failed\n", format);
199 format = "% .80I64d";
200 r = sprintf(buffer,format,(LONGLONG)1);
201 ok(r==81,"%s format failed\n", format);
204 r = sprintf(buffer,format,1);
205 ok(r==81,"%s format failed\n", format);
208 r = sprintf(buffer,format,((ULONGLONG)0xffffffff)*0xffffffff);
209 ok( r == 1 || r == 11, "return count wrong %d\n", r);
210 if (r == 11) /* %ll works on Vista */
211 ok(!strcmp(buffer, "-8589934591"), "Problem with \"ll\" interpretation '%s'\n", buffer);
213 ok(!strcmp(buffer, "1"), "Problem with \"ll\" interpretation '%s'\n", buffer);
216 r = sprintf(buffer,format,1);
217 ok(!strcmp(buffer, "I"), "Problem with \"I\" interpretation\n");
218 ok( r==1, "return count wrong\n");
221 r = sprintf(buffer,format,1);
222 ok(!strcmp(buffer,"I0d"),"I0d failed\n");
223 ok( r==3, "return count wrong\n");
226 r = sprintf(buffer,format,1);
229 ok(!strcmp(buffer,"1"),"I32d failed, got '%s'\n",buffer);
233 /* Older versions don't grok I32 format */
234 ok(r == 4 && !strcmp(buffer,"I32d"),"I32d failed, got '%s',%d\n",buffer,r);
238 r = sprintf(buffer,format,(LONGLONG)-1);
239 ok(!strcmp(buffer,"D"),"I64D failed: %s\n",buffer);
240 ok( r==1, "return count wrong\n");
243 r = sprintf(buffer,format,1);
244 ok(!strcmp(buffer, " 1"),"Problem with sign place-holder: '%s'\n",buffer);
245 ok( r==2, "return count wrong\n");
248 r = sprintf(buffer,format,1);
249 ok(!strcmp(buffer, "+1"),"Problem with sign flags: '%s'\n",buffer);
250 ok( r==2, "return count wrong\n");
253 r = sprintf(buffer,format,wide);
254 ok(!strcmp(buffer,"wide"),"Problem with wide string format\n");
255 ok( r==4, "return count wrong\n");
258 r = sprintf(buffer,format,'1');
259 ok(!strcmp(buffer,"0001"),"Character not zero-prefixed \"%s\"\n",buffer);
260 ok( r==4, "return count wrong\n");
263 r = sprintf(buffer,format,'1');
264 ok(!strcmp(buffer,"1 "),"Character zero-padded and/or not left-adjusted \"%s\"\n",buffer);
265 ok( r==4, "return count wrong\n");
268 r = sprintf(buffer,format,(void *)57);
269 ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly \"%s\"\n",buffer);
270 ok( r==8, "return count wrong\n");
273 r = sprintf(buffer,format,(void *)57);
274 ok(!strcmp(buffer," 0X00000039"),"Pointer formatted incorrectly\n");
275 ok( r==12, "return count wrong\n");
278 r = sprintf(buffer,format,(void *)57);
279 ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly \"%s\"\n",buffer);
280 ok( r==8, "return count wrong\n");
283 r = sprintf(buffer,format,"foo");
284 ok(!strcmp(buffer,"0foo"),"String not zero-prefixed \"%s\"\n",buffer);
285 ok( r==4, "return count wrong\n");
288 r = sprintf(buffer,format,"foo");
289 ok(!strcmp(buffer,"f"),"Precision ignored \"%s\"\n",buffer);
290 ok( r==1, "return count wrong\n");
293 r = sprintf(buffer,format,1,"foo");
294 ok(!strcmp(buffer,"f"),"Precision ignored \"%s\"\n",buffer);
295 ok( r==1, "return count wrong\n");
298 r = sprintf(buffer,format,-5,"foo");
299 ok(!strcmp(buffer,"foo "),"Negative field width ignored \"%s\"\n",buffer);
300 ok( r==5, "return count wrong\n");
303 r = sprintf(buffer,format,(void *)57);
304 ok(!strcmp(buffer,"0X00000039 "),"Pointer formatted incorrectly\n");
305 ok( r==12, "return count wrong\n");
308 r = sprintf(buffer, format);
309 ok(!strcmp(buffer,"hello"), "failed\n");
310 ok( r==5, "return count wrong\n");
313 r = sprintf(buffer, format, wide);
314 ok(!strcmp(buffer,"wide"), "failed\n");
315 ok( r==4, "return count wrong\n");
318 r = sprintf(buffer, format, wide );
319 ok(!strcmp(buffer,"wide "), "failed\n");
320 ok( r==10, "return count wrong\n");
323 r = sprintf(buffer, format, wide );
324 ok(!strcmp(buffer," wide"), "failed\n");
325 ok( r==10, "return count wrong\n");
327 format = "%#+ -03whlls";
328 r = sprintf(buffer, format, wide );
329 ok(!strcmp(buffer,"wide"), "failed\n");
330 ok( r==4, "return count wrong\n");
333 r = sprintf(buffer, format, wide );
334 ok(!strcmp(buffer,"0s"), "failed\n");
335 ok( r==2, "return count wrong\n");
338 r = sprintf(buffer, format, wide );
339 ok(!strcmp(buffer,"-s"), "failed\n");
340 ok( r==2, "return count wrong\n");
343 r = sprintf(buffer, format, wide );
344 ok(!strcmp(buffer,"wide"), "failed\n");
345 ok( r==4, "return count wrong\n");
348 r = sprintf(buffer, format, "not wide" );
349 ok(!strcmp(buffer,"not wide"), "failed\n");
350 ok( r==8, "return count wrong\n");
353 r = sprintf(buffer, format);
354 ok(!strcmp(buffer,"b"), "failed\n");
355 ok( r==1, "return count wrong\n");
358 r = sprintf(buffer, format,'a');
359 ok(!strcmp(buffer," a"), "failed\n");
360 ok( r==3, "return count wrong\n");
363 r = sprintf(buffer, format,1234);
364 ok(!strcmp(buffer,"1234"), "failed\n");
365 ok( r==4, "return count wrong\n");
368 r = sprintf(buffer, format);
369 ok(!strcmp(buffer,""), "failed\n");
370 ok( r==0, "return count wrong\n");
372 format = "%j%k%m%q%r%t%v%y%z";
373 r = sprintf(buffer, format);
374 ok(!strcmp(buffer,"jkmqrtvyz"), "failed\n");
375 ok( r==9, "return count wrong\n");
379 r = sprintf(buffer, format, &x );
380 ok(x == 4, "should write to x\n");
381 ok(!strcmp(buffer,"asdf"), "failed\n");
382 ok( r==4, "return count wrong\n");
385 r = sprintf(buffer, format,2);
386 ok(!strcmp(buffer,"2"), "failed\n");
387 ok( r==1, "return count wrong\n");
390 r = sprintf(buffer, format,8.6);
391 ok(!strcmp(buffer,"8.6000"), "failed\n");
392 ok( r==6, "return count wrong\n");
395 r = sprintf(buffer, format,0.6);
396 ok(!strcmp(buffer,"0.600000"), "failed\n");
397 ok( r==8, "return count wrong\n");
400 r = sprintf(buffer, format,0.6);
401 ok(!strcmp(buffer,"1"), "failed\n");
402 ok( r==1, "return count wrong\n");
406 r = sprintf(buffer, format,8.6);
407 ok(!strcmp(buffer,"8.6000e+000"), "failed\n");
408 ok( r==11, "return count wrong\n");
412 r = sprintf(buffer, format,8.6);
413 ok(!strcmp(buffer,"8.6"), "failed\n");
414 ok( r==3, "return count wrong\n");
417 r = sprintf(buffer, format,-1);
418 ok(!strcmp(buffer,"-1"), "failed\n");
419 ok( r==2, "return count wrong\n");
422 r = sprintf(buffer, format,1);
423 ok(!strcmp(buffer,"1"), "failed\n");
424 ok( r==1, "return count wrong\n");
427 r = sprintf(buffer, format,1);
428 ok(!strcmp(buffer,"+1"), "failed\n");
429 ok( r==2, "return count wrong\n");
432 r = sprintf(buffer, format,10);
433 ok(!strcmp(buffer,"12"), "failed\n");
434 ok( r==2, "return count wrong\n");
437 r = sprintf(buffer, format,0);
438 ok(!strcmp(buffer,"00000000"), "failed\n");
439 ok( r==8, "return count wrong\n");
442 r = sprintf(buffer, format,0);
443 ok(!strcmp(buffer,"(null)"), "failed\n");
444 ok( r==6, "return count wrong\n");
447 r = sprintf(buffer, format,"%%%%");
448 ok(!strcmp(buffer,"%%%%"), "failed\n");
449 ok( r==4, "return count wrong\n");
452 r = sprintf(buffer, format,-1);
453 ok(!strcmp(buffer,"4294967295"), "failed\n");
454 ok( r==10, "return count wrong\n");
457 r = sprintf(buffer, format,-1);
458 ok(!strcmp(buffer,""), "failed\n");
459 ok( r==0, "return count wrong\n");
462 r = sprintf(buffer, format,-1);
463 ok(!strcmp(buffer,""), "failed\n");
464 ok( r==0, "return count wrong\n");
467 r = sprintf(buffer, format,-1);
468 ok(!strcmp(buffer,"z"), "failed\n");
469 ok( r==1, "return count wrong\n");
472 r = sprintf(buffer, format,-1);
473 ok(!strcmp(buffer,"j"), "failed\n");
474 ok( r==1, "return count wrong\n");
477 r = sprintf(buffer, format,-1);
478 ok(!strcmp(buffer,""), "failed\n");
479 ok( r==0, "return count wrong\n");
482 r = sprintf(buffer, format,-1);
483 ok(!strcmp(buffer,"H"), "failed\n");
484 ok( r==1, "return count wrong\n");
487 r = sprintf(buffer, format, 0x100+'X');
488 ok(!strcmp(buffer,"xXx"), "failed\n");
489 ok( r==3, "return count wrong\n");
492 r = sprintf(buffer, format);
493 ok(!strcmp(buffer,"%0"), "failed: \"%s\"\n", buffer);
494 ok( r==2, "return count wrong\n");
497 static void test_swprintf( void )
500 const wchar_t I64d[] = {'%','I','6','4','d',0};
501 double pnumber=789456123;
502 const wchar_t TwentyThreePoint15e[]= {'%','+','#','2','3','.','1','5','e',0};
503 const wchar_t e008[] = {'e','+','0','0','8',0};
504 const wchar_t string_w[] = {'s','t','r','i','n','g',0};
505 const char string[] = "string";
506 const wchar_t S[]={'%','S',0};
507 const wchar_t hs[] = {'%', 'h', 's', 0};
509 swprintf(buffer,TwentyThreePoint15e,pnumber);
512 ok(wcsstr(buffer,e008) != 0,"Sprintf different\n");
514 swprintf(buffer,I64d,((ULONGLONG)0xffffffff)*0xffffffff);
515 ok(wcslen(buffer) == 11,"Problem with long long\n");
516 swprintf(buffer,S,string);
517 ok(wcslen(buffer) == 6,"Problem with \"%%S\" interpretation\n");
518 swprintf(buffer, hs, string);
519 ok( wcscmp(string_w,buffer) == 0, "swprintf failed with %%hs\n");
522 static void test_snprintf (void)
524 struct snprintf_test {
528 /* Pre-2.1 libc behaviour, not C99 compliant. */
529 const struct snprintf_test tests[] = {{"short", 5},
534 const int bufsiz = sizeof buffer;
537 for (i = 0; i < sizeof tests / sizeof tests[0]; i++) {
538 const char *fmt = tests[i].format;
539 const int expect = tests[i].expected;
540 const int n = _snprintf (buffer, bufsiz, fmt);
541 const int valid = n < 0 ? bufsiz : (n == bufsiz ? n : n+1);
543 ok (n == expect, "\"%s\": expected %d, returned %d\n",
545 ok (!memcmp (fmt, buffer, valid),
546 "\"%s\": rendered \"%.*s\"\n", fmt, valid, buffer);
550 static void test_fcvt(void)
553 int dec=100, sign=100;
555 /* Numbers less than 1.0 with different precisions */
556 str = _fcvt(0.0001, 1, &dec, &sign );
557 ok( 0 == strcmp(str,""), "bad return '%s'\n", str);
558 ok( -3 == dec, "dec wrong %d\n", dec);
559 ok( 0 == sign, "sign wrong\n");
561 str = _fcvt(0.0001, -10, &dec, &sign );
562 ok( 0 == strcmp(str,""), "bad return '%s'\n", str);
563 ok( -3 == dec, "dec wrong %d\n", dec);
564 ok( 0 == sign, "sign wrong\n");
566 str = _fcvt(0.0001, 10, &dec, &sign );
567 ok( 0 == strcmp(str,"1000000"), "bad return '%s'\n", str);
568 ok( -3 == dec, "dec wrong %d\n", dec);
569 ok( 0 == sign, "sign wrong\n");
571 /* Basic sign test */
572 str = _fcvt(-111.0001, 5, &dec, &sign );
573 ok( 0 == strcmp(str,"11100010"), "bad return '%s'\n", str);
574 ok( 3 == dec, "dec wrong %d\n", dec);
575 ok( 1 == sign, "sign wrong\n");
577 str = _fcvt(111.0001, 5, &dec, &sign );
578 ok( 0 == strcmp(str,"11100010"), "bad return '%s'\n", str);
579 ok( 3 == dec, "dec wrong\n");
580 ok( 0 == sign, "sign wrong\n");
582 /* 0.0 with different precisions */
583 str = _fcvt(0.0, 5, &dec, &sign );
584 ok( 0 == strcmp(str,"00000"), "bad return '%s'\n", str);
585 ok( 0 == dec, "dec wrong %d\n", dec);
586 ok( 0 == sign, "sign wrong\n");
588 str = _fcvt(0.0, 0, &dec, &sign );
589 ok( 0 == strcmp(str,""), "bad return '%s'\n", str);
590 ok( 0 == dec, "dec wrong %d\n", dec);
591 ok( 0 == sign, "sign wrong\n");
593 str = _fcvt(0.0, -1, &dec, &sign );
594 ok( 0 == strcmp(str,""), "bad return '%s'\n", str);
595 ok( 0 == dec, "dec wrong %d\n", dec);
596 ok( 0 == sign, "sign wrong\n");
598 /* Numbers > 1.0 with 0 or -ve precision */
599 str = _fcvt(-123.0001, 0, &dec, &sign );
600 ok( 0 == strcmp(str,"123"), "bad return '%s'\n", str);
601 ok( 3 == dec, "dec wrong %d\n", dec);
602 ok( 1 == sign, "sign wrong\n");
604 str = _fcvt(-123.0001, -1, &dec, &sign );
605 ok( 0 == strcmp(str,"12"), "bad return '%s'\n", str);
606 ok( 3 == dec, "dec wrong %d\n", dec);
607 ok( 1 == sign, "sign wrong\n");
609 str = _fcvt(-123.0001, -2, &dec, &sign );
610 ok( 0 == strcmp(str,"1"), "bad return '%s'\n", str);
611 ok( 3 == dec, "dec wrong %d\n", dec);
612 ok( 1 == sign, "sign wrong\n");
614 str = _fcvt(-123.0001, -3, &dec, &sign );
615 ok( 0 == strcmp(str,""), "bad return '%s'\n", str);
616 ok( 3 == dec, "dec wrong %d\n", dec);
617 ok( 1 == sign, "sign wrong\n");
619 /* Numbers > 1.0, but with rounding at the point of precision */
620 str = _fcvt(99.99, 1, &dec, &sign );
621 ok( 0 == strcmp(str,"1000"), "bad return '%s'\n", str);
622 ok( 3 == dec, "dec wrong %d\n", dec);
623 ok( 0 == sign, "sign wrong\n");
625 /* Numbers < 1.0 where rounding occurs at the point of precision */
626 str = _fcvt(0.00636, 2, &dec, &sign );
627 ok( 0 == strcmp(str,"1"), "bad return '%s'\n", str);
628 ok( -1 == dec, "dec wrong %d\n", dec);
629 ok( 0 == sign, "sign wrong\n");
631 str = _fcvt(0.00636, 3, &dec, &sign );
632 ok( 0 == strcmp(str,"6"), "bad return '%s'\n", str);
633 ok( -2 == dec, "dec wrong %d\n", dec);
634 ok( 0 == sign, "sign wrong\n");
636 str = _fcvt(0.09999999996, 2, &dec, &sign );
637 ok( 0 == strcmp(str,"10"), "bad return '%s'\n", str);
638 ok( 0 == dec, "dec wrong %d\n", dec);
639 ok( 0 == sign, "sign wrong\n");
641 str = _fcvt(0.6, 0, &dec, &sign );
642 ok( 0 == strcmp(str,"1"), "bad return '%s'\n", str);
643 ok( 1 == dec, "dec wrong %d\n", dec);
644 ok( 0 == sign, "sign wrong\n");