PageRenderTime 15ms CodeModel.GetById 10ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/test/lib/storage/collection/test_fast_array6.e

http://github.com/tybor/Liberty
Specman e | 50 lines | 40 code | 8 blank | 2 comment | 0 complexity | dba695ab14b8bf01e5e421436832cb5e MD5 | raw file
 1class TEST_FAST_ARRAY6
 2-- From: dubois.georges@numericable.fr
 3   
 4insert
 5   EIFFELTEST_TOOLS
 6   
 7create {}
 8   main
 9   
10feature {ANY}
11   a: FAST_ARRAY[INTEGER]
12   
13   j: INTEGER
14   
15   main
16      local
17         i: INTEGER
18      do
19         create a.with_capacity(6)
20         from
21            i := 0
22         until
23            i > 5
24         loop
25            a.add_last(i)
26            i := i + 1
27         end
28         j := 2
29         from
30            i := 0
31         until
32            i >  2
33         loop
34            assert(item1(i) = item2(i))
35            i := i + 1
36         end
37      end
38   
39   item1(i: INTEGER): INTEGER
40      do
41         Result := a.item(1 + (i*j))
42      end
43   
44   item2(i: INTEGER): INTEGER
45         -- same as item1 
46      do
47         Result := a.item((i*j) + 1)
48      end
49   
50end