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

/test/lib/numeric/real/test_double1.e

http://github.com/tybor/Liberty
Specman e | 71 lines | 44 code | 5 blank | 22 comment | 1 complexity | d53b6a397b7f3558113cd162ae95d713 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_DOUBLE1
 5
 6create {}
 7   make
 8
 9feature {ANY}
10   make
11      local
12         i: INTEGER; d, d2: REAL_64
13      do
14         d := 1.6
15         assert(d = d)
16         assert(d >= 1.59)
17         assert(d <= 1.61)
18         d := 2
19         assert(d = 2.0)
20         i := 2
21         d := i
22         assert(d = 2)
23         assert(d = 2.0)
24         d := 1.51.to_string.to_real
25         assert(d < 1.511)
26         assert(d > 1.509)
27         d := (-1.51).to_string.to_real
28         assert(d > -1.52)
29         assert(d < -1.50)
30         assert(d.abs < 1.52)
31         assert(d.abs > 1.50)
32         assert((-d).abs < 1.52)
33         assert((-d).abs > 1.50)
34         d := 4.0
35         d2 := 2.0
36         assert(d.sqrt = d2)
37      end
38
39   assert (b: BOOLEAN)
40      do
41         cpt := cpt + 1
42         if not b then
43            std_output.put_string("TEST_DOUBLE1: ERROR Test # ")
44            std_output.put_integer(cpt)
45            std_output.put_string("%N")
46         else
47            -- std_output.put_string("Yes%N");
48         end
49      end
50
51   cpt: INTEGER
52
53end -- class TEST_DOUBLE1
54--
55-- ------------------------------------------------------------------------------------------------------------------------------
56-- Copyright notice below. Please read.
57--
58-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
59-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
60-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
61-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
62-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
63-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
64--
65-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
66-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
67--
68-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
69--
70-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
71-- ------------------------------------------------------------------------------------------------------------------------------