PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/test/language/instruction/create/test_create01.e

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