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