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

/test/lib/numeric/real/test_is_infinity.e

http://github.com/tybor/Liberty
Specman e | 77 lines | 46 code | 7 blank | 24 comment | 0 complexity | b0ace7e2d1a118d1f65c03b13c75a0da 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_IS_INFINITY
 5   --
 6   -- Of REAL_GENERAL.
 7   --
 8
 9insert
10   EIFFELTEST_TOOLS
11
12create {}
13   make
14
15feature {ANY}
16   make
17      local
18         real_32: REAL_32; real_64: REAL_64; real_extended: REAL_EXTENDED
19      do
20         assert(not real_64.is_infinity)
21         real_64 := unchecked_c_divide_64(1.0, 0.0)
22         assert(real_64.is_infinity)
23         assert(real_64 > 0)
24         real_64 := unchecked_c_divide_64(-1.0, 0.0)
25         assert(real_64.is_infinity)
26         assert(real_64 < 0)
27         assert(not real_32.is_infinity)
28         real_32 := unchecked_c_divide_32({REAL_32 1.0}, {REAL_32 0.0})
29         assert(real_32.is_infinity)
30         assert(real_32 > 0)
31         real_32 := unchecked_c_divide_32(-{REAL_32 1.0}, {REAL_32 0.0})
32         assert(real_32.is_infinity)
33         assert(real_32 < 0)
34         assert(not real_extended.is_infinity)
35         real_extended := unchecked_c_divide_ext({REAL_EXTENDED 1.0}, {REAL_EXTENDED 0.0})
36         assert(real_extended.is_infinity)
37         assert(real_extended > 0)
38         real_extended := unchecked_c_divide_ext(-{REAL_EXTENDED 1.0}, {REAL_EXTENDED 0.0})
39         assert(real_extended.is_infinity)
40         assert(real_extended < 0)
41      end
42
43feature {}
44   unchecked_c_divide_64(x, y: REAL_64): REAL_64
45      external "C inline"
46      alias "(($x) / ($y))"
47      end
48   
49   unchecked_c_divide_32(x, y: REAL_32): REAL_32
50      external "C inline"
51      alias "(($x) / ($y))"
52      end
53
54   unchecked_c_divide_ext(x, y: REAL_EXTENDED): REAL_EXTENDED
55      external "C inline"
56      alias "(($x) / ($y))"
57      end
58   
59end -- class TEST_IS_INFINITY
60--
61-- ------------------------------------------------------------------------------------------------------------------------------
62-- Copyright notice below. Please read.
63--
64-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
65-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
66-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
67-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
68-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
69-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
70--
71-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
72-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
73--
74-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
75--
76-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
77-- ------------------------------------------------------------------------------------------------------------------------------