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

Contents of /trunk/eweasel/tests/tree002/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: 1186 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 do
13 run_test (False)
14 run_test (True)
15 end
16
17 feature {NONE} -- Constants
18
19 Items: INTEGER is 4
20
21 feature {NONE} -- Initialization
22
23 t1, t2: BINARY_SEARCH_TREE [STRING]
24
25 run_test (object_comparison: BOOLEAN) is
26 -- Set `object_comparison' and run test.
27 do
28 create t1.make ("1")
29 if object_comparison then
30 t1.compare_objects
31 else
32 t1.compare_references
33 end
34 fill_tree (t1, Items)
35 t2 := t1.twin
36 Io.put_boolean (equal (t1, t2))
37 Io.put_new_line
38 end
39
40 fill_tree (t: like t1; size: INTEGER) is
41 -- Fill `t' with `size' items.
42 require
43 tree_exists: t /= Void
44 positive_size: size > 0
45 local
46 i: INTEGER
47 item: INTEGER
48 old_count: INTEGER
49 do
50 from
51 i := 2
52 until
53 i > size
54 loop
55 if i \\ 2 = 0 then
56 item := size + 1 - (i // 2)
57 else
58 item := 1 + (i // 2)
59 end
60 old_count := t.count
61 t.extend (item.out)
62 check
63 inserted: t.count = old_count + 1
64 -- Because we inserted an item
65 end
66 i := i + 1
67 end
68 ensure
69 filled: t.count = size
70 end
71
72 end -- class TEST

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23