Added some integer tests

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6997 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2018-06-01 16:33:13 +00:00
parent a6b869aeea
commit 565386c71f
2 changed files with 47 additions and 12 deletions

View file

@ -67,7 +67,7 @@ ShowInstDetails show
Section "" ; empty string makes it hidden, so would starting with -
; write reg info
StrCpy $1 "POOOOOOOOOOOP"
StrCpy $1 "Hello World"
DetailPrint "I like to be able to see what is going on (debug) $1"
WriteRegStr HKLM SOFTWARE\NSISTest\BigNSISTest "Install_Dir" "$INSTDIR"
@ -149,6 +149,27 @@ SectionEnd
SectionGroup Group2
!define ASSERT `!insertmacro ASSERT "${U+24}{__FILE__}" ${U+24}{__LINE__} `
!macro ASSERT __file __line __xpr
${__xpr} +2
MessageBox MB_ICONSTOP `ASSERT: ${__xpr} (${__file}:${__line})`
!macroend
Section "Integer"
IntOp $0 0xffffffff >> 31
${ASSERT} `IntCmpU $0 -1`
IntOp $0 0xffffffff >>> 31
${ASSERT} `IntCmpU $0 1`
IntOp $0 1 << 31
${ASSERT} `IntCmpU $0 0x80000000`
IntOp $0 0x80000000 ^ 0x40000000
${ASSERT} `IntCmpU $0 0xC0000000`
ClearErrors
IntOp $0 1 / 0
${ASSERT} `IfErrors ` ; Division by zero must set the error flag
${ASSERT} `IntCmpU $0 0` ; Unspecified result, hopefully it's zero
SectionEnd
Section "Test Branching"
BeginTestSection: