X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fcomparison_tests%2Futils.sh;fp=tests%2Fcomparison_tests%2Futils.sh;h=db482276e862e90b75838725fb38578c95c7fe44;hb=adbae5267917033dec93e753bbc81272d16ab218;hp=0000000000000000000000000000000000000000;hpb=8f5b2f0c7e95245c1b7f4cc18aa137ba8e784166;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 +}