mirror of
https://github.com/cosinekitty/astronomy.git
synced 2025-12-30 11:09:33 -05:00
I discovered that when I tried to build astronomy.c as C++ code, I got several errors and warnings. So I fixed those issues and added a C++ build-check to the unit tests.
25 lines
670 B
Bash
Executable File
25 lines
670 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++ -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."
|
|
./ctest $1 all || Fail "Failure in C unit tests"
|
|
|
|
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
|