PageRenderTime 13ms CodeModel.GetById 6ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/test/language/unclassified/test_inherit1.e

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