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