Files
astronomy/generate/unit_test_c
Don Cross 6156be38ca Verify that astronomy.c can be built as C++.
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.
2021-10-31 18:48:00 -04:00

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