PageRenderTime 18ms CodeModel.GetById 8ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/test/language/gc/test_native_array7.e

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