/test/lib/storage/dictionary/test_dictionary6.e

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