PageRenderTime 22ms CodeModel.GetById 15ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/test/language/instruction/inspect/test_inspect8.e

http://github.com/tybor/Liberty
Specman e | 81 lines | 54 code | 6 blank | 21 comment | 1 complexity | e1b57aa33b2acf57ddb47d8fdd6939bb 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_INSPECT8
 5
 6create {}
 7   make
 8
 9feature {ANY}
10   make
11      local
12         i: INTEGER
13      do
14         from
15            i := words.lower
16         until
17            i > words.upper
18         loop
19            inspect
20               words @ i
21            when 1 then
22               assert_equal(words.item(i), 1)
23            when 2 then
24               assert_equal(words.item(i), 2)
25            when 3 then
26               assert_equal(words.item(i), 3)
27            when 4 then
28               assert_equal(words.item(i), 4)
29            when 5 then
30               assert_equal(words.item(i), 5)
31            when 6 then
32               assert_equal(words.item(i), 6)
33            when 7 then
34               assert_equal(words.item(i), 7)
35            end
36            i := i + 1
37         end
38      end
39
40   words: ARRAY[INTEGER]
41      once
42         Result := {ARRAY[INTEGER] 1, << 1, 2, 3, 4, 5, 6, 7 >> }
43      end
44
45feature {}
46   cpt: INTEGER
47
48   assert_equal (given, expected: INTEGER)
49      do
50         cpt := cpt + 1
51         if not given.is_equal(expected) then
52            sedb_breakpoint
53            std_output.put_string(once "TEST_INSPECT7: ERROR Test # ")
54            std_output.put_integer(cpt)
55            std_output.put_string(once ": expected >")
56            std_output.put_integer(expected)
57            std_output.put_string(once "<, but got >")
58            std_output.put_integer(given)
59            std_output.put_string("<%N")
60         end
61      end
62
63end -- class TEST_INSPECT8
64--
65-- ------------------------------------------------------------------------------------------------------------------------------
66-- Copyright notice below. Please read.
67--
68-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
69-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
70-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
71-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
72-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
73-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
74--
75-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
76-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
77--
78-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
79--
80-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
81-- ------------------------------------------------------------------------------------------------------------------------------