/test/lib/numeric/mutable_big_integer/test_mutable_big_integer21.e
Specman e | 70 lines | 40 code | 8 blank | 22 comment | 0 complexity | 6523e9cb4ecd6ae0e056c390dc0e8e4a 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_MUTABLE_BIG_INTEGER21 5 -- Test of `is_integer', `is_integer_64',`to_integer_32' and `to_integer_64'. 6 7insert 8 AUX_MUTABLE_BIG_INTEGER1 9 10create {} 11 make 12 13feature {ANY} 14 make 15 local 16 i: INTEGER 17 do 18 from 19 i := numbers1.lower 20 until 21 i > numbers1.upper 22 loop 23 assert(numbers1.item(i).is_integer_32 = res_is_int.item(i)) 24 assert(numbers1.item(i).is_integer_32 implies numbers1.item(i).to_integer_32 = res_to_int.item(i)) 25 assert(numbers1.item(i).is_integer_64 = res_is_int_64.item(i)) 26 assert(numbers1.item(i).is_integer_64 implies numbers1.item(i).to_integer_64 = res_to_int_64.item(i)) 27 i := i + 1 28 end 29 verify(numbers1) 30 end 31 32 res_is_int: FAST_ARRAY[BOOLEAN] 33 once 34 Result := {FAST_ARRAY[BOOLEAN] << True, True, True, True, True, True, True, True, True, True, True, True, True, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False >> } 35 end 36 37 res_is_int_64: FAST_ARRAY[BOOLEAN] 38 once 39 Result := {FAST_ARRAY[BOOLEAN] << True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, False, True, True, True, False, False, False, False, False, False, False, False >> } 40 end 41 42 res_to_int: FAST_ARRAY[INTEGER] 43 once 44 Result := {FAST_ARRAY[INTEGER] << 0, 1, -1, 2, -2, 3, -3, 1000, -1000, 1000000000, -1000000000, Maximum_integer, -Maximum_integer, 0, Minimum_integer, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 >> } 45 end 46 47 res_to_int_64: FAST_ARRAY[INTEGER_64] 48 once 49 Result := {FAST_ARRAY[INTEGER_64] << 0, 1, -1, 2, -2, 3, -3, 1000, -1000, 1000000000, -1000000000, Maximum_integer, -Maximum_integer, -Minimum_integer.to_integer_64, Minimum_integer, Maximum_integer_64, -Maximum_integer_64, 0, Minimum_integer_64, 1000000000000000000, -1000000000000000000, 0, 0, 0, 0, 0, 0, 0 >> } 50 end 51 52end -- class TEST_MUTABLE_BIG_INTEGER21 53-- 54-- ------------------------------------------------------------------------------------------------------------------------------ 55-- Copyright notice below. Please read. 56-- 57-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, 58-- as published by the Free Software Foundation; either version 2, or (at your option) any later version. 59-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty 60-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have 61-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free 62-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 63-- 64-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE 65-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE 66-- 67-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN 68-- 69-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr 70-- ------------------------------------------------------------------------------------------------------------------------------