/test/lib/numeric/number/test_number104.e

http://github.com/tybor/Liberty · Specman e · 89 lines · 55 code · 7 blank · 27 comment · 0 complexity · 3b968975f8fda6dab4b681b31f5bf200 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_NUMBER104
  5. --
  6. -- Test of depassement of INTEGER_64_NUMBER capacity
  7. -- during a multiplication between 2 INTEGER_64_NUMBER
  8. -- Result is an integer which is symbolized by a
  9. -- BIG_INTEGER_NUMBER
  10. --
  11. insert
  12. EIFFELTEST_TOOLS
  13. ANY
  14. PLATFORM
  15. create {}
  16. make
  17. feature {ANY}
  18. make
  19. local
  20. n: NUMBER
  21. do
  22. n := nt.from_integer_64(Maximum_integer_64)
  23. n := n * nt.from_integer_64(2)
  24. assert(n.is_integer_general_number)
  25. assert(not n.is_integer_64)
  26. assert(n.is_positive)
  27. n := nt.from_integer_64(2)
  28. n := n * nt.from_integer_64(Maximum_integer_64)
  29. assert(n.is_integer_general_number)
  30. assert(not n.is_integer_64)
  31. assert(n.is_positive)
  32. n := nt.from_integer_64(Maximum_integer_64)
  33. n := n * nt.from_integer_64(-2)
  34. assert(n.is_integer_general_number)
  35. assert(not n.is_integer_64)
  36. assert(not n.is_positive)
  37. n := nt.from_integer_64(-2)
  38. n := n * nt.from_integer_64(Maximum_integer_64)
  39. assert(n.is_integer_general_number)
  40. assert(not n.is_integer_64)
  41. assert(not n.is_positive)
  42. n := nt.from_integer_64(Minimum_integer_64)
  43. n := n * nt.from_integer_64(2)
  44. assert(n.is_integer_general_number)
  45. assert(not n.is_integer_64)
  46. assert(not n.is_positive)
  47. n := nt.from_integer_64(2)
  48. n := n * nt.from_integer_64(Minimum_integer_64)
  49. assert(n.is_integer_general_number)
  50. assert(not n.is_integer_64)
  51. assert(not n.is_positive)
  52. n := nt.from_integer_64(Minimum_integer_64)
  53. n := n * nt.from_integer_64(-2)
  54. assert(n.is_integer_general_number)
  55. assert(not n.is_integer_64)
  56. assert(n.is_positive)
  57. n := nt.from_integer_64(-2)
  58. n := n * nt.from_integer_64(Minimum_integer_64)
  59. assert(n.is_integer_general_number)
  60. assert(not n.is_integer_64)
  61. assert(n.is_positive)
  62. end
  63. nt: NUMBER_TOOLS
  64. end -- class TEST_NUMBER104
  65. --
  66. -- ------------------------------------------------------------------------------------------------------------------------------
  67. -- Copyright notice below. Please read.
  68. --
  69. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  70. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  71. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  72. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  73. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  74. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  75. --
  76. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  77. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  78. --
  79. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  80. --
  81. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  82. -- ------------------------------------------------------------------------------------------------------------------------------