Files
astronomy/generate/diffcalc.bat
Don Cross 7e196a3c17 Fixed Windows batch files ignoring negative integer failure codes.
In many of my Windows batch files, I used the following
construct to detect failures:

    do_something
    if errorlevel 1 (
        echo.An error occurred in do_something
        exit /b 1
    )

I discovered that it is possible for a Windows program
to exit with a negative integer error code.
This causes the above construct to miss the failure
and the batch file blithely continues.

So I have replaced that construct with

    do_something || (
        echo.An error occurred in do_something
        exit /b 1
    )

This way, if the command exits with any nonzero error,
we correctly detect it as a failure.
2023-02-26 10:26:42 -05:00

28 lines
795 B
Batchfile

@echo off
setlocal EnableDelayedExpansion
set CTESTEXE=bin\ctest.exe
if not exist !CTESTEXE! (
echo.FATAL[diffcalc]: executable does not exist: !CTESTEXE!
exit /b 1
)
echo.Diffing calculations.
set /a FAILCOUNT = 0
!CTESTEXE! diff 5.3e-15 temp\c_check.txt dotnet\csharp_test\csharp_check.txt || set /a FAILCOUNT += 1
!CTESTEXE! diff 6.3e-15 temp\c_check.txt temp\k_check.txt || set /a FAILCOUNT += 1
!CTESTEXE! diff 5.7e-15 temp\c_check.txt temp\js_check.txt || set /a FAILCOUNT += 1
!CTESTEXE! diff 7.11e-16 temp\c_check.txt temp\py_check.txt || set /a FAILCOUNT += 1
!CTESTEXE! diff 5.7e-15 temp\js_check.txt temp\py_check.txt || set /a FAILCOUNT += 1
if !FAILCOUNT! NEQ 0 (
echo.diffcalc: *** FAILED !FAILCOUNT! TESTS ***
exit /b 1
)
echo.diffcalc: PASS
echo.
exit /b 0