1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#!/bin/bash
set -e
pkg=dicelab
export LC_ALL=C.UTF-8
if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
# Double quote below to expand the temporary directory variable now versus
# later is on purpose.
# shellcheck disable=SC2064
trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi
cd "${AUTOPKGTEST_TMP}"
# The input example taken on the website
cat <<EOF >testInputWebsite
count >10
sum
keep high 2
3#d6;
EOF
#Calling dicelab
dicelab -c -f testInputWebsite > testOutputWebsite
# Does the output match what we expect, according to the website?
grep -q '0[[:blank:]]0.8009' testOutputWebsite
if [ $? -ne 0 ]; then
echo "Distribution is wrong at point 0"
exit 1
fi
grep -q '1[[:blank:]]0.19907' testOutputWebsite
if [ $? -ne 0 ]; then
echo "Distribution is wrong at point 1"
exit 1
fi
|