X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=tests%2Fcomparison_tests%2Futils.sh;fp=tests%2Fcomparison_tests%2Futils.sh;h=db482276e862e90b75838725fb38578c95c7fe44;hb=5f371ee50291faed9ae0514dfd4ba2aec87faea1;hp=0000000000000000000000000000000000000000;hpb=8907c4fc162a27e946d6b574102dc3c97075c4e1;p=SXSI%2Fxpathcomp.git diff --git a/tests/comparison_tests/utils.sh b/tests/comparison_tests/utils.sh new file mode 100644 index 0000000..db48227 --- /dev/null +++ b/tests/comparison_tests/utils.sh @@ -0,0 +1,21 @@ +#!/bin/bash +function average() { + N="0" + I=0 + while read x + do + if [ -z "$x" ] + then + I=0 + break + fi + N="$N + $x" + I=$(($I+1)) + done + if [ "$I" = "0" ] + then + echo + else + echo "scale=3; 1+(( $N ) / $I)" | bc -q + fi +}