blob: 0f1bfb7a9341ede57c5fec9e76b4df87a42466b2 [file] [log] [blame]
#!/bin/bash
[ -f testing.sh ] && . testing.sh
#testing "name" "command" "result" "infile" "stdin"
testing "l 1024" "test_human_readable 123456789" "118M\n" "" ""
testing "l 1000" "test_human_readable -i 123456789" "123M\n" "" ""
testing "s 1024" "test_human_readable 5675" "5.5K\n" "" ""
testing "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 "test_human_readable" "test_human_readable 267350" "261K\n" "" ""
testing "-b" "test_human_readable -b 123" "123B\n" "" ""
testing "-b" "test_human_readable -b 123456789" "118M\n" "" ""
testing "-s" "test_human_readable -s 123456789" "118 M\n" "" ""
testing "-bs" "test_human_readable -bs 123456789" "118 M\n" "" ""