runtests

来自「These files contain a port, to Python of」· 代码 · 共 80 行

TXT
80
字号
#!/usr/bin/env ksh# Performs tests on agrepy via the python program testagrepy.py# args are: <indel count [-e]> <pattern string> <infile name> <outfile name>function run_a_test {  testagrepy.py -$1 -s $2 $3 > out  if cmp out $4  then    echo "Test: $1 $2 $3 ok"  else    echo "Test: $1 $2 $3 fails"  fi}function run_an_errs_test {  testagrepy.py -$1 -s $2 $3 > out 2> errs  if cmp out $4  then    if cmp errs $5    then	echo "Test: $1 $2 $3 ok"    else        echo "Test: $1 $2 $3 fails (output ok; errors incorrect)"    fi else    echo "Test: $1 $2 $3 fails" fi}SHORT_LONG=$(awk '$2=="SHORT_LONG" {print $3}' agrepy.h)sed -e "/SHORT_LONG/s/$SHORT_LONG/100/" agrepy.h > xxxmv xxx agrepy.hprint "\nTesting sagrepy (short-string matching)\n"make cleanmakeprintI=1for S in Actinomycetaceae caggcctaacacatgcaagtc caggcctaacacatgcaagtcdo  run_a_test 3 $S xxxy$I out$I  I=$(($I + 1))donesed -e "/SHORT_LONG/s/100/1/" agrepy.h > xxxmv xxx agrepy.hprint "\nTesting lagrepy (long-string matching)\n"make cleanmakeechoI=1for S in Actinomycetaceae caggcctaacacatgcaagtc caggcctaacacatgcaagtcdo  run_a_test 3 $S xxxy$I out$I  I=$(($I + 1))doneprint "\nTesting extension of matching to cover entire pattern\n"run_a_test "3 -e" Actinomycetaceae xxxy1 out1erun_a_test "3 -e" caggcctaacacatgcaagtc xxxy3 out3eprint "\nVery long text string"run_a_test 1 PQIAMFCGRLNMHMNVQNGKW long_string out.longprint "\nSome error conditions"run_an_errs_test 0 Actinomycetaceae xxxy1 out.errs1 errs.errs1run_an_errs_test 1 $(<long_pattern) long_string out.errs2  errs.errs2# Tidy up!sed -e "/SHORT_LONG/s/1/$SHORT_LONG/" agrepy.h > xxxmv xxx agrepy.hrm out

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?