/test/language/agent/test_agent32.e

http://github.com/tybor/Liberty · Specman e · 61 lines · 30 code · 8 blank · 23 comment · 0 complexity · 8b3c10f8629d54678e04b67254967e4e 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_AGENT32
  5. inherit
  6. EIFFELTEST_TOOLS
  7. --SZ:114: the compiler gets confused. It consider bar return
  8. --type being the return type of foo!
  9. create {}
  10. make
  11. feature {ANY}
  12. make
  13. local
  14. b: BOOLEAN; i: INTEGER
  15. do
  16. bar := agent is_greater_than_5(?)
  17. b := bar.item([{INTEGER_32 6}])
  18. assert(b)
  19. foo := Void
  20. assert(foo = Void)
  21. foo := agent five
  22. i := foo.item([])
  23. assert(i = 5)
  24. end
  25. is_greater_than_5 (i: INTEGER): BOOLEAN
  26. do
  27. Result := i > 5
  28. end
  29. bar: PREDICATE[TUPLE[INTEGER]]
  30. five: INTEGER
  31. do
  32. Result := 5
  33. end
  34. foo: FUNCTION[TUPLE, INTEGER]
  35. end -- class TEST_AGENT32
  36. --
  37. -- ------------------------------------------------------------------------------------------------------------------------------
  38. -- Copyright notice below. Please read.
  39. --
  40. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  41. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  42. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  43. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  44. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  45. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  46. --
  47. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  48. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  49. --
  50. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  51. --
  52. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  53. -- ------------------------------------------------------------------------------------------------------------------------------