/test/lib/storage/dictionary/test_bijective_dictionary1.e

http://github.com/tybor/Liberty · 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. --
  4. class TEST_BIJECTIVE_DICTIONARY1
  5. insert
  6. EIFFELTEST_TOOLS
  7. create {}
  8. make
  9. feature {}
  10. test_with (bd: BIJECTIVE_DICTIONARY[STRING, STRING])
  11. local
  12. bd_twin: like bd
  13. do
  14. bd_twin := bd.twin
  15. assert(bd.at("k1").is_equal("v1"))
  16. assert(bd.at("k2").is_equal("v2"))
  17. assert(bd.at("k3").is_equal("v3"))
  18. assert(bd.at("k4").is_equal("v4"))
  19. assert(bd.at("k5").is_equal("v5"))
  20. assert(bd.internal_key("k1").is_equal("k1"))
  21. assert(bd.internal_key("k2").is_equal("k2"))
  22. assert(bd.internal_key("k3").is_equal("k3"))
  23. assert(bd.internal_key("k4").is_equal("k4"))
  24. assert(bd.internal_key("k5").is_equal("k5"))
  25. bd.put("v1", "k1")
  26. assert(bd.count = 5)
  27. bd.remove("k6")
  28. assert(bd.count = 5)
  29. bd.remove("k3")
  30. assert(bd.count = 4)
  31. assert(not bd.has("k3"))
  32. assert(not bd.has_value("v3"))
  33. bd.clear_count
  34. assert(bd.count = 0)
  35. assert(bd_twin.at("k1").is_equal("v1"))
  36. assert(bd_twin.at("k2").is_equal("v2"))
  37. assert(bd_twin.at("k3").is_equal("v3"))
  38. assert(bd_twin.at("k4").is_equal("v4"))
  39. assert(bd_twin.at("k5").is_equal("v5"))
  40. end
  41. make
  42. do
  43. test_with({HASHED_BIJECTIVE_DICTIONARY[STRING, STRING] << "v1", "k1";
  44. "v2", "k2";
  45. "v3", "k3";
  46. "v4", "k4";
  47. "v5", "k5" >> })
  48. end
  49. end -- class TEST_BIJECTIVE_DICTIONARY1
  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. -- ------------------------------------------------------------------------------------------------------------------------------