/[eiffelstudio]/trunk/eweasel/tests/list009/test.e
ViewVC logotype

Contents of /trunk/eweasel/tests/list009/test.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 65297 - (show annotations)
Thu Nov 30 20:22:33 2006 UTC (13 years ago) by manus
File size: 2532 byte(s)
Moved from trunk/Src/eweasel to trunk/eweasel so that a simple checkout of the source code is not penalized by the lenghty process of checking out all the tests of eweasel.
1 class
2 TEST
3
4 create
5
6 make
7
8 feature {NONE} -- Initialization
9
10 make is
11 -- Execute test
12 local
13 i: INTEGER
14 do
15 from
16 i := 1
17 until
18 i > Tests
19 loop
20 fill_list (i)
21 output_list (i)
22 i := i + 1
23 end
24 end
25
26 feature {NONE} -- Constants
27
28 Items: INTEGER is 20
29
30 Tests: INTEGER is 9
31
32 feature {NONE} -- Implementation
33
34 l: ARRAYED_LIST [INTEGER]
35
36 fill_list (n: INTEGER) is
37 -- Fill list with test data `n'
38 require
39 in_range: 1 <= n and n <= Tests
40 local
41 i: INTEGER
42 do
43 create l.make (Items)
44 inspect
45 n
46 when 1 then
47 from
48 i := 1
49 until
50 i > Items
51 loop
52 l.extend (i)
53 i := i + 1
54 end
55 when 2 then
56 from
57 i := 1
58 until
59 i > Items
60 loop
61 l.put_right (i)
62 i := i + 1
63 end
64 when 3 then
65 from
66 i := 1
67 l.forth
68 until
69 i > Items
70 loop
71 l.extend (i)
72 i := i + 1
73 end
74 when 4 then
75 from
76 i := 1
77 l.forth
78 until
79 i > Items
80 loop
81 l.put_front (i)
82 i := i + 1
83 end
84 when 5 then
85 from
86 i := 1
87 l.forth
88 until
89 i > Items
90 loop
91 l.put_left (i)
92 i := i + 1
93 end
94 when 6 then
95 from
96 i := 1
97 until
98 i > Items // 2
99 loop
100 l.extend (i)
101 i := i + 1
102 end
103 from
104 i := (Items // 2) + 1
105 l.go_i_th (i // 2)
106 until
107 i > Items
108 loop
109 l.extend (i)
110 i := i + 1
111 end
112 when 7 then
113 from
114 i := 1
115 until
116 i > Items // 2
117 loop
118 l.extend (i)
119 i := i + 1
120 end
121 from
122 i := (Items // 2) + 1
123 l.go_i_th (i // 2)
124 until
125 i > Items
126 loop
127 l.put_front (i)
128 i := i + 1
129 end
130 when 8 then
131 from
132 i := 1
133 until
134 i > Items // 2
135 loop
136 l.extend (i)
137 i := i + 1
138 end
139 from
140 i := (Items // 2) + 1
141 l.go_i_th (i // 2)
142 until
143 i > Items
144 loop
145 l.put_left (i)
146 i := i + 1
147 end
148 when 9 then
149 from
150 i := 1
151 until
152 i > Items // 2
153 loop
154 l.extend (i)
155 i := i + 1
156 end
157 from
158 i := (Items // 2) + 1
159 l.go_i_th (i // 2)
160 until
161 i > Items
162 loop
163 l.put_right (i)
164 i := i + 1
165 end
166 end
167 end
168
169 output_list (n: INTEGER) is
170 -- Output list of test `n'.
171 require
172 in_range: 1 <= n and n <= Tests
173 do
174 Io.put_string ("Test " + n.out + ": ")
175 from
176 l.start
177 until
178 l.after
179 loop
180 Io.put_integer (l.item)
181 if not l.islast then Io.put_string (",") end
182 l.forth
183 end
184 Io.put_new_line
185 end
186
187 end -- class TEST

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23