📄 integer.t
字号:
name: integer-base-err-1description: Can't have 0 base (causes shell to exit)expected-exit: e != 0stdin: typeset -i i i=3 i=0#4 echo $iexpected-stderr-pattern: /^.*:.*0#4.*\n$/---name: integer-base-err-2description: Can't have multiple bases in a `constant' (causes shell to exit) (ksh88 fails this test)expected-exit: e != 0stdin: typeset -i i i=3 i=2#110#11 echo $iexpected-stderr-pattern: /^.*:.*2#110#11.*\n$/---name: integer-base-err-3description: Syntax errors in expressions and effects on bases (interactive so errors don't cause exits) (ksh88 fails this test - shell exits, even with -i)arguments: !-i!stdin: PS1= # minimize prompt hassles typeset -i4 a=10 typeset -i a=2+ echo $a typeset -i4 a=10 typeset -i2 a=2+ echo $aexpected-stderr-pattern: /^([#\$] )?.*:.*2+.*\n.*:.*2+.*\n$/expected-stdout: 4#22 4#22---name: integer-base-err-4description: Are invalid digits (according to base) errors? (ksh93 fails this test)expected-exit: e != 0stdin: typeset -i i; i=3#4expected-stderr-pattern: /^([#\$] )?.*:.*3#4.*\n$/---name: integer-base-1description: Missing number after base is treated as 0.stdin: typeset -i i i=3 i=2# echo $iexpected-stdout: 0---name: integer-base-2description: Check `stickyness' of base in various situationsstdin: typeset -i i=8 echo $i echo ---------- A typeset -i4 j=8 echo $j echo ---------- B typeset -i k=8 typeset -i4 k=8 echo $k echo ---------- C typeset -i4 l l=3#10 echo $l echo ---------- D typeset -i m m=3#10 echo $m echo ---------- E n=2#11 typeset -i n echo $n n=10 echo $n echo ---------- F typeset -i8 o=12 typeset -i4 o echo $o echo ---------- G typeset -i p let p=8#12 echo $pexpected-stdout: 8 ---------- A 4#20 ---------- B 4#20 ---------- C 4#3 ---------- D 3#10 ---------- E 2#11 2#1010 ---------- F 4#30 ---------- G 8#12---name: integer-base-3description: More base parsing (hmm doesn't test much..)stdin: typeset -i aa aa=1+12#10+2 echo $aa typeset -i bb bb=1+$aa echo $bb typeset -i bb bb=$aa echo $bb typeset -i cc cc=$aa echo $ccexpected-stdout: 15 16 15 15---name: integer-base-4description: Check that things not declared as integers are not made integers, also, check if base is not reset by -i with no arguments. (ksh93 fails - prints 10#20 - go figure)stdin: xx=20 let xx=10 typeset -i | grep '^xx=' typeset -i4 a=10 typeset -i a=20 echo $aexpected-stdout: 4#110---name: integer-base-5description: More base stuffstdin: typeset -i4 a=3#10 echo $a echo -- typeset -i j=3 j=~3 echo $j echo -- typeset -i k=1 x[k=k+1]=3 echo $k echo -- typeset -i l for l in 1 2+3 4; do echo $l; doneexpected-stdout: 4#3 -- -4 -- 2 -- 1 5 4---name: integer-base-6description: Even more base stuff (ksh93 fails this test - prints 0)stdin: typeset -i7 i i= echo $iexpected-stdout: 7#0---name: integer-base-7description: Check that non-integer parameters don't get bases assignedstdin: echo $(( zz = 8#100 )) echo $zzexpected-stdout: 64 64---
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -