PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/test/language/assertion/test_attribute02.e

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