/test/lib/numeric/number/test_number105.e
Specman e | 84 lines | 49 code | 7 blank | 28 comment | 0 complexity | e6a70c0ab9e88f14b58e2b7f5a6be18d 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_NUMBER105 5 -- 6 -- Test of depassement of INTEGER_64_NUMBER capacity 7 -- during a multiplication between a INTEGER_64_NUMBER 8 -- and an integer which is symbolised by a large integer 9 -- Result is an integer which is symbolized by a 10 -- BIG_INTEGER_NUMBER 11 -- 12 13insert 14 EIFFELTEST_TOOLS 15 ANY 16 PLATFORM 17 18create {} 19 make 20 21feature {ANY} 22 make 23 local 24 n1, n2, m1, m2: NUMBER 25 do 26 n1 := nt.from_integer_64(Maximum_integer_64) @+ 1 27 assert(n1.is_integer_general_number) 28 assert(not n1.is_integer_64) 29 n2 := nt.from_integer_64(2) 30 m1 := n1 * n2 31 m2 := n2 * n1 32 assert(m1.is_integer_general_number) 33 assert(not m1.is_integer_64) 34 assert(m1.is_positive) 35 assert(m2.is_equal(m1)) 36 n2 := nt.from_integer_64(-2) 37 m1 := n1 * n2 38 m2 := n2 * n1 39 assert(m1.is_integer_general_number) 40 assert(not m1.is_integer_64) 41 assert(not m1.is_positive) 42 assert(m2.is_equal(m1)) 43 n1 := nt.from_integer_64(Minimum_integer_64) @- 1 44 assert(n1.is_integer_general_number) 45 assert(not n1.is_integer_64) 46 n2 := nt.from_integer_64(2) 47 m1 := n1 * n2 48 m2 := n2 * n1 49 assert(m1.is_integer_general_number) 50 assert(not m1.is_integer_64) 51 assert(not m1.is_positive) 52 assert(m2.is_equal(m1)) 53 n2 := nt.from_integer_64(-2) 54 m1 := n1 * n2 55 m2 := n2 * n1 56 assert(m1.is_integer_general_number) 57 assert(not m1.is_integer_64) 58 assert(m1.is_positive) 59 assert(m2.is_equal(m1)) 60 end 61 62 63 64 nt: NUMBER_TOOLS 65 66end -- class TEST_NUMBER105 67-- 68-- ------------------------------------------------------------------------------------------------------------------------------ 69-- Copyright notice below. Please read. 70-- 71-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, 72-- as published by the Free Software Foundation; either version 2, or (at your option) any later version. 73-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty 74-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have 75-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free 76-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 77-- 78-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE 79-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE 80-- 81-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN 82-- 83-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr 84-- ------------------------------------------------------------------------------------------------------------------------------