Usermode/libc - printf fixes
[tpg/acess2.git] / Usermode / Libraries / libc.so_src / TEST_printf.c
1 /*
2  * Acess2 C Library (Test)
3  * - By John Hodge (thePowersGang)
4  *
5  * TEST_printf.c
6  * - Tests for printf.c
7  */
8 #include <stdio.h>
9
10 #define TST(_name, fmt, val) \
11         printf(_name" %"fmt" '"#val"': '"fmt"'\n", val)
12
13 int main(int argc, char *argv[])
14 {
15         printf("Hello World!\n");
16         TST("String", "%s", "teststring");
17         TST("String", "%.5s", "teststring");
18         TST("String", "%10.5s", "teststring");
19         TST("String", "%-10.5s", "teststring");
20         
21         TST("Integer", "%i", 1234);
22         TST("Integer", "%d", 1234);
23         TST("Integer", "%u", 1234);
24         
25         TST("Float", "%f", 3.1414926535);
26         TST("Float", "%f", 10.0);
27         TST("Float", "%f", -0.0);
28         TST("Float", "%.10f", 3.1414926535);
29         TST("Float", "%e", 3.1415926535);
30         TST("Float", "%g", 3.1415926535);
31         TST("Float", "%E", 1000000000.00);
32         TST("Float", "%a", 16.0);
33         TST("Float", "%a", 1024.0);
34         TST("Float", "%a", 1023.0);
35         TST("Float", "%A", 1000000000.00);
36         return 0;
37 }

UCC git Repository :: git.ucc.asn.au