PageRenderTime 23ms CodeModel.GetById 18ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

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