/test/language/unclassified/test_is_equal.e

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