diff options
author | Ranger Harke <ranger.harke@autodesk.com> | 2013-09-19 17:09:10 -0400 |
---|---|---|
committer | Ranger Harke <ranger.harke@autodesk.com> | 2013-09-19 17:09:10 -0400 |
commit | b72b6d897250cc7624b66832f720ff3bed6823a6 (patch) | |
tree | b5ee896cb45e24bab3114e018744a574e4577912 /tests/printf | |
parent | e4678bed92f20ea0b5cd6fa2467cc2b0444511e0 (diff) |
Fix bug with forced display of sign on negative integers
The negative sign was displayed twice.
Diffstat (limited to 'tests/printf')
-rw-r--r-- | tests/printf/output.txt | 1 | ||||
-rw-r--r-- | tests/printf/output_i64_1.txt | 1 | ||||
-rw-r--r-- | tests/printf/test.c | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/tests/printf/output.txt b/tests/printf/output.txt index 0f59d9fc..7ca4d88c 100644 --- a/tests/printf/output.txt +++ b/tests/printf/output.txt @@ -5,6 +5,7 @@ Characters: a A Decimals: 1977 650000 12 4 Preceding with blanks: 1977 -1977 Preceding with zeros: 0000001977 -000001977 +Force sign: +1977 -1977 +1977 -1977 Some different radixes: 100 64 144 0x64 0144 floats: 3.14 +3e+00 3.141600E+00 00003.14 negative floats: -3.14 -3e+00 -3.141600E+00 -0003.14 diff --git a/tests/printf/output_i64_1.txt b/tests/printf/output_i64_1.txt index ca03386f..9cd8ed98 100644 --- a/tests/printf/output_i64_1.txt +++ b/tests/printf/output_i64_1.txt @@ -5,6 +5,7 @@ Characters: a A Decimals: 1977 650000 12 4 Preceding with blanks: 1977 -1977 Preceding with zeros: 0000001977 -000001977 +Force sign: +1977 -1977 +1977 -1977 Some different radixes: 100 64 144 0x64 0144 floats: 3.14 +3e+00 3.141600E+00 00003.14 negative floats: -3.14 -3e+00 -3.141600E+00 -0003.14 diff --git a/tests/printf/test.c b/tests/printf/test.c index c5f159f1..b01a99db 100644 --- a/tests/printf/test.c +++ b/tests/printf/test.c @@ -10,6 +10,7 @@ int main() { printf("Decimals: %d %ld %lld %d\n", 1977, 650000L, 12LL, 4); 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("Some different radixes: %d %x %o %#x %#o\n", 100, 100, 100, 100, 100); 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); |