/test/lib/numeric/mutable_big_integer/test_mutable_big_integer21.e

http://github.com/tybor/Liberty · Specman e · 70 lines · 40 code · 8 blank · 22 comment · 0 complexity · 6523e9cb4ecd6ae0e056c390dc0e8e4a 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_MUTABLE_BIG_INTEGER21
  5. -- Test of `is_integer', `is_integer_64',`to_integer_32' and `to_integer_64'.
  6. insert
  7. AUX_MUTABLE_BIG_INTEGER1
  8. create {}
  9. make
  10. feature {ANY}
  11. make
  12. local
  13. i: INTEGER
  14. do
  15. from
  16. i := numbers1.lower
  17. until
  18. i > numbers1.upper
  19. loop
  20. assert(numbers1.item(i).is_integer_32 = res_is_int.item(i))
  21. assert(numbers1.item(i).is_integer_32 implies numbers1.item(i).to_integer_32 = res_to_int.item(i))
  22. assert(numbers1.item(i).is_integer_64 = res_is_int_64.item(i))
  23. assert(numbers1.item(i).is_integer_64 implies numbers1.item(i).to_integer_64 = res_to_int_64.item(i))
  24. i := i + 1
  25. end
  26. verify(numbers1)
  27. end
  28. res_is_int: FAST_ARRAY[BOOLEAN]
  29. once
  30. Result := {FAST_ARRAY[BOOLEAN] << True, True, True, True, True, True, True, True, True, True, True, True, True, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False >> }
  31. end
  32. res_is_int_64: FAST_ARRAY[BOOLEAN]
  33. once
  34. Result := {FAST_ARRAY[BOOLEAN] << True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, False, True, True, True, False, False, False, False, False, False, False, False >> }
  35. end
  36. res_to_int: FAST_ARRAY[INTEGER]
  37. once
  38. Result := {FAST_ARRAY[INTEGER] << 0, 1, -1, 2, -2, 3, -3, 1000, -1000, 1000000000, -1000000000, Maximum_integer, -Maximum_integer, 0, Minimum_integer, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 >> }
  39. end
  40. res_to_int_64: FAST_ARRAY[INTEGER_64]
  41. once
  42. Result := {FAST_ARRAY[INTEGER_64] << 0, 1, -1, 2, -2, 3, -3, 1000, -1000, 1000000000, -1000000000, Maximum_integer, -Maximum_integer, -Minimum_integer.to_integer_64, Minimum_integer, Maximum_integer_64, -Maximum_integer_64, 0, Minimum_integer_64, 1000000000000000000, -1000000000000000000, 0, 0, 0, 0, 0, 0, 0 >> }
  43. end
  44. end -- class TEST_MUTABLE_BIG_INTEGER21
  45. --
  46. -- ------------------------------------------------------------------------------------------------------------------------------
  47. -- Copyright notice below. Please read.
  48. --
  49. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  50. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  51. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  52. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  53. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  54. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  55. --
  56. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  57. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  58. --
  59. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  60. --
  61. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  62. -- ------------------------------------------------------------------------------------------------------------------------------