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

/test/lib/numeric/real/test_is_not_a_number.e

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