diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-08 11:47:14 -0400 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-08 11:47:14 -0400 |
commit | 0a229cf5a240a1ebf4ff5d0ebb501a286bc96202 (patch) | |
tree | 2797d054788e88863d77f9826dde94fb4c276c69 /tests/printf/test.c | |
parent | 05b6aa32a5f1633797f7eae390b3a8048b29ca69 (diff) | |
parent | ae5ef852920ce67449af7693f05a767a87aed976 (diff) |
Merge branch 'incoming'
Diffstat (limited to 'tests/printf/test.c')
-rw-r--r-- | tests/printf/test.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/printf/test.c b/tests/printf/test.c index d05ba096..1c8ad9f7 100644 --- a/tests/printf/test.c +++ b/tests/printf/test.c @@ -8,10 +8,15 @@ int main() { printf("\n"); printf("Characters: %c %c\n", 'a', 65); printf("Decimals: %d %ld %lld %d\n", 1977, 650000L, 12LL, 4); - printf("Preceding with blanks: %10d\n", 1977); - printf("Preceding with zeros: %010d\n", 1977); + printf("Preceding with blanks: %10d %10d\n", 1977, -1977); + printf("Preceding with zeros: %010d %010d\n", 1977, -1977); + printf("Force sign: %+d %+d %+6d %+6d\n", 1977, -1977, 1977, -1977); + printf("Force sign or space: % d % d % 6d % 6d\n", 1977, -1977, 1977, -1977); + printf("Sign overrides space: % +d % +d % +6d % +6d\n", 1977, -1977, 1977, -1977); printf("Some different radixes: %d %x %o %#x %#o\n", 100, 100, 100, 100, 100); - printf("floats: %4.2f %+.0e %E\n", 3.1416, 3.1416, 3.1416); + printf("floats: %4.2f %+.0e %E %08.2f\n", 3.1416, 3.1416, 3.1416, 3.1416); + printf("negative floats: %4.2f %+.0e %E %08.2f\n", -3.1416, -3.1416, -3.1416, -3.1416); + printf("Force sign or space: % .2f % .2f % 6.2f % 6.2f\n", 3.1416, -3.1416, 3.1416, -3.1416); printf("Width trick: %*d\n", 5, 10); printf("%s %%\n", "A string"); printf("Null string: %7s\n", NULL); |