OSDN Git Service

Merge tag 'android-8.1.0_r1' into oreo-x86
[android-x86/external-toybox.git] / tests / test_human_readable.test
1 #!/bin/bash
2
3 [ -f testing.sh ] && . testing.sh
4
5 #testing "name" "command" "result" "infile" "stdin"
6
7 testing "l 1024" "test_human_readable 123456789" "118M\n" "" ""
8 testing "l 1000" "test_human_readable -i 123456789" "123M\n" "" ""
9 testing "s 1024" "test_human_readable 5675" "5.5K\n" "" ""
10 testing "s 1000" "test_human_readable -i 5675" "5.6k\n" "" ""
11
12 # An example input where we give a better result than coreutils.
13 # 267350/1024=261.08. We say 261K and coreutils says 262K.
14 testing "test_human_readable" "test_human_readable 267350" "261K\n" "" ""
15
16 testing "-b" "test_human_readable -b 123" "123B\n" "" ""
17 testing "-b" "test_human_readable -b 123456789" "118M\n" "" ""
18 testing "-s" "test_human_readable -s 123456789" "118 M\n" "" ""
19 testing "-bs" "test_human_readable -bs 123456789" "118 M\n" "" ""