/test/language/assertion/test_assertion_loop1.e

http://github.com/tybor/Liberty · Specman e · 58 lines · 32 code · 4 blank · 22 comment · 0 complexity · 935e82a773998c7a396a4bbb89f1aa93 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_ASSERTION_LOOP1
  5. -- To be run only in "-loop_check" mode.
  6. insert
  7. EIFFELTEST_TOOLS
  8. ASSERTION_CONSTANTS
  9. create {}
  10. main
  11. feature {ANY}
  12. main
  13. local
  14. trace: ARRAY[INTEGER]; aux: AUX_ASSERTION
  15. do
  16. create trace.make(require_index, debug_index)
  17. assert(trace.count = 7) -- assert # 1
  18. assert(trace.occurrences(0) = 7) -- assert # 2
  19. create aux.make(trace)
  20. assert(trace.item(require_index) = 0) -- assert # 3
  21. assert(trace.item(ensure_index) = 0) -- assert # 4
  22. assert(trace.item(class_invariant_index).in_range(1, 2)) -- assert # 5
  23. assert(trace.item(loop_invariant_index) = 0) -- assert # 6
  24. assert(trace.item(variant_index) = 0) -- assert # 7
  25. assert(trace.item(check_index) = 0) -- assert # 8
  26. assert(trace.item(debug_index) = 0) -- assert # 9
  27. aux.do_call
  28. assert(trace.item(require_index) = 1) -- assert # 10
  29. assert(trace.item(ensure_index) = 1) -- assert # 11
  30. assert(trace.item(class_invariant_index).in_range(3, 4)) -- assert # 12
  31. assert(trace.item(loop_invariant_index) = 2) -- assert # 13
  32. assert(trace.item(variant_index) = 1) -- assert # 14
  33. assert(trace.item(check_index) = 0) -- assert # 15
  34. assert(trace.item(debug_index) = 0) -- assert # 16
  35. end
  36. end -- class TEST_ASSERTION_LOOP1
  37. --
  38. -- ------------------------------------------------------------------------------------------------------------------------------
  39. -- Copyright notice below. Please read.
  40. --
  41. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  42. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  43. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  44. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  45. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  46. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  47. --
  48. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  49. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  50. --
  51. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  52. --
  53. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  54. -- ------------------------------------------------------------------------------------------------------------------------------