@echo off
chcp 1251 >nul
pushd
chdir /d %1
set exename=%~2
if %2 == "%exename:_unittest=%" (
make TARGET=release release/%~2
) else (
make -f UnitTests TARGET=release release/%~2
)
set errcode=%errorlevel%
if errorlevel 1 goto :error
echo ^>Запуск программы...
call :dt st
release\%~2 %~3
set errcode=%ERRORLEVEL%
call :dt et
:error
popd
set /A dt=(%et% - %st%) * 10
echo ^>Код завершения: %errcode% Время выполнения: %dt% ms
if "%4" == "pause" (
pause
) else (
exit /B %errcode%
)
goto :EOF
:dt
set t=%time: =0%
set /A %1=1%t:~0,2%*360000 + 1%t:~3,2%*6000 + 1%t:~6,2%*100 + 1%t:~9,2% - 36610100
exit /B
