/test/language/instruction/assignment/test_assignment_test_and_force.e

http://github.com/tybor/Liberty · Specman e · 59 lines · 29 code · 8 blank · 22 comment · 0 complexity · 87a517e102ca25ef46b143215fdd38a0 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_ASSIGNMENT_TEST_AND_FORCE
  5. insert
  6. EIFFELTEST_TOOLS
  7. create {}
  8. make
  9. feature {ANY}
  10. string: STRING
  11. animal: ANIMAL
  12. cat: CAT
  13. any_string: ABSTRACT_STRING
  14. make
  15. do
  16. -- Because `any' is Void:
  17. assert({STRING} ?:= any_string)
  18. any_string := "foo"
  19. assert(any_string /= Void)
  20. assert(string ?:= any_string)
  21. string ::= any_string
  22. assert(any_string = string)
  23. create cat
  24. animal := cat
  25. assert(cat ?:= animal)
  26. cat ::= animal
  27. assert(cat = animal)
  28. animal := Void
  29. assert(cat ?:= animal)
  30. cat ::= animal
  31. assert(cat = Void)
  32. end
  33. end -- class TEST_ASSIGNMENT_TEST_AND_FORCE
  34. --
  35. -- ------------------------------------------------------------------------------------------------------------------------------
  36. -- Copyright notice below. Please read.
  37. --
  38. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  39. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  40. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  41. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  42. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  43. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  44. --
  45. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  46. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  47. --
  48. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  49. --
  50. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  51. -- ------------------------------------------------------------------------------------------------------------------------------