aboutsummaryrefslogtreecommitdiff
path: root/testsuite/printf.tests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/printf.tests')
-rwxr-xr-xtestsuite/printf.tests33
1 files changed, 33 insertions, 0 deletions
diff --git a/testsuite/printf.tests b/testsuite/printf.tests
index 963ded94b..34a65926e 100755
--- a/testsuite/printf.tests
+++ b/testsuite/printf.tests
@@ -79,6 +79,39 @@ testing "printf understands %Ld" \
"-5\n""0\n" \
"" ""
+testing "printf handles positive numbers for %d" \
+ "${bb}printf '%d\n' 3 +3 ' 3' ' +3' 2>&1; echo \$?" \
+ "3\n"\
+"3\n"\
+"3\n"\
+"3\n""0\n" \
+ "" ""
+
+testing "printf handles positive numbers for %i" \
+ "${bb}printf '%i\n' 3 +3 ' 3' ' +3' 2>&1; echo \$?" \
+ "3\n"\
+"3\n"\
+"3\n"\
+"3\n""0\n" \
+ "" ""
+
+testing "printf handles positive numbers for %x" \
+ "${bb}printf '%x\n' 42 +42 ' 42' ' +42' 2>&1; echo \$?" \
+ "2a\n"\
+"2a\n"\
+"2a\n"\
+"2a\n""0\n" \
+ "" ""
+
+testing "printf handles positive numbers for %f" \
+ "${bb}printf '%0.3f\n' .42 +.42 ' .42' ' +.42' 2>&1; echo \$?" \
+ "0.420\n"\
+"0.420\n"\
+"0.420\n"\
+"0.420\n""0\n" \
+ "" ""
+
+
# "FIXED" now to act compatibly
## We are "more correct" here than bash/coreutils: they happily print -2
## as if it is a huge unsigned number