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

/test/lib/numeric/number/test_number12.e

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