#!/bin/bash Fail() { echo "FATAL($0): $1" exit 1 } TestDemo() { echo "Testing Java demo: $1" ./rundemo $* > test/$1.txt || Fail "Error running demo: $1" diff {correct,test}/$1.txt || Fail "Incorrect output: $1" } rm -rf build test mkdir -p test if ! ./gradlew jar test; then cat build/test-results/test/TEST-io.github.cosinekitty.astronomy.demo.MainTests.xml exit 1 fi TestDemo solar_time +38.88 -77.03 2023-02-12T17:00:00Z TestDemo constellation 2021-06-01T00:00:00Z TestDemo jupiter_moons 2021-04-16T00:26:18Z TestDemo lunar_eclipse 1988-01-01T00:00:00Z TestDemo moonphase 2019-06-15T09:15:32.987Z TestDemo positions +45.6 -90.7 2018-11-30T17:55:07.234Z TestDemo riseset +45.6 -90.7 2018-11-30T17:55:07.234Z TestDemo seasons 2019 echo "Java demos: PASS" exit 0