/test/lib/numeric/real/test_real_constant04.e

http://github.com/tybor/Liberty · Specman e · 65 lines · 39 code · 4 blank · 22 comment · 0 complexity · 11ba6d2f8b6193032478a054c2cdbdba 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. --
  4. class TEST_REAL_CONSTANT04
  5. -- Test the normalisation in {REAL_CONSTANT}.make
  6. inherit
  7. EIFFELTEST_TOOLS
  8. create {}
  9. make
  10. feature {ANY}
  11. make
  12. local
  13. ref: REAL
  14. do
  15. ref := 0.1
  16. assert(ref = 1e-1)
  17. assert(ref = 0.1)
  18. assert(ref = 1.0e-1)
  19. ref := 21.0
  20. assert(ref = 210000000000e-10)
  21. assert(ref = 21000000000E-9)
  22. assert(ref = 2100000000e-8)
  23. assert(ref = 210000000E-7)
  24. assert(ref = 21000000e-6)
  25. assert(ref = 2100000E-5)
  26. assert(ref = 210000e-4)
  27. assert(ref = 21000E-3)
  28. assert(ref = 2100e-2)
  29. assert(ref = 210E-01)
  30. assert(ref = 21)
  31. assert(ref = 21e0)
  32. assert(ref = 2.1E1)
  33. assert(ref = 0.21e2)
  34. assert(ref = 0.021E3)
  35. assert(ref = 0.0021e4)
  36. assert(ref = 0.00021E5)
  37. assert(ref = 0.000021e6)
  38. assert(ref = 0.0000021E7)
  39. assert(ref = 0.00000021e8)
  40. assert(ref = 0.000000021E9)
  41. assert(ref = 0.0000000021E10)
  42. end
  43. end -- class TEST_REAL_CONSTANT04
  44. --
  45. -- ------------------------------------------------------------------------------------------------------------------------------
  46. -- Copyright notice below. Please read.
  47. --
  48. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  49. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  50. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  51. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  52. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  53. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  54. --
  55. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  56. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  57. --
  58. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  59. --
  60. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  61. -- ------------------------------------------------------------------------------------------------------------------------------