PageRenderTime 29ms CodeModel.GetById 22ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/test/language/gc/test_native_array6.e

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