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