aboutsummaryrefslogtreecommitdiff
path: root/shell/ash_test/ash-arith/arith2.sub
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-03-05 00:27:50 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-03-05 00:27:50 +0000
commit1c660b4bd2c303fcb829bc93143fc454693afab4 (patch)
tree5b2f2c8676d13bc132fdac4506049facd3475235 /shell/ash_test/ash-arith/arith2.sub
parent3af3e5b4b0d12dffbe7bd144092f8cb140ff74a4 (diff)
downloadbusybox-w32-1c660b4bd2c303fcb829bc93143fc454693afab4.tar.gz
busybox-w32-1c660b4bd2c303fcb829bc93143fc454693afab4.tar.bz2
busybox-w32-1c660b4bd2c303fcb829bc93143fc454693afab4.zip
small ash testsuite, adapted from bash
(only a small part of it, actually)
Diffstat (limited to 'shell/ash_test/ash-arith/arith2.sub')
-rwxr-xr-xshell/ash_test/ash-arith/arith2.sub57
1 files changed, 57 insertions, 0 deletions
diff --git a/shell/ash_test/ash-arith/arith2.sub b/shell/ash_test/ash-arith/arith2.sub
new file mode 100755
index 000000000..f7e3c9235
--- /dev/null
+++ b/shell/ash_test/ash-arith/arith2.sub
@@ -0,0 +1,57 @@
1# bash 3.2 apparently thinks that ++7 is 7 etc
2( echo $(( --7 )) )
3( echo $(( ++7 )) )
4( echo $(( -- 7 )) )
5( echo $(( ++ 7 )) )
6
7#ash# ((++array[0] ))
8#ash# echo 1 $array
9#ash# (( ++ array[0] ))
10#ash# echo 2 $array
11
12#ash# (( ++a ))
13#ash# echo 1 $a
14#ash# (( ++ a ))
15#ash# echo 2 $a
16
17#ash# (( --a ))
18#ash# echo 1 $a
19#ash# (( -- a ))
20#ash# echo 0 $a
21 a=0
22
23echo 5 $(( 4 + ++a ))
24echo 1 $a
25
26# ash doesn't handle it right...
27#ash# echo 6 $(( 4+++a ))
28#ash# echo 2 $a
29 a=2
30
31# ash doesn't handle it right...
32#ash# echo 3 $(( 4---a ))
33#ash# echo 1 $a
34 a=1
35
36echo 4 $(( 4 - -- a ))
37echo 0 $a
38
39#ash# (( -- ))
40# bash 3.2 apparently thinks that ---7 is -7
41#ash# echo $(( ---7 ))
42( echo $(( -- - 7 )) )
43
44#ash# (( ++ ))
45# bash 3.2: 7
46#ash# echo 7 $(( ++7 ))
47( echo $(( ++ + 7 )) )
48
49# bash 3.2: -7
50#ash# echo -7 $(( ++-7 ))
51# bash 3.2: -7
52#ash# echo -7 $(( ++ - 7 ))
53
54# bash 3.2: 7
55#ash# echo 7 $(( +--7 ))
56# bash 3.2: 7
57#ash# echo 7 $(( -- + 7 ))