From: John Hodge Date: Fri, 8 Feb 2013 10:53:47 +0000 (+0800) Subject: Usermode/libc - Tester for printf X-Git-Tag: rel0.15~586 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=7dc9c3f82e28211bad0eef801b6a6dec349bfb50;p=tpg%2Facess2.git Usermode/libc - Tester for printf --- diff --git a/Usermode/Libraries/libc.so_src/TEST_printf.c b/Usermode/Libraries/libc.so_src/TEST_printf.c new file mode 100644 index 00000000..5db673a3 --- /dev/null +++ b/Usermode/Libraries/libc.so_src/TEST_printf.c @@ -0,0 +1,30 @@ +/* + * Acess2 C Library (Test) + * - By John Hodge (thePowersGang) + * + * TEST_printf.c + * - Tests for printf.c + */ +#include + +#define TST(_name, fmt, val) \ + printf(_name" %"fmt" "#val": "fmt"\n", val) + +int main(int argc, char *argv[]) +{ + printf("Hello World\n"); + TST("String", "%s", "teststring"); + TST("String", "%.5s", "teststring"); + TST("String", "%10.5s-", "teststring"); + TST("String", "%-10.5s", "teststring"); + + TST("Integer", "%i", 1234); + TST("Integer", "%d", 1234); + TST("Integer", "%u", 1234); + + TST("Float", "%f", 3.1414926535); + TST("Float", "%.10f", 3.1414926535); + TST("Float", "%e", 3.1414926535); + TST("Float", "%g", 3.1414926535); + TST("Float", "%E", 1000000000.00); +}