diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-12-21 23:12:01 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-12-21 23:12:01 +0000 |
commit | 1eb9661d4ccb59756c537710b740c9b59d5b61bd (patch) | |
tree | 779da4430b85c8e76855d29fed742fcbea4d45a8 /Test/06arith.ztst | |
parent | 06d21c58758f922977955cec0ed8d14a90977ce1 (diff) | |
download | zsh-1eb9661d4ccb59756c537710b740c9b59d5b61bd.tar.gz zsh-1eb9661d4ccb59756c537710b740c9b59d5b61bd.tar.xz zsh-1eb9661d4ccb59756c537710b740c9b59d5b61bd.zip |
Initial revision
Diffstat (limited to 'Test/06arith.ztst')
-rw-r--r-- | Test/06arith.ztst | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/Test/06arith.ztst b/Test/06arith.ztst new file mode 100644 index 000000000..35d1ba494 --- /dev/null +++ b/Test/06arith.ztst @@ -0,0 +1,84 @@ +# Tests corresponding to the texinfo node `Arithmetic Evaluation' + +%test + + integer light there + (( light = 42 )) && + let 'there = light' && + print $(( there )) +0:basic integer arithmetic +>42 + + float light there + integer rnd + (( light = 3.1415 )) && + let 'there = light' && + print -- $(( rnd = there * 10000 )) +# save rounding problems by converting to integer +0:basic floating point arithmetic +>31415 + + print $(( 0x10 + 0X01 + 2#1010 )) +0:base input +>27 + + float light + (( light = 4 )) + print $light + typeset -F light + print $light +0:conversion to float +>4.000000000e+00 +>4.0000000000 + + integer i + (( i = 32.5 )) + print $i +0:conversion to int +>32 + + integer i + (( i = 4 - - 3 * 7 << 1 & 7 ^ 1 | 16 ** 2 )) + print $i +0:precedence (arithmetic) +>1591 + + print $(( 1 < 2 || 2 < 2 && 3 > 4 )) +0:precedence (logical) +>1 + + print $(( 1 + 4 ? 3 + 2 ? 4 + 3 ? 5 + 6 ? 4 * 8 : 0 : 0 : 0 : 0 )) +0:precedence (ternary) +>32 + + print $(( 3 ? 2 )) +1:parsing ternary (1) +?ZTST_execchunk:2: ':' expected + + print $(( 3 ? 2 : 1 : 4 )) +1:parsing ternary (2) +?ZTST_execchunk:2: ':' without '?' + + print $(( 0, 4 ? 3 : 1, 5 )) +0:comma operator +>5 + + foo=000 + print $(( ##A + ##\C-a + #foo + $#foo )) +0:#, ## and $# +>117 + + integer i + (( i = 3 + 5 * 1.75 )) + print $i +0:promotion to float +>11 + + typeset x && + (( x = 3.5 )) && + print $x && + (( x = 4 )) && + print $x +0:use of scalars to store integers and floats +>3.5 +>4 |