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

/test/language/gc/test_once1.e

http://github.com/tybor/Liberty
Specman e | 63 lines | 35 code | 7 blank | 21 comment | 1 complexity | 4d50088aeba08174ffffcc01e6df8a16 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_ONCE1
 5
 6create {}
 7   make
 8
 9create {TEST_ONCE1}
10   make2
11
12feature {ANY}
13   object: TEST_ONCE1
14      once
15         create Result.make2
16      end
17
18   access_count: INTEGER
19
20   make2
21      do
22         access_count := access_count + 1
23      end
24
25   make
26      local
27         i: INTEGER; o: like Current; old_access_count: INTEGER
28      do
29         from
30            i := 1000000
31            old_access_count := object.access_count
32         until
33            i = 0
34         loop
35            create o.make2
36            if object.access_count /= old_access_count then
37               std_output.put_string("TEST_ONCE1: ERROR Test #1%N")
38            end
39            o.object.make2
40            old_access_count := old_access_count + 1
41            i := i - 1
42         end
43      end
44
45end -- class TEST_ONCE1
46--
47-- ------------------------------------------------------------------------------------------------------------------------------
48-- Copyright notice below. Please read.
49--
50-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
51-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
52-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
53-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
54-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
55-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
56--
57-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
58-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
59--
60-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
61--
62-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
63-- ------------------------------------------------------------------------------------------------------------------------------