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