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

Contents of /trunk/eweasel/tests/tree004/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: 4934 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 make
6
7 feature
8
9
10 make is
11 do
12 test_arrayed_tree
13 test_linked_tree
14 test_two_way_tree
15 test_binary_tree
16 test_binary_search_tree
17 test_fixed_tree
18 test_test1_tree
19 end
20
21 test_arrayed_tree is
22 local
23 foo, bar: ARRAYED_TREE [STRING]
24 do
25 create foo.make (2, "Root")
26 foo.compare_objects
27 foo.child_extend ("child one")
28 foo.child_extend ("child two")
29 create bar.make (1, Void)
30 bar.compare_objects
31 bar.copy (foo)
32 check is_equal: bar.is_equal (foo) end
33
34
35 create foo.make (2, "Root")
36 foo.compare_objects
37 foo.child_extend ("child one")
38 foo.child_extend ("child two")
39 foo.child_start
40 foo.child.child_extend ("grandchild one") -- added a grandchild
41 create bar.make (2, Void)
42 bar.compare_objects
43 bar.copy (foo)
44 check is_equal: bar.is_equal (foo) end
45 end
46
47 test_linked_tree is
48 local
49 foo, bar: LINKED_TREE [STRING]
50 do
51 create foo.make ("Root")
52 foo.compare_objects
53 foo.child_extend ("child one")
54 foo.child_extend ("child two")
55 create bar.make (Void)
56 bar.compare_objects
57 bar.copy (foo)
58 check is_equal: bar.is_equal (foo) end
59
60
61 create foo.make ("Root")
62 foo.compare_objects
63 foo.child_extend ("child one")
64 foo.child_extend ("child two")
65 foo.child_start
66 foo.child.child_extend ("grandchild one") -- added a grandchild
67 create bar.make (Void)
68 bar.compare_objects
69 bar.copy (foo)
70 check is_equal: bar.is_equal (foo) end
71 end
72
73 test_two_way_tree is
74 local
75 foo, bar: TWO_WAY_TREE [STRING]
76 do
77 create foo.make ("Root")
78 foo.compare_objects
79 foo.child_extend ("child one")
80 foo.child_extend ("child two")
81 create bar.make (Void)
82 bar.compare_objects
83 bar.copy (foo)
84 check is_equal: bar.is_equal (foo) end
85
86
87 create foo.make ("Root")
88 foo.compare_objects
89 foo.child_extend ("child one")
90 foo.child_extend ("child two")
91 foo.child_start
92 foo.child.child_extend ("grandchild one") -- added a grandchild
93 create bar.make (Void)
94 bar.compare_objects
95 bar.copy (foo)
96 check is_equal: bar.is_equal (foo) end
97 end
98
99 test_binary_tree is
100 local
101 foo, bar: BINARY_TREE [STRING]
102 do
103 create foo.make ("Root")
104 foo.compare_objects
105 foo.put_left_child (create {BINARY_TREE [STRING]}.make ("child one"))
106 foo.put_right_child (create {BINARY_TREE [STRING]}.make ("child two"))
107 create bar.make (Void)
108 bar.compare_objects
109 bar.copy (foo)
110 check is_equal: bar.is_equal (foo) end
111
112
113 create foo.make ("Root")
114 foo.compare_objects
115 foo.put_left_child (create {BINARY_TREE [STRING]}.make ("child one"))
116 foo.put_right_child (create {BINARY_TREE [STRING]}.make ("child two"))
117 foo.child_start
118 foo.child.put_left_child (create {BINARY_TREE [STRING]}.make ("grandchild one")) -- added a grandchild
119 create bar.make (Void)
120 bar.compare_objects
121 bar.copy (foo)
122 check is_equal: bar.is_equal (foo) end
123 end
124
125 test_binary_search_tree is
126 local
127 foo, bar: BINARY_SEARCH_TREE [STRING]
128 do
129 create foo.make ("Root")
130 foo.compare_objects
131 foo.extend ("child one")
132 foo.extend ("child two")
133 create bar.make ("")
134 bar.compare_objects
135 bar.copy (foo)
136 check is_equal: bar.is_equal (foo) end
137
138
139 create foo.make ("Root")
140 foo.compare_objects
141 foo.extend ("child one")
142 foo.extend ("child two")
143 foo.child_start
144 foo.child.extend ("grandchild one") -- added a grandchild
145 create bar.make ("")
146 bar.compare_objects
147 bar.copy (foo)
148 check is_equal: bar.is_equal (foo) end
149 end
150
151 test_fixed_tree is
152 local
153 foo, bar: FIXED_TREE [STRING]
154 do
155 create foo.make (2, "Root")
156 foo.compare_objects
157 foo.put_child (create {FIXED_TREE [STRING]}.make (0, "child one"))
158 foo.put_child (create {FIXED_TREE [STRING]}.make (0, "child two"))
159 create bar.make (1, Void)
160 bar.compare_objects
161 bar.copy (foo)
162 check is_equal: bar.is_equal (foo) end
163
164
165 create foo.make (2, "Root")
166 foo.compare_objects
167 foo.put_child (create {FIXED_TREE [STRING]}.make (1, "child one"))
168 foo.put_child (create {FIXED_TREE [STRING]}.make (0, "child two"))
169 foo.child_start
170 foo.child.put_child (create {FIXED_TREE [STRING]}.make (0, "grandchild one")) -- added a grandchild
171 create bar.make (2, Void)
172 bar.compare_objects
173 bar.copy (foo)
174 check is_equal: bar.is_equal (foo) end
175 end
176
177 test_test1_tree is
178 local
179 foo, bar: TEST1 [STRING]
180 do
181 create foo.make (2, "Root")
182 foo.compare_objects
183 foo.child_extend ("child one")
184 foo.child_extend ("child two")
185 create bar.make (1, Void)
186 bar.compare_objects
187 bar.copy (foo)
188 check is_equal: bar.is_equal (foo) end
189
190
191 create foo.make (2, "Root")
192 foo.compare_objects
193 foo.child_extend ("child one")
194 foo.child_extend ("child two")
195 foo.child_start
196 foo.child.child_extend ("grandchild one") -- added a grandchild
197 create bar.make (2, Void)
198 bar.compare_objects
199 bar.copy (foo)
200 check is_equal: bar.is_equal (foo) end
201 end
202
203
204 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23