mirror of
https://github.com/cosinekitty/astronomy.git
synced 2026-08-02 02:46:53 -04:00
41 lines
1.2 KiB
Bash
Executable File
41 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
Fail()
|
|
{
|
|
echo "ERROR($0): $1"
|
|
exit 1
|
|
}
|
|
|
|
[[ -z "${CC}" ]] && CC=gcc
|
|
echo "$0: C compiler = ${CC}"
|
|
|
|
if [[ "$1" == "debug" ]]; then
|
|
BUILDOPT='-g -O0'
|
|
elif [[ -z "$1" ]]; then
|
|
BUILDOPT='-O3'
|
|
else
|
|
Fail "unrecognized command line option"
|
|
fi
|
|
|
|
${CC} ${BUILDOPT} -Wall -Werror -o ctest -I ../source/c/ ../source/c/astronomy.c ctest.c -lm || Fail "Error building ctest"
|
|
|
|
echo "$0: Built 'ctest' program."
|
|
|
|
./ctest || Fail "Failure reported by ctest."
|
|
./generate check temp/c_check.txt || Fail "Verification failure for C unit test output."
|
|
./ctest diff temp/c_check.txt temp/js_check.txt || Fail "Diff(C,JS) failure."
|
|
./ctest seasons seasons/seasons.txt || Fail "Failed C seasons test."
|
|
./ctest moonphase moonphase/moonphases.txt || Fail "Failed C moon phase test."
|
|
|
|
./ctest elongation || Fail "Failed C elongation tests."
|
|
for file in temp/c_longitude_*.txt; do
|
|
./generate check ${file} || Fail "Failed verification of file ${file}"
|
|
echo ""
|
|
done
|
|
|
|
./ctest riseset riseset/riseset.txt || Fail "Failed C rise/set tests."
|
|
./ctest magnitude || Fail "Failed C magnitude tests."
|
|
./ctest apsis apsides/moon.txt || Fail "Failed C apsis tests."
|
|
|
|
echo "unit_test_c: success"
|
|
exit 0
|