From a0a61cb59200c9147be700f6051d0365640dec01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delanoy?= Date: Tue, 23 Oct 2012 03:10:25 +0200 Subject: [PATCH] cmd/tests: Add tests for EQU comparison operator in "if" statements. --- programs/cmd/tests/test_builtins.cmd | 17 +++++++++++++++++ programs/cmd/tests/test_builtins.cmd.exp | 14 ++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index 28721c1d7d0..7c8339396ff 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -688,6 +688,12 @@ if a LEQ B (echo a LEQ B) else echo NT4 if /I a LEQ B echo a LEQ B insensitive if A LEQ b echo A LEQ b if /I A LEQ b echo A LEQ b insensitive +for %%i in (%STR_PARMS%) do call :EQUtest %%i A +for %%i in (%STR_PARMS%) do call :EQUtest %%i B +for %%i in (%STR_PARMS%) do call :EQUtest %%i AB +for %%i in (%STR_PARMS%) do call :EQUtest %%i BA +for %%i in (%STR_PARMS%) do call :EQUtest %%i AA +if /I A EQU a echo A EQU a insensitive echo ------ for numbers if -1 LSS 1 (echo negative numbers handled) if not -1 LSS -10 (echo negative numbers handled) @@ -705,6 +711,14 @@ for %%i in (%INT_PARMS%) do call :LEQtest %%i 0 for %%i in (%INT_PARMS%) do call :LEQtest %%i 1 for %%i in (%INT_PARMS%) do call :LEQtest %%i 10 for %%i in (%INT_PARMS%) do call :LEQtest %%i 9 +for %%i in (%INT_PARMS%) do call :EQUtest %%i 0 +for %%i in (%INT_PARMS%) do call :EQUtest %%i 1 +for %%i in (%INT_PARMS%) do call :EQUtest %%i 10 +for %%i in (%INT_PARMS%) do call :EQUtest %%i 9 +if 011 EQU 9 (echo octal ok) +if 0xA1 EQU 161 (echo hexa ok) +if 0xA1 EQU "161" (echo hexa should be be recognized) else (echo string/hexa compare ok) +if "0xA1" EQU 161 (echo hexa should be be recognized) else (echo string/hexa compare ok) goto :endIfCompOpsSubroutines rem IF subroutines helpers @@ -714,6 +728,9 @@ goto :eof :LEQtest if %1 LEQ %2 echo %1 LEQ %2 goto :eof +:EQUtest +if %1 EQU %2 echo %1 EQU %2 +goto :eof :endIfCompOpsSubroutines set STR_PARMS= diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index 53eaffd73a9..91ad55b77e0 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -481,6 +481,12 @@ LSS string can be used as operand for LSS comparison @todo_wine@a LEQ B insensitive @todo_wine@A LEQ b @todo_wine@A LEQ b insensitive +@todo_wine@A EQU A +@todo_wine@B EQU B +@todo_wine@AB EQU AB +@todo_wine@BA EQU BA +@todo_wine@AA EQU AA +@todo_wine@A EQU a insensitive ------ for numbers negative numbers handled negative numbers handled @@ -505,6 +511,14 @@ also in negative form @todo_wine@0 LEQ 9 @todo_wine@1 LEQ 9 @todo_wine@9 LEQ 9 +@todo_wine@0 EQU 0 +@todo_wine@1 EQU 1 +@todo_wine@10 EQU 10 +@todo_wine@9 EQU 9 +@todo_wine@octal ok +@todo_wine@hexa ok +@todo_wine@string/hexa compare ok +@todo_wine@string/hexa compare ok ------------ Testing for ------------ --- plain FOR A