PageRenderTime 12ms CodeModel.GetById 9ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/test/lib/numeric/mutable_big_integer/test_mutable_big_integer11.e

http://github.com/tybor/Liberty
Specman e | 76 lines | 46 code | 6 blank | 24 comment | 1 complexity | 587eb31cad863dedb3dca67479e3ada8 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_INTEGER11
 5   --
 6   -- Testing feature `add' when magnitude must grow up.
 7   --
 8
 9insert
10   ANY
11   PLATFORM
12
13create {}
14   make
15
16feature {ANY}
17   make
18      local
19         mbia, mbib, mbir, mbiq: MUTABLE_BIG_INTEGER; i: INTEGER_64
20      do
21         create mbia.from_integer_64(Maximum_integer_64)
22         create mbib.from_integer_64(Maximum_integer_64)
23         create mbiq.from_integer(13)
24         create mbir.from_integer(12)
25         from
26            i := 0
27         until
28            i = 100
29         loop
30            mbia.add(mbia)
31            i := i + 1
32         end
33         mbib.shift_left(100)
34         assert(mbia.is_equal(mbib))
35         mbia.divide_to(mbia, mbiq, mbir)
36         assert(mbiq.is_one)
37         assert(mbir.is_zero)
38         mbia.multiply_to(mbib, mbir)
39         assert(mbia.is_equal(mbib))
40         mbir.divide_to(mbia, mbiq, mbib)
41         assert(mbia.is_equal(mbiq))
42         assert(mbib.is_zero)
43      end
44
45   count: INTEGER
46
47   assert (b: BOOLEAN)
48      do
49         count := count + 1
50         if not b then
51            sedb_breakpoint
52            io.put_string("TEST_MUTABLE_BIG_INTEGER11 : ERROR Test # ")
53            io.put_integer(count)
54            io.put_string("%N")
55         end
56      end
57
58end -- class TEST_MUTABLE_BIG_INTEGER11
59--
60-- ------------------------------------------------------------------------------------------------------------------------------
61-- Copyright notice below. Please read.
62--
63-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
64-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
65-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
66-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
67-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
68-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
69--
70-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
71-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
72--
73-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
74--
75-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
76-- ------------------------------------------------------------------------------------------------------------------------------