PageRenderTime 17ms CodeModel.GetById 14ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/test/language/unclassified/test_once4.e

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