PageRenderTime 31ms CodeModel.GetById 26ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/test/lib/storage/collection/test_remove_last1.e

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