Files
astronomy/generate/unit_test_python

36 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
Fail()
{
echo "ERROR($0): $1"
exit 1
}
[[ "$1" == "" || "$1" == "-v" ]] || Fail "Invalid command line options."
python3 --version || Fail "Cannot print python version"
python3 test.py $1 rotation || Fail "Failed Python rotation tests."
python3 test.py $1 refraction || Fail "Failed Python refraction tests."
python3 test.py $1 time || Fail "Failure reported by test.py (time)"
python3 test.py $1 lunar_apsis || Fail "Failed Python lunar apsis tests."
python3 test.py $1 planet_apsis || Fail "Failed Python planet apsis tests."
python3 test.py $1 magnitude || Fail "Failed Python magnitude tests."
python3 test.py $1 moon || Fail "Failure reported by test.py (moon)"
python3 test.py $1 seasons seasons/seasons.txt || Fail "Failed Python seasons test."
python3 test.py $1 moonphase moonphase/moonphases.txt || Fail "Failed Python moon phase test."
python3 test.py $1 riseset riseset/riseset.txt || Fail "Failed Python rise/set tests."
python3 test.py $1 constellation || Fail "Failed Python constellation test."
python3 test.py $1 lunar_eclipse || Fail "Failed Python lunar eclipse test."
python3 test.py $1 elongation || Fail "Failed Python elongation tests."
for file in temp/py_longitude_*.txt; do
./generate check ${file} || Fail "Failed verification of file ${file}"
echo ""
done
echo "$0: Generating Python test output."
time python3 test.py astro_check > temp/py_check.txt || Fail "Failure in Python astro_check"
./generate check temp/py_check.txt || Fail "Verification failure for Python unit test output."
echo "$0: PASS"
exit 0