PageRenderTime 14ms CodeModel.GetById 12ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/test/lib/storage/collection/test_ring_array1.e

http://github.com/tybor/Liberty
Specman e | 68 lines | 41 code | 6 blank | 21 comment | 0 complexity | 10c84a173d31ea58a9d7d1f2cea82788 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_RING_ARRAY1
 5
 6inherit
 7   ANY
 8
 9insert
10   EIFFELTEST_TOOLS
11
12create {}
13   make
14
15feature {}
16   rai: RING_ARRAY[INTEGER]
17
18   make
19      local
20         i: INTEGER
21      do
22         create rai.make(0, 2)
23         assert(rai.count = 3)
24         assert(rai.upper = 2)
25         assert(rai.lower = 0)
26         from
27            i := rai.upper
28         until
29            i < 0
30         loop
31            assert(rai.item(i) = 0)
32            rai.put(i, i)
33            i := i - 1
34         end
35         from
36            i := rai.upper
37         until
38            i < 0
39         loop
40            assert(rai.item(i) = i)
41            i := i - 1
42         end
43         assert(rai.count = 3)
44         rai.clear_count
45         assert(rai.count = 0)
46         rai.clear_count_and_capacity
47         assert(rai.capacity = 0)
48      end
49
50end -- class TEST_RING_ARRAY1
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-- ------------------------------------------------------------------------------------------------------------------------------