1 |
class TEST inherit |
2 |
|
3 |
create |
4 |
|
5 |
make |
6 |
|
7 |
feature {NONE} -- Initialization |
8 |
|
9 |
make is |
10 |
-- Execute test. |
11 |
do |
12 |
create l.make (2) |
13 |
Io.put_string ("Empty list%N") |
14 |
Io.put_string ("extend (2): ") |
15 |
l.extend (2) |
16 |
output_list |
17 |
Io.put_string ("l.start%N") |
18 |
l.start |
19 |
Io.put_string ("put_left (1): ") |
20 |
l.put_left (1) |
21 |
output_list |
22 |
Io.put_string ("l.forth%N") |
23 |
l.forth |
24 |
Io.put_string ("put_left (6): ") |
25 |
l.put_left (6) |
26 |
output_list |
27 |
Io.put_string ("l.back%N") |
28 |
l.back |
29 |
Io.put_string ("put_left (3): ") |
30 |
l.put_left (3) |
31 |
output_list |
32 |
Io.put_string ("put_left (5): ") |
33 |
l.put_left (5) |
34 |
output_list |
35 |
Io.put_string ("l.back%N") |
36 |
l.back |
37 |
Io.put_string ("put_left (4): ") |
38 |
l.put_left (4) |
39 |
output_list |
40 |
end |
41 |
|
42 |
feature {NONE} -- Implementation |
43 |
|
44 |
l: ARRAYED_LIST [INTEGER] |
45 |
|
46 |
output_list is |
47 |
-- Output list. |
48 |
local |
49 |
old_idx: INTEGER |
50 |
do |
51 |
old_idx := l.index |
52 |
from |
53 |
l.start |
54 |
until |
55 |
l.after |
56 |
loop |
57 |
Io.put_integer (l.item) |
58 |
if not l.islast then Io.put_string (", ") end |
59 |
l.forth |
60 |
end |
61 |
l.go_i_th (old_idx) |
62 |
Io.put_string (" (idx: " + l.index.out + ")%N") |
63 |
end |
64 |
|
65 |
end -- class TEST |