Skip to content

Commit 7124e04

Browse files
author
Francois Berenger
committed
test_gauss.sh: also test Welford
1 parent f0c4ef4 commit 7124e04

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test_gauss.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ function fatal () {
1111
which datamash || fatal "FATAL: datamash must be installed"
1212

1313
TMPIN=`mktemp`
14+
TMPOUT=`mktemp`
1415

1516
function cleanup {
16-
rm -f $TMPIN
17+
rm -f $TMPIN $TMPOUT
1718
}
1819

1920
trap cleanup EXIT
2021

22+
# build executables we want to test
2123
dune build src/gauss_test.exe
24+
dune build src/welford_test.exe
2225

2326
# some wanted distributions MU and SIGMA params
2427
cat <<EOF > $TMPIN
@@ -31,7 +34,9 @@ cat <<EOF > $TMPIN
3134
EOF
3235

3336
while read MU SIGMA; do
34-
printf "%.3f\t%.3f\n" $MU $SIGMA
35-
_build/default/src/gauss_test.exe $MU $SIGMA 100000 | \
36-
datamash mean 1 sstdev 1 | awk '{printf("%.3f\t%.3f\n\n",$1,$2)}'
37+
printf "%.3f\t%.3f\tREF\n" $MU $SIGMA
38+
_build/default/src/gauss_test.exe $MU $SIGMA 100000 > $TMPOUT
39+
_build/default/src/welford_test.exe $TMPOUT
40+
cat $TMPOUT | datamash mean 1 sstdev 1 | \
41+
awk '{printf("%.3f\t%.3f\n",$1,$2)}'
3742
done < $TMPIN

0 commit comments

Comments
 (0)