/test/language/gc/test_native_array7.e

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