Files
astronomy/generate/unit_test_c
Don Cross 7cf1a7eb7d Minor tweaks for cppcheck. Use const pointers for grav sim.
Slightly different cppcheck dev 2.11 behaviors have added
another warning that I don't care about. I don't want to
have to convert callback pointers to const, then cast them
to const.

However, it did find a couple of useful cases I fixed in
astronomy.c where GravSim parameters could be made const.
2023-06-19 12:37:39 -04:00

30 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
Fail()
{
echo "ERROR($0): $1"
exit 1
}
[[ "$1" == "" || "$1" == "-v" ]] || Fail "Invalid command line options."
[[ -z "${CPP}" ]] && CPP=g++
cppcheck -I ../source/c --enable=all --inline-suppr --suppress=unmatchedSuppression --suppress=variableScope --suppress=shadowFunction --suppress=unusedFunction --suppress=missingIncludeSystem --suppress=constParameterCallback --error-exitcode=9 ../source/c ../demo/c/*.c ctest.c || exit 1
# Verify that the source can be built as modern C++.
${CPP} -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