/test/lib/numeric/integer/test_integer5.e

http://github.com/tybor/Liberty · Specman e · 78 lines · 51 code · 5 blank · 22 comment · 1 complexity · a3fb72c770bf590d814ee6d815395bd2 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_INTEGER5
  5. create {}
  6. make
  7. feature {ANY}
  8. make
  9. local
  10. a32, b32: INTEGER_32; a64, b64: INTEGER_64
  11. do
  12. a32 := 0xFFFFF000
  13. b32 := a32.bit_shift_left(4)
  14. assert(b32 = 0xFFFF0000)
  15. a32 := 0xFFFFF000
  16. b32 := a32.bit_shift_left(8)
  17. assert(b32 = 0xFFF00000)
  18. a32 := 0xFFFFF000
  19. b32 := a32.bit_shift_left(12)
  20. assert(b32 = 0xFF000000)
  21. a32 := 0xFFFFF000
  22. b32 := a32.bit_shift_left(16)
  23. assert(b32 = 0xF0000000)
  24. a64 := 0xFFFFF000FFFFF000
  25. b64 := a64.bit_shift_left(4)
  26. assert(b64 = 0xFFFF000FFFFF0000)
  27. a64 := 0xFFFFF000FFFFF000
  28. b64 := a64.bit_shift_left(8)
  29. assert(b64 = 0xFFF000FFFFF00000)
  30. a64 := 0xFFFFF000FFFFF000
  31. b64 := a64.bit_shift_left(12)
  32. assert(b64 = 0xFF000FFFFF000000)
  33. a64 := 0xFFFFF000FFFFF000
  34. b64 := a64.bit_shift_left(16)
  35. assert(b64 = 0xF000FFFFF0000000)
  36. a64 := 0xFFFFF000FFFFF000
  37. b64 := a64.bit_shift_left(24)
  38. assert(b64 = 0x00FFFFF000000000)
  39. a64 := 0xFFFFF000FFFFF000
  40. b64 := a64.bit_shift_left(32)
  41. assert(b64 = 0xFFFFF00000000000)
  42. -- -----------------------------------------------------
  43. end
  44. assert (b: BOOLEAN)
  45. do
  46. cpt := cpt + 1
  47. if not b then
  48. sedb_breakpoint
  49. std_output.put_string("TEST_INTEGER5: ERROR Test # ")
  50. std_output.put_integer(cpt)
  51. std_output.put_string("%N")
  52. end
  53. end
  54. cpt: INTEGER
  55. end -- class TEST_INTEGER5
  56. --
  57. -- ------------------------------------------------------------------------------------------------------------------------------
  58. -- Copyright notice below. Please read.
  59. --
  60. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  61. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  62. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  63. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  64. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  65. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  66. --
  67. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  68. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  69. --
  70. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  71. --
  72. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  73. -- ------------------------------------------------------------------------------------------------------------------------------