/test/lib/storage/collection/test_is_equal_map.e

http://github.com/tybor/Liberty · Specman e · 66 lines · 40 code · 5 blank · 21 comment · 1 complexity · 2ac0aa8f703f265182b9617c4df01814 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_IS_EQUAL_MAP
  5. create {}
  6. make
  7. feature {ANY}
  8. make
  9. local
  10. c1, c2: COLLECTION[STRING]; d1, d2: HASHED_DICTIONARY[STRING, INTEGER]
  11. do
  12. create d1.make
  13. create d2.make
  14. d1.put("foo", 1)
  15. assert(not d1.is_equal(d2)) -- may also be written like "not d1~d2"
  16. d2.put("foo", 1)
  17. assert(d1~d2)
  18. c1 := {FAST_ARRAY[STRING] << "foo", "bar" >> }
  19. c2 := {FAST_ARRAY[STRING] << "foo", "bar" >> }
  20. assert(c1~c2)
  21. create {FAST_ARRAY[STRING]} c1.from_collection(c1)
  22. create {FAST_ARRAY[STRING]} c2.from_collection(c2)
  23. assert(c1~c2)
  24. create {LINKED_LIST[STRING]} c1.from_collection(c1)
  25. create {LINKED_LIST[STRING]} c2.from_collection(c2)
  26. assert(c1~c2)
  27. create {TWO_WAY_LINKED_LIST[STRING]} c1.from_collection(c1)
  28. create {TWO_WAY_LINKED_LIST[STRING]} c2.from_collection(c2)
  29. assert(c1~c2)
  30. end
  31. feature {}
  32. assert (bool: BOOLEAN)
  33. do
  34. cpt := cpt + 1
  35. if not bool then
  36. std_output.put_string("TEST_IS_EQUAL_MAP: ERROR Test # ")
  37. std_output.put_integer(cpt)
  38. std_output.put_string("%N")
  39. crash
  40. end
  41. end
  42. cpt: INTEGER
  43. end -- class TEST_IS_EQUAL_MAP
  44. --
  45. -- ------------------------------------------------------------------------------------------------------------------------------
  46. -- Copyright notice below. Please read.
  47. --
  48. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  49. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  50. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  51. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  52. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  53. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  54. --
  55. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  56. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  57. --
  58. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  59. --
  60. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  61. -- ------------------------------------------------------------------------------------------------------------------------------