/test/lib/numeric/mutable_big_integer/test_mutable_big_integer6.e
Specman e | 86 lines | 54 code | 8 blank | 24 comment | 1 complexity | 4e8690f3160920ed16bcbd029756b874 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_INTEGER6 5 -- 6 -- Testing `hash_code' and `copy'. 7 -- 8 9insert 10 ANY 11 PLATFORM 12 13create {} 14 make 15 16feature {} 17 dictionary1: HASHED_DICTIONARY[MUTABLE_BIG_INTEGER, INTEGER_64] 18 19 dictionary2: HASHED_DICTIONARY[INTEGER_64, MUTABLE_BIG_INTEGER] 20 21 make 22 local 23 mbi1, mbi2, mbi3: MUTABLE_BIG_INTEGER; v1, v2: INTEGER_64 24 do 25 create dictionary1.make 26 create dictionary2.make 27 v1 := Maximum_integer_64 28 create mbi1.from_integer_64(v1) 29 dictionary1.put(mbi1, v1) 30 dictionary2.put(v1, mbi1) 31 assert(dictionary1.reference_at(v1) = mbi1) 32 assert(dictionary2.at(mbi1) = v1) 33 v2 := Minimum_integer_64 34 create mbi2.from_integer_64(v2) 35 dictionary1.put(mbi2, v2) 36 dictionary2.put(v2, mbi2) 37 assert(dictionary1.reference_at(v1) = mbi1) 38 assert(dictionary2.at(mbi1) = v1) 39 assert(dictionary1.reference_at(v2) = mbi2) 40 assert(dictionary2.at(mbi2) = v2) 41 mbi3 := mbi1.twin 42 assert(mbi1.is_equal(mbi3)) 43 mbi3.from_integer(2) 44 assert(not mbi1.is_equal(mbi3)) 45 mbi1.from_integer(2) 46 assert(mbi1.is_equal(mbi3)) 47 mbi1.swap_with(mbi3) 48 assert(mbi1.is_equal(mbi3)) 49 mbi3.from_integer(6) 50 assert(not mbi1.is_equal(mbi3)) 51 mbi1.from_integer(6) 52 assert(mbi1.is_equal(mbi3)) 53 end 54 55 count: INTEGER 56 57 assert (b: BOOLEAN) 58 do 59 count := count + 1 60 if not b then 61 sedb_breakpoint 62 io.put_string("TEST_MUTABLE_BIG_INTEGER6 : ERROR Test # ") 63 io.put_integer(count) 64 io.put_string("%N") 65 end 66 end 67 68end -- class TEST_MUTABLE_BIG_INTEGER6 69-- 70-- ------------------------------------------------------------------------------------------------------------------------------ 71-- Copyright notice below. Please read. 72-- 73-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, 74-- as published by the Free Software Foundation; either version 2, or (at your option) any later version. 75-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty 76-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have 77-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free 78-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 79-- 80-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE 81-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE 82-- 83-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN 84-- 85-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr 86-- ------------------------------------------------------------------------------------------------------------------------------