alsa.audio: add debug logs
[AROS.git] / test / clib / sprintf.c
blobc8e87badcd37b9325f9df4f4fb659c22e585f587
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "test.h"
7 #include <stdio.h>
8 #include <string.h>
10 #define TESTNUMBER1 11
11 #define TESTNUMBER1STRLEN 2
12 #define TEST1RESULT "11"
13 #define TEST2RESULT "11"
14 #define TEST3RESULT "11"
16 #define BUFSIZE 10
18 static void cleanbuffer(char * buf)
20 memset(buf, 0xff, BUFSIZE);
23 static int stringsame(char * c1, char * c2, int size)
25 int i;
26 for(i = 0; i < size; i++)
27 if (c1[i] != c2[i]) return 0;
28 return 1;
31 int main()
33 char buf[BUFSIZE];
34 int n1 = TESTNUMBER1;
35 long long n2 = TESTNUMBER1;
36 long long n3 = TESTNUMBER1;
39 /* check standard %d conversion */
40 cleanbuffer(buf);
41 TEST((sprintf(buf, "%d", n1) == TESTNUMBER1STRLEN));
42 TEST((stringsame(buf, TEST1RESULT, TESTNUMBER1STRLEN) == 1));
44 /* check standard %qd conversion */
45 cleanbuffer(buf);
46 TEST((sprintf(buf, "%qd", n2) == TESTNUMBER1STRLEN));
47 TEST((stringsame(buf, TEST2RESULT, TESTNUMBER1STRLEN) == 1));
49 /* check standard %lld conversion */
50 cleanbuffer(buf);
51 TEST((sprintf(buf, "%lld", n3) == TESTNUMBER1STRLEN));
52 TEST((stringsame(buf, TEST3RESULT, TESTNUMBER1STRLEN) == 1));
54 return OK;
57 void cleanup()