PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/test/lib/storage/collection/test_set_all_with1.e

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