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

/test/language/gc/test_native_array4.e

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