mirror of
https://github.com/reactos/reactos.git
synced 2025-02-20 15:35:04 +00:00
[CMD_ROSTEST] Add tests for SET /A errorlevels.
This commit is contained in:
parent
87a5403318
commit
f5cf67f455
2 changed files with 85 additions and 0 deletions
|
@ -498,6 +498,62 @@ goto :eof
|
|||
:continue
|
||||
|
||||
|
||||
:: Testing different ERRORLEVELs from the SET command.
|
||||
:: See https://ss64.com/nt/set.html for more details.
|
||||
|
||||
echo ---------- Testing SET /A ERRORLEVELs ----------
|
||||
|
||||
echo --- Success
|
||||
call :setError 0
|
||||
set /a "total=1+1"
|
||||
call :checkErrorLevel 0
|
||||
echo %errorlevel%
|
||||
echo %total%
|
||||
|
||||
echo --- Unbalanced parentheses
|
||||
call :setError 0
|
||||
set /a "total=(2+1"
|
||||
call :checkErrorLevel 1073750988
|
||||
echo %errorlevel%
|
||||
echo %total%
|
||||
|
||||
echo --- Missing operand
|
||||
call :setError 0
|
||||
set /a "total=5*"
|
||||
call :checkErrorLevel 1073750989
|
||||
echo %errorlevel%
|
||||
echo %total%
|
||||
|
||||
echo --- Syntax error
|
||||
call :setError 0
|
||||
set /a "total=7$3"
|
||||
call :checkErrorLevel 1073750990
|
||||
echo %errorlevel%
|
||||
echo %total%
|
||||
|
||||
echo --- Invalid number
|
||||
call :setError 0
|
||||
set /a "total=0xdeadbeeg"
|
||||
call :checkErrorLevel 1073750991
|
||||
echo %errorlevel%
|
||||
echo %total%
|
||||
|
||||
echo --- Number larger than 32-bits
|
||||
call :setError 0
|
||||
set /a "total=999999999999999999999999"
|
||||
call :checkErrorLevel 1073750992
|
||||
echo %errorlevel%
|
||||
echo %total%
|
||||
|
||||
echo --- Division by zero
|
||||
call :setError 0
|
||||
set /a "total=1/0"
|
||||
call :checkErrorLevel 1073750993
|
||||
echo %errorlevel%
|
||||
echo %total%
|
||||
|
||||
|
||||
|
||||
::
|
||||
:: Finished!
|
||||
::
|
||||
|
|
|
@ -130,4 +130,33 @@ OK
|
|||
0
|
||||
0
|
||||
0
|
||||
---------- Testing SET /A ERRORLEVELs ----------
|
||||
--- Success
|
||||
OK
|
||||
0
|
||||
2
|
||||
--- Unbalanced parentheses
|
||||
OK
|
||||
1073750988
|
||||
2
|
||||
--- Missing operand
|
||||
OK
|
||||
1073750989
|
||||
2
|
||||
--- Syntax error
|
||||
OK
|
||||
1073750990
|
||||
7
|
||||
--- Invalid number
|
||||
OK
|
||||
1073750991
|
||||
7
|
||||
--- Number larger than 32-bits
|
||||
OK
|
||||
1073750992
|
||||
7
|
||||
--- Division by zero
|
||||
OK
|
||||
1073750993
|
||||
7
|
||||
--------- Finished --------------
|
||||
|
|
Loading…
Reference in a new issue