post-scarcity/unit-tests/eval-real.sh
Simon Brooke 5a84f5e305 Fixed the eval-real test
So that it passes provided the answer is right to within one part in a million. Also worked on a solution to returning exceptions from make_stack_frame
2018-12-21 21:36:37 +00:00

23 lines
373 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*$//' |\
head -2 |\
tail -1`
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