1 //=================================================================
5 // Testcase for C library sprintf()
7 //=================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
13 // eCos is free software; you can redistribute it and/or modify it under
14 // the terms of the GNU General Public License as published by the Free
15 // Software Foundation; either version 2 or (at your option) any later version.
17 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 // You should have received a copy of the GNU General Public License along
23 // with eCos; if not, write to the Free Software Foundation, Inc.,
24 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 // As a special exception, if other files instantiate templates or use macros
27 // or inline functions from this file, or you compile this file and link it
28 // with other works to produce a work based on this file, this file does not
29 // by itself cause the resulting work to be covered by the GNU General Public
30 // License. However the source code for this file must still be made available
31 // in accordance with section (3) of the GNU General Public License.
33 // This exception does not invalidate any other reasons why a work based on
34 // this file might be covered by the GNU General Public License.
36 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37 // at http://sources.redhat.com/ecos/ecos-license/
38 // -------------------------------------------
39 //####ECOSGPLCOPYRIGHTEND####
40 //=================================================================
41 //#####DESCRIPTIONBEGIN####
43 // Author(s): ctarpy, jlarmour
46 // Description: Contains testcode for C library sprintf() function
49 //####DESCRIPTIONEND####
54 #include <pkgconf/libc_stdio.h> // Configuration header
60 #include <cyg/infra/testcase.h>
64 // Functions to avoid having to use libc strings
66 static int my_strlen(const char *s)
71 for ( ptr=s ; *ptr != '\0' ; ptr++ )
78 static int my_strcmp(const char *s1, const char *s2)
80 for ( ; *s1 == *s2 ; s1++,s2++ )
90 static char *my_strcpy(char *s1, const char *s2)
102 static void test(CYG_ADDRWORD data)
112 ret = sprintf(x, "%d", 20);
113 CYG_TEST_PASS_FAIL(my_strcmp(x, "20")==0, "%d test");
114 CYG_TEST_PASS_FAIL(ret==my_strlen(x), "%d test return code");
117 my_strcpy(y, "Pigs noses. Get 'em while there 'ot");
118 ret = sprintf(x, "%s", y);
119 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%s test");
120 CYG_TEST_PASS_FAIL(ret==my_strlen(x), "%s test return code");
123 ret = sprintf(x, "||%7d||", 2378);
124 CYG_TEST_PASS_FAIL(my_strcmp(x, "|| 2378||")==0, "padding test");
125 CYG_TEST_PASS_FAIL(ret==my_strlen(x), "padding test return code");
128 ret = sprintf(x, "%x", 3573);
129 CYG_TEST_PASS_FAIL(my_strcmp(x, "df5")==0, "hex conversion (lowercase)");
130 CYG_TEST_PASS_FAIL(ret==my_strlen(x), "hex conv (lowercase) return code");
133 ret = sprintf(x, "%X", 3573);
134 CYG_TEST_PASS_FAIL(my_strcmp(x, "DF5")==0, "hex conversion (uppercase)");
135 CYG_TEST_PASS_FAIL(ret==my_strlen(x), "hex conv (upperbase ) return code");
138 ret = sprintf(x, "%c", 65);
139 CYG_TEST_PASS_FAIL(my_strcmp(x, "A")==0, "%c test");
140 CYG_TEST_PASS_FAIL(ret==my_strlen(x), "%c test return code");
143 ret = sprintf(x, "%o",4628);
144 CYG_TEST_PASS_FAIL(my_strcmp(x, "11024")==0, "octal conversion");
145 CYG_TEST_PASS_FAIL(ret==my_strlen(x), "octal conversion return code");
148 ret = sprintf(x, "%u", (unsigned int) 4738);
149 CYG_TEST_PASS_FAIL(my_strcmp(x, "4738")==0, "%u test");
150 CYG_TEST_PASS_FAIL(ret==my_strlen(x), "%u test return code");
154 ret = sprintf(x, "1234567x%n||", ptr);
155 CYG_TEST_PASS_FAIL(tmp==8, "%n test");
156 CYG_TEST_PASS_FAIL(ret==10, "%n test return code");
159 ret = sprintf(x, "%%");
160 CYG_TEST_PASS_FAIL(my_strcmp(x, "%")==0, "%% test");
161 CYG_TEST_PASS_FAIL(ret==my_strlen(x), "%% test return code");
164 ret = sprintf(x, "%ld", (long)1<<30);
165 CYG_TEST_PASS_FAIL(my_strcmp(x, "1073741824")==0, "%ld test");
166 CYG_TEST_PASS_FAIL(ret==my_strlen(x), "%ld test return code");
169 ret = sprintf(x, "%lu", (unsigned long)(1<<31) + 100);
170 CYG_TEST_PASS_FAIL(my_strcmp(x, "2147483748")==0, "%lu test");
171 CYG_TEST_PASS_FAIL(ret==my_strlen(x), "%lu test return code");
174 ret = sprintf(x, "%x", 0x789a);
175 CYG_TEST_PASS_FAIL(my_strcmp(x, "789a")==0, "%x test");
176 CYG_TEST_PASS_FAIL(ret==my_strlen(x), "%x test return code");
179 ret = sprintf(x, "%X", 0x789ab2);
180 CYG_TEST_PASS_FAIL(my_strcmp(x, "789AB2")==0, "%X test");
181 CYG_TEST_PASS_FAIL(ret==my_strlen(x), "%x test return code");
184 ret = sprintf(x, "%08x", 0xdea2f2);
185 CYG_TEST_PASS_FAIL(my_strcmp(x, "00dea2f2")==0, "%0x test");
186 CYG_TEST_PASS_FAIL(ret==my_strlen(x), "%0x test return code");
189 ret = sprintf(x, "%09X", 0x12fa1c);
190 CYG_TEST_PASS_FAIL(my_strcmp(x, "00012FA1C")==0, "%0X test");
191 CYG_TEST_PASS_FAIL(ret==my_strlen(x), "%0X test return code");
195 ret = sprintf(x, "%p", (void *)ptr);
196 // just check _something_ was returned
197 CYG_TEST_PASS_FAIL((ret==my_strlen(x)) && (ret > 0),
198 "%p test return code");
200 #ifdef CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT
202 CYG_TEST_INFO("Starting floating point specific tests");
205 ret = sprintf(x, "%f", 2.5);
206 my_strcpy( y, "2.500000" );
207 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "simple %f test #1");
208 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "simple %f test #1 return code");
211 ret = sprintf(x, "hello %f world", 1.234);
212 my_strcpy( y, "hello 1.234000 world");
213 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "simple %f test #2");
214 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "simple %f test #2 return code");
217 ret = sprintf(x, "hello%fworld", 2.3456781);
218 my_strcpy( y, "hello2.345678world");
219 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "simple %f test #3");
220 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "simple %f test #3 return code");
223 ret = sprintf(x, "%s%f%d%s", "testing", -0.591, 3, "123");
224 my_strcpy( y, "testing-0.5910003123");
225 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%f mixed with others");
226 CYG_TEST_PASS_FAIL(ret == my_strlen(y),"%f mixed with others return code");
229 ret = sprintf(x, "%s%f%d%s", "testing", -0.591, 3, "123");
230 my_strcpy( y, "testing-0.5910003123");
231 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%f mixed with others");
232 CYG_TEST_PASS_FAIL(ret == my_strlen(y),"%f mixed with others return code");
235 ret = sprintf(x, "hello%fworld", 2.3456786);
236 my_strcpy( y, "hello2.345679world");
237 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "rounding test #1");
238 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "rounding test #1 return code");
241 ret = sprintf(x, "hello%fworld", -2.3456786);
242 my_strcpy( y, "hello-2.345679world");
243 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "rounding test #2");
244 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "rounding test #2 return code");
247 ret = sprintf(x, "hello%+fworld", -6.54321);
248 my_strcpy( y, "hello-6.543210world");
249 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "+ modifier #1");
250 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "+ modifier #1 return code");
253 ret = sprintf(x, "hello%+fworld", 6.54321);
254 my_strcpy( y, "hello+6.543210world");
255 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "+ modifier #2");
256 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "+ modifier #2 return code");
259 ret = sprintf(x, "hello%5fworld", 6.5);
260 my_strcpy( y, "hello6.500000world");
261 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "width modifier #1");
262 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "width modifier #1 return code");
265 ret = sprintf(x, "hello%2fworld", 4.3);
266 my_strcpy( y, "hello4.300000world");
267 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "width modifier #2");
268 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "width modifier #2 return code");
271 ret = sprintf(x, "hello%2.1fworld", 5.6);
272 my_strcpy( y, "hello5.6world");
273 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "width and precision modifier #1");
274 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
275 "width and precision modifier #1 return code");
278 ret = sprintf(x, "hello%5.1fworld", 6.7);
279 my_strcpy( y, "hello 6.7world");
280 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "width and precision modifier #2");
281 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
282 "width and precision modifier #2 return code");
285 ret = sprintf(x, "hello%3.1fworld", 7.8);
286 my_strcpy( y, "hello7.8world");
287 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "width and precision modifier #3");
288 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
289 "width and precision modifier #3 return code");
292 ret = sprintf(x, "hello%3.2fworld", 7.8);
293 my_strcpy( y, "hello7.80world");
294 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "width and precision modifier #4");
295 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
296 "width and precision modifier #4 return code");
299 ret = sprintf(x, "hello%05.1fworld", 6.5);
300 my_strcpy( y, "hello006.5world");
301 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "0 modifier #1");
302 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "0 modifier #1 return code");
305 ret = sprintf(x, "hello%03.0fworld", 6.2);
306 my_strcpy( y, "hello006world");
307 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "0 modifier #2");
308 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "0 modifier #2 return code");
311 ret = sprintf(x, "hello%05.*fworld",2, 7.5);
312 my_strcpy( y, "hello07.50world");
313 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "0 modifier plus *");
314 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
315 "0 modifier plus * return code");
318 ret = sprintf(x, "hello%03.1fworld",-1.232);
319 my_strcpy( y, "hello-1.2world");
320 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "-ve number with 0 modifier #1");
321 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
322 "-ve number with 0 modifier #1 return code");
325 ret = sprintf(x, "hello%04.1fworld",-1.232);
326 my_strcpy( y, "hello-1.2world");
327 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "-ve number with 0 modifier #2");
328 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
329 "-ve number with 0 modifier #2 return code");
332 ret = sprintf(x, "hello%05.1fworld",-1.232);
333 my_strcpy( y, "hello-01.2world");
334 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "-ve number with 0 modifier #3");
335 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
336 "-ve number with 0 modifier #3 return code");
339 ret = sprintf(x, "hello%fworld",0.0);
340 my_strcpy( y, "hello0.000000world");
341 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "0.0 test #1");
342 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "0.0 test #1 return code");
345 ret = sprintf(x, "hello%1.0fworld",0.0);
346 my_strcpy( y, "hello0world");
347 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "0.0 test #2");
348 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "0.0 test #2 return code");
351 ret = sprintf(x, "hello%1.1fworld",0.0);
352 my_strcpy( y, "hello0.0world");
353 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "0.0 test #3");
354 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "0.0 test #3 return code");
357 ret = sprintf(x, "hello%5.1fworld",0.0);
358 my_strcpy( y, "hello 0.0world");
359 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "0.0 test #4");
360 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "0.0 test #4 return code");
363 ret = sprintf(x, "hello%fworld",-0.0);
364 my_strcpy( y, "hello-0.000000world");
365 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "-0.0 test #1");
366 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "-0.0 test #1 return code");
369 ret = sprintf(x, "hello%fworld",0.234);
370 my_strcpy( y, "hello0.234000world");
371 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "number less than 1 #1");
372 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
373 "number less than 1 #1 return code");
376 ret = sprintf(x, "hello%02fworld",-0.234);
377 my_strcpy( y, "hello-0.234000world");
378 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "number less than 1 #2");
379 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
380 "number less than 1 #2 return code");
383 ret = sprintf(x, "hello%02.2fworld",-0.234);
384 my_strcpy( y, "hello-0.23world");
385 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "number less than 1 #3");
386 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
387 "number less than 1 #3 return code");
390 ret = sprintf(x, "hello%06.2fworld",-0.234);
391 my_strcpy( y, "hello-00.23world");
392 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "number less than 1 #4");
393 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
394 "number less than 1 #4 return code");
397 ret = sprintf(x, "hello%-6.2fworld",2.345);
398 my_strcpy( y, "hello2.35 world");
399 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "left justification #1");
400 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
401 "left justification #1 return code");
404 ret = sprintf(x, "hello%-6.2fworld",2.345);
405 my_strcpy( y, "hello2.35 world");
406 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "left justification #2");
407 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
408 "left justification #2 return code");
411 ret = sprintf(x, "hello%-3.2fworld",2.345);
412 my_strcpy( y, "hello2.35world");
413 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "left justification #3");
414 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
415 "left justification #3 return code");
418 ret = sprintf(x, "hello%#1.0fworld",2.12);
419 my_strcpy( y, "hello2.world");
420 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "# modifier #1");
421 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "# modifier #1 return code");
424 ret = sprintf(x, "hello%#1.2fworld",2.0);
425 my_strcpy( y, "hello2.00world");
426 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "# modifier #2");
427 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "# modifier #2 return code");
430 ret = sprintf(x, "hello%eworld",2.3456);
431 my_strcpy( y, "hello2.345600e+00world");
432 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%e #1");
433 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "%e #1 return code");
436 ret = sprintf(x, "hello%4.3eworld",-2.3456e-1);
437 my_strcpy( y, "hello-2.346e-01world");
438 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%e #2");
439 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "%e #2 return code");
442 ret = sprintf(x, "hello%4.2eworld",2.56e2);
443 my_strcpy( y, "hello2.56e+02world");
444 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%e #3");
445 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "%e #3 return code");
448 ret = sprintf(x, "hello%09.2eworld",2.56e2);
449 my_strcpy( y, "hello02.56e+02world");
450 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%e #4");
451 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "%e #4 return code");
454 ret = sprintf(x, "hello%09.2Eworld",4.23e19);
455 my_strcpy( y, "hello04.23E+19world");
456 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%e #5");
457 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "%e #5 return code");
460 ret = sprintf(x, "hello%gworld",4.0);
461 my_strcpy( y, "hello4world");
462 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%g #1");
463 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "%g #1 return code");
466 ret = sprintf(x, "hello%gworld",4.56);
467 my_strcpy( y, "hello4.56world");
468 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%g #2");
469 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "%g #2 return code");
472 ret = sprintf(x, "hello%5.2gworld",4.56);
473 my_strcpy( y, "hello 4.6world");
474 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%g #3");
475 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "%g #3 return code");
478 ret = sprintf(x, "hello%gworld",0.002);
479 my_strcpy( y, "hello0.002world");
480 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%g #4");
481 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "%g #4 return code");
484 ret = sprintf(x, "hello%06.1gworld",0.0026);
485 my_strcpy( y, "hello00.003world");
486 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%g #5");
487 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "%g #5 return code");
490 ret = sprintf(x, "hello%06gworld",0.000026);
491 my_strcpy( y, "hello2.6e-05world");
492 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%g #5");
493 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "%g #5 return code");
496 ret = sprintf(x, "hello%06Gworld",0.000037);
497 my_strcpy( y, "hello3.7E-05world");
498 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%g #6");
499 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "%g #6 return code");
502 ret = sprintf(x, "hello%08Gworld",-123456.0);
503 my_strcpy( y, "hello-0123456world");
504 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%g #7");
505 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "%g #7 return code");
508 ret = sprintf(x, "hello%07gworld",-1234567.0);
509 my_strcpy( y, "hello-1.23457e+06world");
510 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%g #8");
511 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "%g #8 return code");
514 ret = sprintf(x, "hello%013Gworld",-1234567.0);
515 my_strcpy( y, "hello-01.23457E+06world");
516 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "%g #9");
517 CYG_TEST_PASS_FAIL(ret == my_strlen(y), "%g #9 return code");
521 CYG_TEST_PASS("Floating point tests skipped - not configured");
522 #endif // ifdef CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT
525 ret = sprintf(x, "This is a very long string so I hope this works as "
526 "otherwise I would be very, very, sad. The cat sat on the "
527 "hat, and the mat sat on the rat. Quick brown fax, etc.etc. "
528 "blah, blah and all that jazz. Isn't he finished yet? My "
529 "old man's a dustman, why do I have to think up this "
530 "drivel, isn't that what summer students are for, if "
531 "anything that seems thinking up mindless drivel seems to "
532 "be their occupation in life. Yoof of today, eh? What, "
533 "what? %s So there.",
534 "And this is a middly bit.");
535 my_strcpy(y, "This is a very long string so I hope this works as "
536 "otherwise I would be very, very, sad. The cat sat on the "
537 "hat, and the mat sat on the rat. Quick brown fax, etc.etc. "
538 "blah, blah and all that jazz. Isn't he finished yet? My "
539 "old man's a dustman, why do I have to think up this "
540 "drivel, isn't that what summer students are for, if "
541 "anything that seems thinking up mindless drivel seems to "
542 "be their occupation in life. Yoof of today, eh? What, "
543 "what? And this is a middly bit. So there.");
544 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "long (480 char) string output #1");
545 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
546 "long (480 char) string output #1 return code");
548 ret = sprintf(x, "Boo! This %s So there.",
549 "is a very long string so I hope this works as "
550 "otherwise I would be very, very, sad. The cat sat on the "
551 "hat, and the mat sat on the rat. Quick brown fax, etc.etc. "
552 "blah, blah and all that jazz. Isn't he finished yet? My "
553 "old man's a dustman, why do I have to think up this "
554 "drivel, isn't that what summer students are for, if "
555 "anything that seems thinking up mindless drivel seems to "
556 "be their occupation in life. Yoof of today, eh? What, "
557 "what? And this is a middly bit.");
558 my_strcpy(y, "Boo! This is a very long string so I hope this works as "
559 "otherwise I would be very, very, sad. The cat sat on the "
560 "hat, and the mat sat on the rat. Quick brown fax, etc.etc. "
561 "blah, blah and all that jazz. Isn't he finished yet? My "
562 "old man's a dustman, why do I have to think up this "
563 "drivel, isn't that what summer students are for, if "
564 "anything that seems thinking up mindless drivel seems to "
565 "be their occupation in life. Yoof of today, eh? What, "
566 "what? And this is a middly bit. So there.");
567 CYG_TEST_PASS_FAIL(my_strcmp(x, y)==0, "long (485 char) string output #2");
568 CYG_TEST_PASS_FAIL(ret == my_strlen(y),
569 "long (485 char) string output #2 return code");
574 CYG_TEST_FINISH("Finished tests from testcase " __FILE__ " for C library "
575 "sprintf() function");
580 main(int argc, char *argv[])
584 CYG_TEST_INFO("Starting tests from testcase " __FILE__ " for C library "
585 "sprintf() function");
586 CYG_TEST_INFO("These test individual features separately");