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