PageRenderTime 25ms CodeModel.GetById 19ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/test/lib/storage/dictionary/test_hash_code2.e

http://github.com/tybor/Liberty
Specman e | 67 lines | 41 code | 5 blank | 21 comment | 0 complexity | 40569be6e0f799d1f018e6835c30e90b 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_HASH_CODE2
 5
 6insert
 7   EIFFELTEST_TOOLS
 8
 9create {}
10   make
11
12feature {ANY}
13   make
14      local
15         d: DICTIONARY[INTEGER, CHARACTER]
16      do
17         create {HASHED_DICTIONARY[INTEGER, CHARACTER]} d.make
18         assert(not d.has('b'))
19         d.put(6, 'b')
20         assert(d.has('b'))
21         assert(d.at('b') = 6)
22         for_time
23      end
24
25   for_time
26      local
27         d: DICTIONARY[INTEGER, TIME]; t1, t2: TIME
28      do
29         create {HASHED_DICTIONARY[INTEGER, TIME]} d.make
30         t1.update
31         assert(not d.has(t1))
32         d.put(1, t1)
33         assert(d.has(t1))
34         assert(d.at(t1) = 1)
35         from
36            t2.update
37         until
38            t1.second /= t2.second
39         loop
40            t2.update
41         end
42         assert(not d.has(t2))
43         d.put(2, t2)
44         assert(d.has(t2))
45         assert(d.at(t2) = 2)
46         assert(d.at(t1) = 1)
47      end
48
49end -- class TEST_HASH_CODE2
50--
51-- ------------------------------------------------------------------------------------------------------------------------------
52-- Copyright notice below. Please read.
53--
54-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
55-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
56-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
57-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
58-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
59-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
60--
61-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
62-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
63--
64-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
65--
66-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
67-- ------------------------------------------------------------------------------------------------------------------------------