Files
astronomy/generate/unit_test_kotlin
Don Cross 23ed1cda5a Kotlin: added more planet longitude tests.
Generate longitude output files that are tested by
the `generate` program.

Discovered that Windows `run.bat` was not correctly testing
the longitude output test files generated by the JavaScript
code. Fixed that.
2022-04-17 13:30:09 -04:00

38 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
Fail()
{
echo "ERROR($0): $1"
exit 1
}
[[ "$1" == "" || "$1" == "-v" ]] || Fail "Invalid command line options."
# Make sure we don't get confused by stale calculations.
rm -f temp/k_check.txt
cd ../source/kotlin || Fail "Cannot change dir to ../source/kotlin"
rm -rf build
if ! ./gradlew assemble build test dokkaGfm jar; then
# Dump the contents of the unit tests to the console,
# so if the test fails on GitHub Actions, I can see what went wrong.
cat build/test-results/test/*.xml
Fail "Error building/testing Kotlin code."
fi
cd ../../generate || Fail "Cannot change dir to ../../generate"
./generate $1 check temp/k_check.txt || Fail "Verification failure for Kotlin unit test output."
# The above gradlew call also generated all the Markdown documentation.
# The other languages do this from makedoc, but Kotlin is an exception.
# Finish putting together custom documentation for GitHub.
cd kotlindoc || Fail "Cannot change dir to kotlindoc"
./format_kotlin_doc.py || Fail "Error running ./format_kotlin_doc.py"
cd .. || Fail "Cannot change dir to .."
for file in temp/k_longitude_*.txt; do
./generate $1 check ${file} || Fail "Failed verification of file ${file}"
done
echo "unit_test_kotlin: success"
exit 0