Files
astronomy/generate/unit_test_js
Don Cross 6b56bf0cfd Finished refactoring JavaScript unit tests.
From now on, it will be simpler to add new JavaScript unit tests.
In most cases, it should no longer be necessary to update the
bash script unit_test_js or the batch file run.bat when new
JavaScript tests are added.
2020-06-03 10:20:52 -04:00

28 lines
702 B
Bash
Executable File

#!/bin/bash
Fail()
{
echo "ERROR($0): $1"
exit 1
}
[[ "$1" == "" || "$1" == "-v" ]] || Fail "Invalid command line options."
time node test.js astro_check > temp/js_check.txt || Fail "Problem running JavaScript astro_check."
./generate $1 check temp/js_check.txt || Fail "Verification failure for JavaScript unit test output."
echo ""
echo "$0: Running check against JPL Horizons data."
./jplcheck || Fail "Error in JPL check."
node test.js $1 all || Fail "Failed JavaScript unit tests."
echo ""
echo "$0: Verifying elongation output."
for file in temp/js_longitude_*.txt; do
./generate $1 check ${file} || Fail "Failed verification of ${file}"
done
echo ""
echo "$0: SUCCESS."
exit 0