3 [ -f testing.sh ] && . testing.sh
5 #testing "name" "command" "result" "infile" "stdin"
7 SIZE='&& stat -c %s freep'
8 testing "truncate 0" "truncate -s 0 freep $SIZE" "0\n" "" ""
9 testing "truncate 12345" "truncate -s 12345 freep $SIZE" "12345\n" "" ""
10 testing "truncate 1m" "truncate -s 1m freep $SIZE" "1048576\n" "" ""
11 testing "truncate is sparse" "truncate -s 1g freep && stat -c %b freep" \
13 testing "truncate +" "truncate -s 1k freep && truncate -s +1k freep $SIZE" \
15 testing "truncate -" "truncate -s 4k freep && truncate -s -1k freep $SIZE" \
17 testing "truncate < hit" \
18 "truncate -s 5k freep && truncate -s \<4k freep $SIZE" "4096\n" "" ""
19 testing "truncate < miss" \
20 "truncate -s 4k freep && truncate -s \<6k freep $SIZE" "4096\n" "" ""
21 testing "truncate > hit" \
22 "truncate -s 3k freep && truncate -s \>4k freep $SIZE" "4096\n" "" ""
23 testing "truncate > miss" \
24 "truncate -s 4k freep && truncate -s \>2k freep $SIZE" "4096\n" "" ""
25 testing "truncate /" "truncate -s 7k freep && truncate -s /3k freep $SIZE" \
27 testing "truncate %" "truncate -s 7k freep && truncate -s %3k freep $SIZE" \