Rob Landley | 55ec010 | 2013-06-16 23:08:09 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | [ -f testing.sh ] && . testing.sh |
| 4 | |
| 5 | #testing "name" "command" "result" "infile" "stdin" |
| 6 | |
| 7 | testing "split" "seq 1 12345 | split && ls xa[a-z] | wc -l" "13\n" "" "" |
| 8 | rm xa[a-z] |
| 9 | |
Rob Landley | 336c44a | 2016-03-02 15:20:04 -0600 | [diff] [blame] | 10 | testing "-" "seq 1 12345 | split - && ls xa[a-z] | wc -l" "13\n" "" "" |
Rob Landley | 55ec010 | 2013-06-16 23:08:09 -0500 | [diff] [blame] | 11 | rm xa[a-z] |
| 12 | |
| 13 | seq 1 12345 > file |
Rob Landley | 336c44a | 2016-03-02 15:20:04 -0600 | [diff] [blame] | 14 | testing "file" "split file && ls xa[a-z] | wc -l" "13\n" "" "" |
Rob Landley | 55ec010 | 2013-06-16 23:08:09 -0500 | [diff] [blame] | 15 | rm xa[a-z] |
| 16 | |
Rob Landley | 336c44a | 2016-03-02 15:20:04 -0600 | [diff] [blame] | 17 | testing "-l" "split file -l 10k && wc -l xab" "2105 xab\n" "" "" |
Rob Landley | 55ec010 | 2013-06-16 23:08:09 -0500 | [diff] [blame] | 18 | rm xa[ab] |
| 19 | |
Rob Landley | 336c44a | 2016-03-02 15:20:04 -0600 | [diff] [blame] | 20 | testing "suffix exhaustion" \ |
Rob Landley | 55ec010 | 2013-06-16 23:08:09 -0500 | [diff] [blame] | 21 | "split file -l 10 -a 1 walrus 2>/dev/null || ls walrus* | wc -l" "26\n" "" "" |
| 22 | rm walrus* |
| 23 | |
Rob Landley | 336c44a | 2016-03-02 15:20:04 -0600 | [diff] [blame] | 24 | testing "bytes" \ |
Rob Landley | 55ec010 | 2013-06-16 23:08:09 -0500 | [diff] [blame] | 25 | "toybox seq 1 20000 | split -b 100 -a 3 - whang && ls whang* | wc -l && wc -c whangbpw" "1089\n94 whangbpw\n" "" "" |
| 26 | |
Rob Landley | 336c44a | 2016-03-02 15:20:04 -0600 | [diff] [blame] | 27 | testing "reassembly" \ |
Rob Landley | 55ec010 | 2013-06-16 23:08:09 -0500 | [diff] [blame] | 28 | 'diff -u <(ls whang* | sort | xargs cat) <(seq 1 20000) && echo yes' \ |
| 29 | "yes\n" "" "" |
| 30 | |
| 31 | rm file whang* |