split.test revision 55ec010efa77fe10cf4b7eaa480bc52008ef7a54
155ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley#!/bin/bash 255ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley 355ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley[ -f testing.sh ] && . testing.sh 455ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley 555ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley#testing "name" "command" "result" "infile" "stdin" 655ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley 755ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landleytesting "split" "seq 1 12345 | split && ls xa[a-z] | wc -l" "13\n" "" "" 855ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landleyrm xa[a-z] 955ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley 1055ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landleytesting "split -" "seq 1 12345 | split - && ls xa[a-z] | wc -l" "13\n" "" "" 1155ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landleyrm xa[a-z] 1255ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley 1355ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landleyseq 1 12345 > file 1455ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landleytesting "split file" "split file && ls xa[a-z] | wc -l" "13\n" "" "" 1555ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landleyrm xa[a-z] 1655ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley 1755ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landleytesting "split -l" "split file -l 10k && wc -l xab" "2105 xab\n" "" "" 1855ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landleyrm xa[ab] 1955ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley 2055ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landleytesting "split suffix exhaustion" \ 2155ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley "split file -l 10 -a 1 walrus 2>/dev/null || ls walrus* | wc -l" "26\n" "" "" 2255ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landleyrm walrus* 2355ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley 2455ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landleytesting "split bytes" \ 2555ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley "toybox seq 1 20000 | split -b 100 -a 3 - whang && ls whang* | wc -l && wc -c whangbpw" "1089\n94 whangbpw\n" "" "" 2655ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley 2755ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landleytesting "split reassembly" \ 2855ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley 'diff -u <(ls whang* | sort | xargs cat) <(seq 1 20000) && echo yes' \ 2955ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley "yes\n" "" "" 3055ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landley 3155ec010efa77fe10cf4b7eaa480bc52008ef7a54Rob Landleyrm file whang* 32