mirror of
https://github.com/cosinekitty/astronomy.git
synced 2026-05-19 14:27:52 -04:00
Added `Observer.toStateVector` and `Observer.toVector` for converting an observer's geographic location to position and velocity vectors relative to the Earth's center. Reworked the C unit test to output a text file that can be used as reference, to make sure the Kotlin output matches.
27 lines
777 B
Bash
Executable File
27 lines
777 B
Bash
Executable File
#!/bin/bash
|
|
Fail()
|
|
{
|
|
echo "ERROR($0): $1"
|
|
exit 1
|
|
}
|
|
|
|
[[ "$1" == "" || "$1" == "-v" ]] || Fail "Invalid command line options."
|
|
|
|
# Verify that the source can be built as modern C++.
|
|
g++ -x c++ -std=c++17 -c -Wall -Werror -O3 ../source/c/astronomy.c || Fail "Cannot compile as C++"
|
|
rm -f astronomy.o
|
|
|
|
./ctbuild || exit 1
|
|
time ./ctest $1 check || Fail "Failure in ctest check"
|
|
./generate check temp/c_check.txt || Fail "Verification failure for C unit test output."
|
|
rm -f temp/c_geoid.txt
|
|
./ctest $1 all || Fail "Failure in C unit tests"
|
|
diff temp/c_geoid.txt topostate/geoid.txt || Fail "Unexpected geoid output."
|
|
|
|
for file in temp/c_longitude_*.txt; do
|
|
./generate $1 check ${file} || Fail "Failed verification of file ${file}"
|
|
done
|
|
|
|
echo "unit_test_c: success"
|
|
exit 0
|