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

Contents of /trunk/eweasel/tests/exec235/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: 2342 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 indexing
2 description: ""
3 date: "$Date$"
4 revision: "$Revision$"
5
6 class
7 TEST
8
9 inherit
10 LINKED_LIST [STRING]
11 redefine make end
12
13 create make
14
15 feature
16
17 neutral (ni: INTEGER) is do end
18
19 make is
20 local
21 a1: A [INTEGER]
22 a2: A [STRING]
23 do
24 neutral ($MELT6)
25 create a1
26 io.new_line
27
28 a1.f1 (1)
29 io.new_line
30 a1.f2 (2)
31 create a2
32 io.new_line
33 a2.f1 ("3")
34 io.new_line
35 a2.f2 ("4")
36
37 io.new_line
38
39 a1.receive_f (
40 (agent (i: INTEGER; g: INTEGER): INTEGER
41 do
42 Result := i + g
43 end), 10, 90)
44
45 a1.receive_p (
46 (agent (i: INTEGER; g: INTEGER)
47 do
48 print ("got: " + i.out + ", " + g.out)
49 end), 10, 90)
50
51 a2.receive_f (
52 (agent (i: INTEGER; g: STRING): STRING
53 do
54 Result := i.out + g
55 end), 10, "91")
56
57 a2.receive_p (
58 (agent (i: INTEGER; g: STRING)
59 do
60 print ("got: " + i.out + ", " + g)
61 end), 10, "91")
62
63 io.new_line
64
65 receive_a (a2)
66
67 io.new_line
68
69 print ("List count: ")
70 print ((agent count).item ([]))
71 io.new_line;
72 extend ("str1")
73 (agent extend).call (["String"])
74 print ("List count2: ")
75 print ((agent count).item ([]))
76 io.new_line
77 gen_caller (["String"], (agent extend))
78 gen_caller ([], agent start)
79 print ((agent item.out).item ([]))
80 io.new_line
81
82 print (gen_item (["STRING"], agent (s: STRING): STRING do Result := s end))
83
84 -- To satisfy the postcondition of LINKED_LIST.
85 wipe_out
86 end
87
88 receive_a (a: A[STRING]) is
89 do
90 print ("receive_a%N")
91 (agent a.receive_p).call(
92 [
93 (agent (i: INTEGER; g: STRING)
94 do
95 print ("got: " + i.out + ", " + g)
96 neutral ($MELT7)
97 end),
98 10, "92"])
99 io.new_line;
100 (agent {A [STRING]}.receive_p).call (
101 [
102 a,
103 (agent (i: INTEGER; g: STRING)
104 do
105 print ("got: " + i.out + ", " + g)
106 neutral ($MELT8)
107 end),
108 10, "92"])
109 end
110
111 gen_caller (t: TUPLE; p: PROCEDURE [ANY, TUPLE]) is
112 local
113 l_p: PROCEDURE [ANY, TUPLE]
114 do
115 neutral ($MELT9)
116 l_p := p
117 if l_p.valid_operands (t) then
118 p.call (t)
119 l_p.call (t)
120 end
121 end
122
123 gen_item (t: TUPLE; p: FUNCTION [ANY, TUPLE, STRING]): STRING is
124 local
125 l_f: FUNCTION [ANY, TUPLE, STRING]
126 do
127 neutral ($MELT10)
128 l_f := p
129 if l_f.valid_operands (t) then
130 p.call (t)
131 Result := p.item (t)
132 end
133 end
134
135 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23