Usermode/libc - Tester for printf
authorJohn Hodge <[email protected]>
Fri, 8 Feb 2013 10:53:47 +0000 (18:53 +0800)
committerJohn Hodge <[email protected]>
Fri, 8 Feb 2013 10:53:47 +0000 (18:53 +0800)
Usermode/Libraries/libc.so_src/TEST_printf.c [new file with mode: 0644]

diff --git a/Usermode/Libraries/libc.so_src/TEST_printf.c b/Usermode/Libraries/libc.so_src/TEST_printf.c
new file mode 100644 (file)
index 0000000..5db673a
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Acess2 C Library (Test)
+ * - By John Hodge (thePowersGang)
+ *
+ * TEST_printf.c
+ * - Tests for printf.c
+ */
+#include <stdio.h>
+
+#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);
+}

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