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