|
1 # Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 # All rights reserved. |
|
3 # This component and the accompanying materials are made available |
|
4 # under the terms of the License "Eclipse Public License v1.0" |
|
5 # which accompanies this distribution, and is available |
|
6 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 # |
|
8 # Initial Contributors: |
|
9 # Nokia Corporation - initial contribution. |
|
10 # |
|
11 # Contributors: |
|
12 # |
|
13 # Description: |
|
14 # |
|
15 |
|
16 init() |
|
17 { |
|
18 let totalno=0; |
|
19 let passno=0; |
|
20 let failno=0; |
|
21 } |
|
22 |
|
23 util_shift2() |
|
24 { |
|
25 argc=$# |
|
26 shift 1 |
|
27 ret=$? |
|
28 if [ 1 -le $argc ] && [ $ret -eq 0 ] || [ $ret -eq 1 ] |
|
29 then |
|
30 { |
|
31 echo "PASS" |
|
32 let passno=passno+1 |
|
33 } |
|
34 else |
|
35 { |
|
36 echo "FAIL: Returned $ret" |
|
37 let failno=failno+1 |
|
38 } |
|
39 fi |
|
40 } |
|
41 |
|
42 test_shift2() |
|
43 { |
|
44 let totalno=totalno+1 |
|
45 echo "Test $totalno: shift with no argument to shift the argument list by 1 left, where there is no argument" |
|
46 util_shift2 |
|
47 } |
|
48 |
|
49 test_shift3() |
|
50 { |
|
51 let totalno=totalno+1 |
|
52 echo "Test $totalno: shift with 1 argument to shift the argument list by 1 left from 1 argument" |
|
53 util_shift2 1 |
|
54 } |
|
55 |
|
56 test_shift4() |
|
57 { |
|
58 let totalno=totalno+1 |
|
59 echo "Test $totalno: shift with 1 argument to shift the argument list by 1 left from 2 arguments" |
|
60 util_shift2 1 2 |
|
61 } |
|
62 |
|
63 |
|
64 util_shift5() |
|
65 { |
|
66 a=(1 2 3) |
|
67 shift a |
|
68 } |
|
69 |
|
70 test_shift5() |
|
71 { |
|
72 let totalno=totalno+1 |
|
73 echo "Test $totalno: shift with array name as argument to shift the argument list by left" |
|
74 argc=$# |
|
75 util_shift5 |
|
76 ret=$? |
|
77 if [ $ret -eq 0 ] |
|
78 then |
|
79 { |
|
80 echo "PASS" |
|
81 let passno=passno+1 |
|
82 } |
|
83 else |
|
84 { |
|
85 echo "FAIL: Expected return value 0, but returned $ret" |
|
86 let failno=failno+1 |
|
87 } |
|
88 fi |
|
89 } |
|
90 |
|
91 test_shift6() |
|
92 { |
|
93 let totalno=totalno+1 |
|
94 echo "Test $totalno: shift with array name as argument to shift the argument list by left" |
|
95 argc=$# |
|
96 util_shift5 symbian |
|
97 ret=$? |
|
98 if [ $ret -eq 0 ] |
|
99 then |
|
100 { |
|
101 echo "PASS" |
|
102 let passno=passno+1 |
|
103 } |
|
104 else |
|
105 { |
|
106 echo "FAIL: Expected return value 0, but returned $ret" |
|
107 let failno=failno+1 |
|
108 } |
|
109 fi |
|
110 } |
|
111 |
|
112 |
|
113 test_shift7() |
|
114 { |
|
115 let totalno=totalno+1 |
|
116 echo "Test $totalno: shift with array name as argument to shift the argument list by left" |
|
117 argc=$# |
|
118 util_shift5 symbian os |
|
119 ret=$? |
|
120 if [ $ret -eq 0 ] |
|
121 then |
|
122 { |
|
123 echo "PASS" |
|
124 let passno=passno+1 |
|
125 } |
|
126 else |
|
127 { |
|
128 echo "FAIL: Expected return value 0, but returned $ret" |
|
129 let failno=failno+1 |
|
130 } |
|
131 fi |
|
132 } |
|
133 |
|
134 test_shift8() |
|
135 { |
|
136 let totalno=totalno+1 |
|
137 echo "Test $totalno: shift with array name as argument to shift the argument list by left" |
|
138 argc=$# |
|
139 util_shift5 symbian os ver9.1 |
|
140 ret=$? |
|
141 if [ $ret -eq 0 ] |
|
142 then |
|
143 { |
|
144 echo "PASS" |
|
145 let passno=passno+1 |
|
146 } |
|
147 else |
|
148 { |
|
149 echo "FAIL: Expected return value 0, but returned $ret" |
|
150 let failno=failno+1 |
|
151 } |
|
152 fi |
|
153 } |
|
154 |
|
155 test_shift9() |
|
156 { |
|
157 let totalno=totalno+1 |
|
158 echo "Test $totalno: shift with array name as argument to shift the argument list by left" |
|
159 argc=$# |
|
160 util_shift5 symbian os version 9.1 |
|
161 ret=$? |
|
162 if [ $ret -eq 0 ] |
|
163 then |
|
164 { |
|
165 echo "PASS" |
|
166 let passno=passno+1 |
|
167 } |
|
168 else |
|
169 { |
|
170 echo "FAIL: Expected return value 0, but returned $ret" |
|
171 let failno=failno+1 |
|
172 } |
|
173 fi |
|
174 } |
|
175 |
|
176 util_shift10() |
|
177 { |
|
178 shift -1 |
|
179 } |
|
180 |
|
181 test_shift10() |
|
182 { |
|
183 let totalno=totalno+1 |
|
184 echo "Test $totalno: shift with -1 as argument to negative-test" |
|
185 argc=$# |
|
186 util_shift10 |
|
187 ret=$? |
|
188 if [ $ret -eq 1 ] |
|
189 then |
|
190 { |
|
191 echo "PASS" |
|
192 let passno=passno+1 |
|
193 } |
|
194 else |
|
195 { |
|
196 echo "FAIL: Expected return value 1, but returned $ret" |
|
197 let failno=failno+1 |
|
198 } |
|
199 fi |
|
200 |
|
201 } |
|
202 |
|
203 |
|
204 test_shift11() |
|
205 { |
|
206 let totalno=totalno+1 |
|
207 echo "Test $totalno: shift with -1 as argument to negative-test" |
|
208 argc=$# |
|
209 util_shift10 s y m b i a n |
|
210 ret=$? |
|
211 if [ $ret -eq 1 ] |
|
212 then |
|
213 { |
|
214 echo "PASS" |
|
215 let passno=passno+1 |
|
216 } |
|
217 else |
|
218 { |
|
219 echo "FAIL: Expected return value 1, but returned $ret" |
|
220 let failno=failno+1 |
|
221 } |
|
222 fi |
|
223 |
|
224 } |
|
225 |
|
226 report() |
|
227 { |
|
228 echo "#############################################################################" |
|
229 echo "Total tests : $totalno" |
|
230 echo "Passed : $passno" |
|
231 echo "Failed : $failno" |
|
232 echo "#############################################################################" |
|
233 } |
|
234 |
|
235 init |
|
236 test_shift2 |
|
237 test_shift3 |
|
238 test_shift4 |
|
239 test_shift5 |
|
240 test_shift6 |
|
241 test_shift7 |
|
242 test_shift8 |
|
243 test_shift9 |
|
244 test_shift10 |
|
245 test_shift11 |
|
246 report |