/test/language/gc/test_native_array6.e

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