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

/test/language/gc/test_array1.e

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