#!/bin/bash Fail() { echo "FATAL(demo/csharp/demotest): $1" exit 1 } TestDemo() { echo "Testing demo: $1.cs" exe/$* > test/$1${SUFFIX}.txt || Fail "Error testing $1.cs." diff {correct,test}/$1${SUFFIX}.txt || Fail "Incorrect output from $1.cs." } rm -rf exe rm -f test/*.txt mkdir -p test || exit 1 # https://github.com/dotnet/sdk/issues/30624#issuecomment-1432118204 dotnet build --property:OutputPath="${PWD}/exe" || Fail "Error building ${PWD}/demo.sln" SUFFIX= TestDemo solar_time +38.88 -77.03 2023-02-12T17:00:00Z SUFFIX=_nz TestDemo camera -41.17 175.5 2023-03-24T06:30:00Z SUFFIX=_fl TestDemo camera +29 -81 2023-03-25T00:00:00Z SUFFIX=_ca TestDemo camera 51.05 -114.07 2023-03-24T02:07:31.000Z TestDemo moonphase 2019-06-15T09:15:32.987Z TestDemo positions +45.6 -90.7 2018-11-30T17:55:07.234Z TestDemo riseset 45 -90 2019-06-14T21:45:25Z TestDemo seasons 2020 TestDemo culminate +30 -90 2015-02-28T00:00:00Z TestDemo horizon +25.5 -85.3 2016-12-25T12:30:45Z TestDemo lunar_eclipse 1988-01-01T00:00:00Z TestDemo triangulate 48.16042 24.49986 2019 18 7 48.27305 24.36401 662 83 12 echo "Testing demo: gravity.cs" for latitude in {0..90}; do exe/gravity ${latitude} 0 >> test/gravity.txt || Fail "Error running gravity.cs." done diff {correct,test}/gravity.txt || Fail "Error comparing gravity.cs output." echo "PASS: C# demos" exit 0