* Added support/regression/tests/bug1057979.c
[fw/sdcc] / support / regression / tests / bug1057979.c
1 /*
2    bug1057979.c
3 */
4
5 #include <testfwk.h>
6 #include <stdlib.h>
7 #include <string.h>
8 #include <stdio.h>
9
10 char s[12+1];
11
12 void
13 test_sprintf(void)
14 {
15   s[12] = 0x12;
16
17 #if defined(SDCC_mcs51) || defined(SDCC_ds390) || defined(PORT_HOST)
18 //This still fails dramatically for hc08 and z80
19   sprintf( s, "%d", 99 );
20   ASSERT( 0 == strcmp( s, "99" ) );
21   sprintf( s, "%d", 100 );
22   ASSERT( 0 == strcmp( s, "100" ) );
23   sprintf( s, "%d", 2004 );
24   ASSERT( 0 == strcmp( s, "2004" ) );
25   sprintf( s, "%ld", 2147483647L );
26   ASSERT( 0 == strcmp( s, "2147483647" ) );
27 #endif
28
29   ASSERT( s[12]==0x12 );
30 }