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