195 lines
3.7 KiB
Plaintext
195 lines
3.7 KiB
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
test_tmp=`tempfile`
|
||
|
export test_tmp
|
||
|
|
||
|
opt_tester() {
|
||
|
opt="$@"
|
||
|
tmp=$(tempfile)
|
||
|
test_2search() {
|
||
|
xargs echo Search in < $tmp
|
||
|
2search $opt $tmp 0 2 2.1 100000
|
||
|
2search $opt -B $tmp 0 2 2.1 100000
|
||
|
}
|
||
|
(true) |
|
||
|
sort $opt > $tmp
|
||
|
echo Search in null file
|
||
|
test_2search
|
||
|
|
||
|
(echo) |
|
||
|
sort $opt > $tmp
|
||
|
echo Search in newline
|
||
|
test_2search
|
||
|
|
||
|
(echo 1.000000000) |
|
||
|
sort $opt > $tmp
|
||
|
test_2search
|
||
|
|
||
|
(echo 1.000000000;
|
||
|
echo 2) |
|
||
|
sort $opt > $tmp
|
||
|
test_2search
|
||
|
|
||
|
(echo 1;
|
||
|
echo 2.000000000) |
|
||
|
sort $opt > $tmp
|
||
|
test_2search
|
||
|
|
||
|
(echo 1.000000000;
|
||
|
echo 2;
|
||
|
echo 3) |
|
||
|
sort $opt > $tmp
|
||
|
test_2search
|
||
|
|
||
|
(echo 1;
|
||
|
echo 2.000000000;
|
||
|
echo 3) |
|
||
|
sort $opt > $tmp
|
||
|
test_2search
|
||
|
|
||
|
(echo 1;
|
||
|
echo 2;
|
||
|
echo 3.000000000) |
|
||
|
sort $opt > $tmp
|
||
|
test_2search
|
||
|
|
||
|
rm $tmp
|
||
|
}
|
||
|
export -f opt_tester
|
||
|
|
||
|
test_n() {
|
||
|
tmp=${test_tmp}_n
|
||
|
true > $tmp
|
||
|
echo Search in null file
|
||
|
2search -n $tmp 0 2 2.1 100000
|
||
|
2search -nB $tmp 0 2 2.1 100000
|
||
|
echo > $tmp
|
||
|
xargs echo Search in newline
|
||
|
2search -n $tmp 0 2 2.1 100000
|
||
|
2search -nB $tmp 0 2 2.1 100000
|
||
|
echo 1.000000000 > $tmp
|
||
|
xargs echo Search in < $tmp
|
||
|
2search -n $tmp 0 2 2.1 100000
|
||
|
2search -nB $tmp 0 2 2.1 100000
|
||
|
echo 1.000000000 > $tmp
|
||
|
echo 2 >> $tmp
|
||
|
xargs echo Search in < $tmp
|
||
|
2search -n $tmp 0 2 2.1 100000
|
||
|
2search -nB $tmp 0 2 2.1 100000
|
||
|
echo 1 > $tmp
|
||
|
echo 2.000000000 >> $tmp
|
||
|
xargs echo Search in < $tmp
|
||
|
2search -n $tmp 0 2 2.1 100000
|
||
|
2search -nB $tmp 0 2 2.1 100000
|
||
|
echo 1.000000000 > $tmp
|
||
|
echo 2 >> $tmp
|
||
|
echo 3 >> $tmp
|
||
|
xargs echo Search in < $tmp
|
||
|
2search -n $tmp 0 2 2.1 100000
|
||
|
2search -nB $tmp 0 2 2.1 100000
|
||
|
echo 1 > $tmp
|
||
|
echo 2.000000000 >> $tmp
|
||
|
echo 3 >> $tmp
|
||
|
xargs echo Search in < $tmp
|
||
|
2search -n $tmp 0 2 2.1 100000
|
||
|
2search -nB $tmp 0 2 2.1 100000
|
||
|
echo 1 > $tmp
|
||
|
echo 2 >> $tmp
|
||
|
echo 3.000000000 >> $tmp
|
||
|
xargs echo Search in < $tmp
|
||
|
2search -n $tmp 0 2 2.1 100000
|
||
|
2search -nB $tmp 0 2 2.1 100000
|
||
|
rm $tmp
|
||
|
}
|
||
|
|
||
|
test_n_opt() {
|
||
|
opt_tester -n
|
||
|
}
|
||
|
|
||
|
test_rn_opt() {
|
||
|
opt_tester -rn
|
||
|
}
|
||
|
|
||
|
test_r_opt() {
|
||
|
opt_tester -rn
|
||
|
}
|
||
|
|
||
|
test_k32_2n_1n() {
|
||
|
tmp=$(tempfile)
|
||
|
cat >$tmp <<EOF
|
||
|
1 chr1 Sample 1
|
||
|
11 chr1 Sample 1
|
||
|
111 chr1 Sample 1
|
||
|
1111 chr1 Sample 1
|
||
|
11111 chr1 Sample 1
|
||
|
111111 chr1 Sample 1
|
||
|
1 chr2 Sample 1
|
||
|
22 chr2 Sample 1
|
||
|
111 chr2 Sample 1
|
||
|
2222 chr2 Sample 1
|
||
|
11111 chr2 Sample 1
|
||
|
111111 chr2 Sample 1
|
||
|
1 chr10 Sample 1
|
||
|
11 chr10 Sample 1
|
||
|
111 chr10 Sample 1
|
||
|
1111 chr10 Sample 1
|
||
|
11111 chr10 Sample 1
|
||
|
111111 chr10 Sample 1
|
||
|
1 chr1 Sample 2
|
||
|
11 chr1 Sample 2
|
||
|
111 chr1 Sample 2
|
||
|
1111 chr1 Sample 2
|
||
|
11111 chr1 Sample 2
|
||
|
111111 chr1 Sample 2
|
||
|
1 chr2 Sample 2
|
||
|
22 chr2 Sample 2
|
||
|
111 chr2 Sample 2
|
||
|
2222 chr2 Sample 2
|
||
|
11111 chr2 Sample 2
|
||
|
111111 chr2 Sample 2
|
||
|
1 chr10 Sample 2
|
||
|
11 chr10 Sample 2
|
||
|
111 chr10 Sample 2
|
||
|
1111 chr10 Sample 2
|
||
|
11111 chr10 Sample 2
|
||
|
111111 chr10 Sample 2
|
||
|
1 chr1 Sample 10
|
||
|
11 chr1 Sample 10
|
||
|
111 chr1 Sample 10
|
||
|
1111 chr1 Sample 10
|
||
|
11111 chr1 Sample 10
|
||
|
111111 chr1 Sample 10
|
||
|
1 chr2 Sample 10
|
||
|
22 chr2 Sample 10
|
||
|
111 chr2 Sample 10
|
||
|
2222 chr2 Sample 10
|
||
|
11111 chr2 Sample 10
|
||
|
111111 chr2 Sample 10
|
||
|
1 chr10 Sample 10
|
||
|
11 chr10 Sample 10
|
||
|
111 chr10 Sample 10
|
||
|
1111 chr10 Sample 10
|
||
|
11111 chr10 Sample 10
|
||
|
111111 chr10 Sample 10
|
||
|
EOF
|
||
|
2grep -k3N,2N,1n $tmp 'Sample 10' chr10 111
|
||
|
echo $tmp
|
||
|
}
|
||
|
|
||
|
test_partial_line() {
|
||
|
tmp=$(tempfile)
|
||
|
seq 100 | LC_ALL=C sort > $tmp
|
||
|
echo '### 2search --grep'
|
||
|
2search --grep $tmp 3
|
||
|
echo '### 2grep'
|
||
|
2grep $tmp 3
|
||
|
echo '### ... | 2grep'
|
||
|
echo 3 | 2grep $tmp
|
||
|
rm $tmp
|
||
|
}
|
||
|
|
||
|
|
||
|
export -f $(compgen -A function | grep test_)
|
||
|
compgen -A function | grep test_ | sort | parallel -j6 --tag -k '{} 2>&1' > regressiontest.new
|
||
|
diff regressiontest.new regressiontest.out
|