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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 86987 - (show annotations)
Thu Aug 11 21:49:58 2011 UTC (8 years, 3 months ago) by manus
File size: 3607 byte(s)
New test similar to rdtp001 except that it ensures that the implementation of `is_equivalent' from AST_EIFFEL is correct by comparing the result of two parsings of the same class and verifying they are indeed equivalent.

1 indexing
2 description : "System's root class"
3
4 class
5 TEST
6
7 create -- TITI
8 {ANY} -- TOOT
9 make
10
11 feature
12 t1: TUPLE [STRING, INTEGER]
13 t2: TUPLE [s: STRING; i: INTEGER]
14 t3: TUPLE [x1,x2,x3: STRING; y1,y2: INTEGER; z: BOOLEAN]
15 t4: TUPLE []
16 t5: TUPLE [x1: STRING; y1, y2: TUPLE[INTEGER, TUPLE[INTEGER]]]
17 t6: TUPLE [y1, y2: TUPLE[INTEGER, TUPLE[INTEGER]]; x1: STRING]
18 t7: TUPLE [y1, y2: TUPLE[z1:INTEGER; z2,z3: TUPLE[INTEGER]]; x1:TUPLE[z4,z5:INTEGER; z6,z7:STRING]]
19
20 feature -- Initialization
21
22 button_id_mask: INTEGER
23 -- Button ID mask
24 once
25 Result := 0b1111
26 end
27
28 test_recursive (a_dir: DIRECTORY) is
29 -- Process files and directories under `a_dir'.
30 require
31 a_dir_not_void: a_dir /= Void
32 a_dir_exists: a_dir.exists
33 local
34 dir_names, file_names: ARRAY [STRING]
35 do
36 dir_names := a_dir.directory_names
37 if dir_names /= Void then
38 dir_names.do_all (agent (a_path: STRING; a_dir_name: STRING)
39 local
40 l_dir: DIRECTORY
41 do
42 create l_dir.make (a_path + operating_environment.Directory_separator.out + a_dir_name)
43 if l_dir.exists then
44 test_recursive (l_dir)
45 end
46 end (a_dir.name, ?))
47 end
48
49 a_dir.open_read
50 file_names := a_dir.filenames
51 if file_names /= Void then
52 file_names.do_all (agent (a_path: STRING; a_dir_name: STRING)
53 do
54 update_eiffel_class (
55 a_path + operating_environment.Directory_separator.out + a_dir_name)
56 end (a_dir.name, ?))
57 end
58 end
59
60 make is
61 -- Creation procedure.
62 local
63 a: ANY
64 do
65 print (agent io)
66 print (agent io)
67 print (agent io.print)
68 print (agent io.print)
69 print ( agent io.
70 print)
71 print (agent io-- TOTO
72 .-- TUTU
73 --TATA
74 print)
75 print (agent (io).print)
76 print (agent (io).print)
77 print ( agent ( io ).print)
78 print ( -- TOTO
79 agent (io)--TUTU
80 .print)
81 print (agent io.print ("FDSF"))
82 print (agent io.print ("FDSF"))
83
84 print (equal (toto,
85 agent print))
86
87 create a
88 create a.default_create
89 create a
90 create a.default_create
91 create a . default_create
92 create a .
93 -- Test
94 default_create
95
96 create {ANY} a
97 create {ANY} a.default_create
98 create {ANY} a
99 create {ANY} a.default_create
100 create {ANY} a
101 create {ANY} a . default_create
102 create {-- TITI
103 ANY}
104 --TUTU
105
106 a
107 create {ANY}-- TOTO
108 a
109 create {ANY} a
110 create {ANY} a
111 -- TEst
112 .
113 default_create
114
115 print (create {ANY})
116 print (create {ANY})
117 print (create {ANY}.default_create)
118 print (create {ANY} . default_create)
119 print (create {--TOTO
120 ANY}--TITI
121
122 --TUTU
123 .
124 -- TATA
125 default_create)
126
127 {ISE_RUNTIME}.generating_type (objet)
128 --ttoto
129 {ISE_RUNTIME}.generating_type (objet)
130 {ISE_RUNTIME}.generating_type (objet)
131
132 t2 := ["hello", 10]
133 print ((equal ("hello", t2.s) and equal (10, t2.i)).out)
134 io.new_line
135
136 t3 := ["a", "b", "c", 1, 2, True]
137 print ((equal ("a", t3.x1) and equal ("b", t3.x2) and equal ("c", t3.x3) and
138 equal (1, t3.y1) and equal (2, t3.y2) and equal (True, t3.z)).out)
139 io.new_line
140
141 t7 := [[1, [2], [3]], [4, [5], [6]], [7, 8, "a", "b"]]
142 print ((equal ([2], t7.y1.z2) and equal ([6], t7.y2.z3) and equal (8, t7.x1.z5)).out)
143 io.new_line
144 end
145
146 button_id_mask: INTEGER
147 -- Button ID mask
148 once
149 Result := 0b1111
150 end
151
152 character_mask: INTEGER is
153 do
154 Result := '%/123/'
155 end
156
157 test_class_cache: detachable STRING assign set_test_class
158 -- Cache for `test_class'
159 obsolete
160 "Will be removed as soon as we do not need ES_TEST_WIZARD_CLASS_WINDOW"
161 attribute
162 end
163
164 end -- class TUPLE_TEST

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23