PageRenderTime 22ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/test/language/gc/test_native_array5.e

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