/test/lib/numeric/real/test_double6.e
Specman e | 105 lines | 75 code | 6 blank | 24 comment | 5 complexity | 04b7aa3a4da609aacded612c70109cef 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_DOUBLE6 5 -- 6 -- To test sprintf_double Java compatibility. 7 -- 8 9insert 10 ANY 11 PLATFORM 12 13create {} 14 make 15 16feature {ANY} 17 make 18 local 19 pi: REAL_64; s: STRING 20 do 21 if Minimum_real_32 < 0.0 then 22 assert(True) 23 else 24 assert(False) 25 end 26 if Minimum_real_64 < 0.0 then 27 assert(True) 28 else 29 assert(False) 30 end 31 if Maximum_real_32 < 0.0 then 32 assert(False) 33 else 34 assert(True) 35 end 36 if Maximum_real_64 < 0.0 then 37 assert(False) 38 else 39 assert(True) 40 end 41 pi := 3.14157 42 s := pi.to_string_format(2) 43 assert(("3.14").is_equal(s)) 44 s := pi.to_string_format(1) 45 assert(("3.1").is_equal(s)) 46 s := pi.to_string_format(0) 47 assert(("3").is_equal(s)) 48 s := Maximum_real_32.to_string_format(3) 49 assert(s.item(s.count - 3) = '.') 50 s := Maximum_real_32.to_string_format(1) 51 assert(s.item(s.count - 1) = '.') 52 s := Maximum_real_32.to_string_format(0) 53 assert(s.item(s.count) /= '.') 54 s := Minimum_real_32.to_string_format(3) 55 assert(s.item(s.count - 3) = '.') 56 s := Minimum_real_32.to_string_format(1) 57 assert(s.item(s.count - 1) = '.') 58 s := Minimum_real_32.to_string_format(0) 59 assert(s.item(s.count) /= '.') 60 s := Maximum_real_64.to_string_format(3) 61 assert(s.item(s.count - 3) = '.') 62 s := Maximum_real_64.to_string_format(1) 63 assert(s.item(s.count - 1) = '.') 64 s := Maximum_real_64.to_string_format(0) 65 assert(s.item(s.count) /= '.') 66 s := Minimum_real_64.to_string_format(3) 67 assert(s.item(s.count - 3) = '.') 68 s := Minimum_real_64.to_string_format(1) 69 assert(s.item(s.count - 1) = '.') 70 s := Minimum_real_64.to_string_format(0) 71 assert(s.item(s.count) /= '.') 72 end 73 74 assert (b: BOOLEAN) 75 do 76 cpt := cpt + 1 77 if not b then 78 std_output.put_string("TEST_DOUBLE6: ERROR Test # ") 79 std_output.put_integer(cpt) 80 std_output.put_string("%N") 81 crash 82 end 83 end 84 85 cpt: INTEGER 86 87end -- class TEST_DOUBLE6 88-- 89-- ------------------------------------------------------------------------------------------------------------------------------ 90-- Copyright notice below. Please read. 91-- 92-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, 93-- as published by the Free Software Foundation; either version 2, or (at your option) any later version. 94-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty 95-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have 96-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free 97-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 98-- 99-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE 100-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE 101-- 102-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN 103-- 104-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr 105-- ------------------------------------------------------------------------------------------------------------------------------