test_all.sh

来自「Amis - A maximum entropy estimator 一个最大」· Shell 代码 · 共 64 行

SH
64
字号
#!/bin/shAMIS="../src/amis $*"DIFF=diff#ALGORITHMS="GIS IIS"ALGORITHMS="GIS IIS BFGS BFGSMAP"TEST_BINARY="simple combine pack variable multifile tree packtree forest fix"TEST_NONBINARY="$TEST_BINARY nonbinary"######################################################################num_tests=0num_success=0num_fail=0num_fail_threshold=10exec_test() {    feature=$1    shift    test_file_list=$1    shift    additional_args=$*    for test_file in $test_file_list ; do	for algo in $ALGORITHMS ; do	    num_tests=`expr $num_tests + 1`	    command="$AMIS -f $feature -a $algo $additional_args $test_file.conf"	    test_spec="$test_file $feature $algo"#	    echo $command	    if $command &> /dev/null		then		if $DIFF $test_file.output $test_file.$algo.test &> /dev/null		    then		    echo "$test_spec: SUCCESS"		    num_success=`expr $num_success + 1`		else		    echo "$test_spec: FAIL"		    num_fail=`expr $num_fail + 1`		fi	    else		echo "FAILED: $command"		exit 1	    fi	done    done}exec_test binary "$TEST_BINARY"exec_test binary "$TEST_BINARY" --event-on-file trueexec_test integer "$TEST_NONBINARY"exec_test integer "$TEST_NONBINARY" --event-on-file trueexec_test real "$TEST_NONBINARY"exec_test real "$TEST_NONBINARY" --event-on-file trueecho "$num_success tests passed."if [ $num_fail -gt 0 ]; then    echo "$num_fail tests failed."    if [ $num_fail -gt $num_fail_threshold ]; then	exit 1    fifi

⌨️ 快捷键说明

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