/test/lib/storage/collection/test_resize2.e

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