aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-09-06 20:10:04 -0500
committerRob Landley <rob@landley.net>2015-09-06 20:10:04 -0500
commit960100aa9cb588a73125d43ec0b0a7152a95b43f (patch)
tree8a33efdad74bc2ecf36efaed1b3089101a9a6102 /tests
parent60d1aea2df9a8cc1e975ed5fee079982612f5966 (diff)
downloadtoybox-960100aa9cb588a73125d43ec0b0a7152a95b43f.tar.gz
Switch HR_SI to HR_1000, make binary the default, make HR_B only affect bytes,
and update the tests.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_human_readable.test17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/test_human_readable.test b/tests/test_human_readable.test
index a66b4fda..a7533b7f 100755
--- a/tests/test_human_readable.test
+++ b/tests/test_human_readable.test
@@ -4,7 +4,16 @@
#testing "name" "command" "result" "infile" "stdin"
-testing "human_readable" "test_human_readable 123456789" "123M\n" "" ""
-testing "human_readable -b" "test_human_readable -b 123456789" "123MB\n" "" ""
-testing "human_readable -s" "test_human_readable -s 123456789" "123 M\n" "" ""
-testing "human_readable -i" "test_human_readable -i 5675" "5.5k\n" "" ""
+testing "human_readable l 1024" "test_human_readable 123456789" "118M\n" "" ""
+testing "human_readable l 1000" "test_human_readable -i 123456789" "123M\n" "" ""
+testing "human_readable s 1024" "test_human_readable 5675" "5.5K\n" "" ""
+testing "human_readable s 1000" "test_human_readable -i 5675" "5.6k\n" "" ""
+
+# An example input where we give a better result than coreutils.
+# 267350/1024=261.08. We say 261K and coreutils says 262K.
+testing "human_readable" "test_human_readable 267350" "261K\n" "" ""
+
+testing "human_readable -b" "test_human_readable -b 123" "123B\n" "" ""
+testing "human_readable -b" "test_human_readable -b 123456789" "118M\n" "" ""
+testing "human_readable -s" "test_human_readable -s 123456789" "118 M\n" "" ""
+testing "human_readable -bs" "test_human_readable -bs 123456789" "118 M\n" "" ""