/src/tools/semantics/code/assertions/liberty_assertions.e

http://github.com/tybor/Liberty · Specman e · 52 lines · 28 code · 6 blank · 18 comment · 0 complexity · f8dbe7a3a3381961fa668cf2cc8fb906 MD5 · raw file

  1. -- This file is part of Liberty Eiffel.
  2. --
  3. -- Liberty Eiffel is free software: you can redistribute it and/or modify
  4. -- it under the terms of the GNU General Public License as published by
  5. -- the Free Software Foundation, version 3 of the License.
  6. --
  7. -- Liberty Eiffel is distributed in the hope that it will be useful,
  8. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. -- GNU General Public License for more details.
  11. --
  12. -- You should have received a copy of the GNU General Public License
  13. -- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
  14. --
  15. deferred class LIBERTY_ASSERTIONS
  16. insert
  17. LIBERTY_REACHABLE
  18. VISITABLE
  19. feature {LIBERTY_BUILDER_TOOLS}
  20. infix "and then" (other: LIBERTY_ASSERTIONS): LIBERTY_ASSERTIONS is
  21. -- Considering that `Current' is the parent, adds an "and then" assertions block. Used by "require
  22. -- then", "ensure then", and "invariant".
  23. do
  24. create {LIBERTY_ASSERTIONS_AND_THEN} Result.make(Current, other)
  25. ensure
  26. Result /= Void
  27. end
  28. infix "or else" (other: LIBERTY_ASSERTIONS): LIBERTY_ASSERTIONS is
  29. -- Considering that `Current' is the parent, adds an "or else" assertions block. Used by "require
  30. -- else".
  31. do
  32. create {LIBERTY_ASSERTIONS_OR_ELSE} Result.make(Current, other)
  33. ensure
  34. Result /= Void
  35. end
  36. feature {LIBERTY_FEATURE, LIBERTY_ASSERTIONS}
  37. specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
  38. require
  39. a_type /= Void
  40. deferred
  41. ensure
  42. Result /= Void
  43. end
  44. feature {}
  45. assertions_marker: LIBERTY_REACHABLE_COLLECTION_MARKER[LIBERTY_ASSERTION]
  46. end