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

/test/lib/numeric/number/test_number31.e

http://github.com/tybor/Liberty
Specman e | 83 lines | 55 code | 6 blank | 22 comment | 0 complexity | 69f9db1bb5f9487b2ab236baa02e3900 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_NUMBER31
 5   -- tests on infix "-"
 6
 7insert
 8   EIFFELTEST_TOOLS
 9   PLATFORM
10   NUMBER_TOOLS
11
12create {}
13   make
14
15feature {ANY}
16   make
17      local
18         n1, n2, n3: NUMBER
19      do
20         n1 := from_integer(0)
21         n2 := from_integer(0)
22         n3 := from_integer(0)
23         assert(n1.is_equal(n2 - n3))
24         n2 := from_integer(1)
25         n3 := from_integer(1)
26         assert(n1.is_equal(n2 - n3))
27         n3 := from_integer(-1)
28         assert(n3.is_equal(n1 - n2))
29         n1 := from_integer(Maximum_integer)
30         n1 := n1 @+ 1000
31         n2 := from_integer(Maximum_integer)
32         n3 := from_integer(1000)
33         assert(n2.is_equal(n1 - n3))
34         n2 := n2 @+ Maximum_integer @+ 2000
35         n3 := from_integer(Maximum_integer)
36         n3 := n3 @+ 1000
37         assert(n3.is_equal(n2 - n3))
38         n1 := from_integer(0)
39         n2 := from_integer(Maximum_integer)
40         n2 := n2 @+ 1000
41         assert(n2.is_equal(n3 - n1))
42         n1 := from_integer(Minimum_integer)
43         n1 := n1 @- 1000
44         n2 := from_integer(Minimum_integer)
45         n2 := n2 @- 2000
46         n3 := from_integer(1000)
47         assert(n2.is_equal(n1 - n3))
48         n1 := from_string("2/5")
49         n2 := from_string("7/5")
50         n3 := from_integer(1)
51         assert(n3.is_equal(n2 - n1))
52         n2 := from_string("-3/5")
53         n3 := from_string("-10/10")
54         assert(n1.is_equal(n2 - n3))
55         n1 := from_integer(Maximum_integer)
56         n1 := n1 @+ 1000
57         n2 := from_integer(Maximum_integer)
58         n2 := n2 @+ 1001
59         n3 := from_string("105/105")
60         assert(n1.is_equal(n2 - n3))
61      end
62
63
64
65end -- class TEST_NUMBER31
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-- ------------------------------------------------------------------------------------------------------------------------------