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

Annotation of /trunk/eweasel/tests/lib044/test.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 102155 - (hide annotations)
Wed Sep 12 07:14:47 2018 UTC (13 months ago) by alexk
File size: 2873 byte(s)
Extended test cases to cover `is` forms of across loops.
1 alexk 99861 class TEST
2    
3     create
4     make
5    
6     feature {NONE} -- Creation
7    
8     make
9     -- Run test.
10     local
11     table: HASH_TABLE [INTEGER, INTEGER]
12     do
13 alexk 99866 io.put_string ("Test #1:")
14     io.put_new_line
15     create table.make (1)
16     table [1] := 7
17     table.remove (1)
18     -- Forward iteration.
19 alexk 99861 across
20 alexk 99866 table as c
21     loop
22     io.put_character ('%T')
23     io.put_integer (c.item)
24     end
25 alexk 102155 across
26     table is c
27     loop
28     io.put_character ('(')
29     io.put_integer (c)
30     io.put_character (')')
31     end
32 alexk 99866 from
33     table.start
34     until
35     table.after
36     loop
37     io.put_integer (table.item_for_iteration)
38     table.forth
39     end
40     -- Backward iteration.
41     across
42     table.new_cursor.reversed as c
43     loop
44     io.put_character ('-')
45     io.put_integer (c.item)
46     end
47 alexk 102155 across
48     table.new_cursor.reversed is c
49     loop
50     io.put_character ('(')
51     io.put_integer (c)
52     io.put_character (')')
53     end
54 alexk 99866 io.put_new_line
55    
56     io.put_string ("Test #2:")
57     io.put_new_line
58     across
59     1 |..| 2 as i
60     loop
61     create table.make (2)
62     table [1] := 7
63     table [2] := 6
64     if i.item /= 1 then table.remove (1) end
65     if i.item /= 2 then table.remove (2) end
66     -- Forward iteration.
67     across
68     table as c
69     loop
70     io.put_character ('%T')
71     io.put_integer (c.item)
72     end
73 alexk 102155 across
74     table is c
75     loop
76     io.put_character ('(')
77     io.put_integer (c)
78     io.put_character (')')
79     end
80 alexk 99866 from
81     table.start
82     until
83     table.after
84     loop
85     io.put_integer (table.item_for_iteration)
86     table.forth
87     end
88     -- Backward iteration.
89     across
90     table.new_cursor.reversed as c
91     loop
92     io.put_character ('-')
93     io.put_integer (c.item)
94     end
95 alexk 102155 across
96     table.new_cursor.reversed is c
97     loop
98     io.put_character ('(')
99     io.put_integer (c)
100     io.put_character (')')
101     end
102 alexk 99866 io.put_new_line
103     end
104    
105     io.put_string ("Test #3:")
106     io.put_new_line
107     across
108 alexk 99861 1 |..| 3 as i
109     loop
110     create table.make (3)
111     table [1] := 7
112     table [2] := 6
113     table [3] := 5
114     if i.item /= 1 then table.remove (1) end
115     if i.item /= 2 then table.remove (2) end
116     if i.item /= 3 then table.remove (3) end
117     -- Forward iteration.
118     across
119     table as c
120     loop
121 alexk 99866 io.put_character ('%T')
122 alexk 99861 io.put_integer (c.item)
123     end
124 alexk 102155 across
125     table is c
126     loop
127     io.put_character ('(')
128     io.put_integer (c)
129     io.put_character (')')
130     end
131 alexk 99866 from
132     table.start
133     until
134     table.after
135     loop
136     io.put_integer (table.item_for_iteration)
137     table.forth
138     end
139 alexk 99861 -- Backward iteration.
140     across
141     table.new_cursor.reversed as c
142     loop
143 alexk 99866 io.put_character ('-')
144 alexk 99861 io.put_integer (c.item)
145     end
146 alexk 102155 across
147     table.new_cursor.reversed is c
148     loop
149     io.put_character ('(')
150     io.put_integer (c)
151     io.put_character (')')
152     end
153 alexk 99861 io.put_new_line
154     end
155     end
156    
157     end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23