post-scarcity/unit-tests/eval-real.sh
Simon Brooke 02fe5669d8 Complete reworking of the REPL
which is good in itself, but not what I was meant to be working on.
2018-12-30 17:56:15 +00:00

22 lines
402 B
Bash

#!/bin/bash
# for this test, trailing zeros can be ignored
expected='5.05'
actual=`echo "(eval 5.05)" |\
target/psse 2> /dev/null |\
sed 's/0*$//' |\
tail -1`
# one part in a million is close enough...
outcome=`echo "sqrt((${expected} - ${actual})^2) < 0.0000001" | bc`
if [ "${outcome}" = "1" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
exit 1
fi