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

Contents of /trunk/eweasel/tests/runtime002/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: 1155 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 TEST
2
3 create
4 make
5
6 feature {NONE} -- Initialization
7
8 make is
9 do
10 func := agent new_string
11 func2 := agent new_integer
12 trigger_gc (100)
13 func.call (Void)
14 trigger_gc (1)
15 if is_forwarded (func.last_result) then
16 print ("Failure: object is marked with B_FWD.%N")
17 end
18 func2.call (Void)
19 if func2.last_result /= 4 then
20 print ("Failure: value is not correct.%N")
21 end
22 end
23
24 func: FUNCTION [ANY, TUPLE, STRING]
25 func2: FUNCTION [ANY, TUPLE, INTEGER]
26
27 new_string: STRING is
28 do
29 create Result.make (10)
30 end
31
32 new_integer: INTEGER is
33 do
34 Result := 4
35 end
36
37
38 is_forwarded (a_string: STRING): BOOLEAN is
39 do
40 forwarded ($a_string, $Result)
41 end
42
43 forwarded (p: POINTER; b: TYPED_POINTER [BOOLEAN]) is
44 --
45 external
46 "C inline use %"eif_eiffel.h%""
47 alias
48 "[
49 #ifdef EIF_IL_DLL
50 *(EIF_BOOLEAN *) $b = EIF_FALSE;
51 #else
52 *(EIF_BOOLEAN *) $b = EIF_TEST(((union overhead *) $p -1)->ov_size & B_FWD);
53 #endif
54 ]"
55 end
56
57 trigger_gc (n: INTEGER) is
58 local
59 mem: MEMORY
60 i: INTEGER
61 do
62 create mem
63 from
64 i := 0
65 until
66 i = n
67 loop
68 mem.collect
69 i := i + 1
70 end
71 end
72
73 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23