PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/test/language/gc/test_embedded1.e

http://github.com/tybor/Liberty
Specman e | 90 lines | 55 code | 8 blank | 27 comment | 2 complexity | 2701042976182939f71869a5dbcc8953 MD5 | raw file
 1-- This file is part of SmartEiffel The GNU Eiffel Compiler Tools and Libraries.
 2-- See the Copyright notice at the end of this file.
 3--
 4class TEST_EMBEDDED1
 5   --
 6   -- Extra stuff for embedded system programming.
 7   --
 8
 9insert
10   MEMORY
11
12create {}
13   make
14
15feature {ANY}
16   make
17      local
18         ab, iloop: INTEGER; small_string: STRING
19      do
20         -- To run with the minimal amount of memory:
21         set_low_memory_strategy
22         --***     allocated_mem_display;
23         assert(collector_counter = 0)
24         collection_off
25         full_collect
26         assert(collector_counter = 0)
27         collection_on
28         full_collect
29         assert(collector_counter = 1)
30         ab := allocated_bytes
31         from
32            iloop := 50000
33         until
34            iloop <= 0
35         loop
36            small_string := "foo"
37            small_string := small_string.twin
38            iloop := iloop - 1
39            --***       allocated_mem_display;
40         end
41         assert(ab <= allocated_bytes)
42      end
43
44feature {}
45   allocated_bytes_memory: INTEGER
46
47   allocated_mem_display
48      do
49         if allocated_bytes_memory /= allocated_bytes then
50            allocated_bytes_memory := allocated_bytes
51            io.put_string("allocated_bytes = ")
52            io.put_integer(allocated_bytes_memory)
53            io.put_string("%N")
54         else
55            io.put_string(" --- %N")
56         end
57      end
58
59   assert (b: BOOLEAN)
60      do
61         cpt := cpt + 1
62         if not b then
63            sedb_breakpoint
64            std_output.put_string("TEST_EMBEDDED1: ERROR Test # ")
65            std_output.put_integer(cpt)
66            std_output.put_string("%N")
67         end
68      end
69
70   cpt: INTEGER
71
72end -- class TEST_EMBEDDED1
73--
74-- ------------------------------------------------------------------------------------------------------------------------------
75-- Copyright notice below. Please read.
76--
77-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
78-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
79-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
80-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
81-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
82-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
83--
84-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
85-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
86--
87-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
88--
89-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
90-- ------------------------------------------------------------------------------------------------------------------------------