/test/language/gc/test_array1.e

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