Files
astronomy/generate/unit_test_python
Don Cross 9359b80c42 Fixed #46 - Python calculations exactly match C calculations.
The problem was that the Python "%" operator does not behave
exactly like the C function fmod().  However, there is a Python
function math.fmod() that does act just like its counterpart in C.
Now astro_check output is *identical* between Python and C,
at least on my Windows 10 laptop.

Reinstated "ctest diff" in unit tests to make sure the
two implementations stay in sync.
2019-07-02 19:19:36 -04:00

29 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
Fail()
{
echo "ERROR($0): $1"
exit 1
}
python3 --version || Fail "Cannot print python version"
python3 test.py time || Fail "Failure reported by test.py (time)"
python3 test.py apsis || Fail "Failed Python apsis tests."
python3 test.py magnitude || Fail "Failed Python magnitude tests."
python3 test.py moon || Fail "Failure reported by test.py (moon)"
python3 test.py seasons seasons/seasons.txt || Fail "Failed Python seasons test."
python3 test.py moonphase moonphase/moonphases.txt || Fail "Failed Python moon phase test."
python3 test.py riseset riseset/riseset.txt || Fail "Failed Python rise/set tests."
python3 test.py 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."
./ctest diff temp/{py,js}_check.txt || Fail "Diff(py,js) failure."
exit 0