/test/lib/storage/collection/test_ring_array1.e

http://github.com/tybor/Liberty · Specman e · 68 lines · 41 code · 6 blank · 21 comment · 0 complexity · 10c84a173d31ea58a9d7d1f2cea82788 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_RING_ARRAY1
  5. inherit
  6. ANY
  7. insert
  8. EIFFELTEST_TOOLS
  9. create {}
  10. make
  11. feature {}
  12. rai: RING_ARRAY[INTEGER]
  13. make
  14. local
  15. i: INTEGER
  16. do
  17. create rai.make(0, 2)
  18. assert(rai.count = 3)
  19. assert(rai.upper = 2)
  20. assert(rai.lower = 0)
  21. from
  22. i := rai.upper
  23. until
  24. i < 0
  25. loop
  26. assert(rai.item(i) = 0)
  27. rai.put(i, i)
  28. i := i - 1
  29. end
  30. from
  31. i := rai.upper
  32. until
  33. i < 0
  34. loop
  35. assert(rai.item(i) = i)
  36. i := i - 1
  37. end
  38. assert(rai.count = 3)
  39. rai.clear_count
  40. assert(rai.count = 0)
  41. rai.clear_count_and_capacity
  42. assert(rai.capacity = 0)
  43. end
  44. end -- class TEST_RING_ARRAY1
  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. -- ------------------------------------------------------------------------------------------------------------------------------