PageRenderTime 22ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/test/lib/numeric/number/test_number107.e

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