PageRenderTime 24ms CodeModel.GetById 18ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/test/language/assertion/test_assertion_all4.e

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