/test/lib/numeric/integer/test_integer_16.e

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