/test/language/assertion/test_attribute01.e

http://github.com/tybor/Liberty · Specman e · 72 lines · 42 code · 9 blank · 21 comment · 2 complexity · 2c17743635794c4a4ecb2c4a6eb2dda2 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_ATTRIBUTE01
  5. insert
  6. EIFFELTEST_TOOLS
  7. create {}
  8. main
  9. feature {ANY}
  10. main
  11. local
  12. aux: AUX_ATTRIBUTE01B; x: INTEGER
  13. do
  14. set_flags
  15. create aux
  16. assert(aux.attribute_require_counter = 0)
  17. assert(aux.attribute_ensure_counter = 0)
  18. x := aux.value
  19. if require_flag then
  20. assert(aux.attribute_require_counter = 1)
  21. end
  22. if ensure_flag then
  23. assert(aux.attribute_ensure_counter = 1)
  24. end
  25. end
  26. require_flag: BOOLEAN
  27. ensure_flag: BOOLEAN
  28. set_flags_require: BOOLEAN
  29. do
  30. require_flag := True
  31. Result := True
  32. end
  33. set_flags
  34. require
  35. set_flags_require
  36. do
  37. ensure
  38. set_flags_ensure
  39. end
  40. set_flags_ensure: BOOLEAN
  41. do
  42. ensure_flag := True
  43. Result := True
  44. end
  45. end -- class TEST_ATTRIBUTE01
  46. --
  47. -- ------------------------------------------------------------------------------------------------------------------------------
  48. -- Copyright notice below. Please read.
  49. --
  50. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  51. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  52. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  53. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  54. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  55. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  56. --
  57. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  58. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  59. --
  60. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  61. --
  62. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  63. -- ------------------------------------------------------------------------------------------------------------------------------