/src/tools/main/liberty_main_check_level.e

http://github.com/tybor/Liberty · Specman e · 85 lines · 57 code · 10 blank · 18 comment · 0 complexity · 45a66eaaf092e7c5013976e4447c79f8 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. expanded class LIBERTY_MAIN_CHECK_LEVEL
  16. feature {ANY}
  17. is_all_checked: BOOLEAN is
  18. -- must check "check" sections and loop variants
  19. do
  20. Result := value <= check_all
  21. end
  22. is_invariant_checked: BOOLEAN is
  23. -- must check (class and loop) invariants
  24. do
  25. Result := value <= check_invariant
  26. end
  27. is_ensure_checked: BOOLEAN is
  28. -- must check feature postconditions
  29. do
  30. Result := value <= check_ensure
  31. end
  32. is_require_checked: BOOLEAN is
  33. -- must check feature preconditions
  34. do
  35. Result := value <= check_require
  36. end
  37. feature {LIBERTY_MAIN}
  38. valid_arg (arg: STRING): BOOLEAN is
  39. do
  40. inspect
  41. arg
  42. when "all", "invariant", "ensure", "require", "none" then
  43. Result := True
  44. else
  45. end
  46. end
  47. set (arg: STRING): LIBERTY_MAIN_CHECK_LEVEL is
  48. do
  49. inspect
  50. arg
  51. when "all" then
  52. value := check_all
  53. when "invariant" then
  54. value := check_invariant
  55. when "ensure" then
  56. value := check_ensure
  57. when "require" then
  58. value := check_require
  59. when "none" then
  60. value := check_none
  61. else
  62. check False end
  63. end
  64. Result := Current
  65. end
  66. feature {}
  67. value: INTEGER_8
  68. check_all: INTEGER_8 is 0
  69. check_invariant: INTEGER_8 is 1
  70. check_ensure: INTEGER_8 is 2
  71. check_require: INTEGER_8 is 3
  72. check_none: INTEGER_8 is 4
  73. invariant
  74. value.in_range(check_all, check_none)
  75. end -- class LIBERTY_MAIN_CHECK_LEVEL