/test/language/gc/test_string3.e

http://github.com/tybor/Liberty · Specman e · 70 lines · 41 code · 5 blank · 24 comment · 0 complexity · 84c4bf0314ff82cfc388a0afae0af06b 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_STRING3
  5. -- Test from Philippe Ribet
  6. -- GC fail on this program. A memory debugging tool may help (overflow).
  7. -- memset in rso_from_store does overflow.
  8. create {}
  9. make
  10. feature {}
  11. make
  12. local
  13. str: STRING
  14. do
  15. from
  16. create str.make(5)
  17. fill(str, 30000)
  18. until
  19. str.count > 70000
  20. loop
  21. fill(str, 100)
  22. str.remove_suffix(str.substring(str.count - 5, str.count))
  23. end
  24. end
  25. fill (s: STRING; size: INTEGER)
  26. require
  27. size > 0
  28. local
  29. i: INTEGER
  30. do
  31. from
  32. i := size
  33. until
  34. i <= 0
  35. loop
  36. rand.next
  37. s.add_last((rand.last_integer(25) + 65).to_character)
  38. i := i - 1
  39. end
  40. ensure
  41. s.count = old s.count + size
  42. end
  43. rand: MINIMAL_RANDOM_NUMBER_GENERATOR
  44. once
  45. create Result.with_seed(57)
  46. end
  47. end -- class TEST_STRING3
  48. --
  49. -- ------------------------------------------------------------------------------------------------------------------------------
  50. -- Copyright notice below. Please read.
  51. --
  52. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  53. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  54. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  55. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  56. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  57. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  58. --
  59. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  60. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  61. --
  62. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  63. --
  64. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  65. -- ------------------------------------------------------------------------------------------------------------------------------