/test/language/instruction/inspect/test_inspect7.e
Specman e | 81 lines | 54 code | 6 blank | 21 comment | 1 complexity | c55135d3290388bd0d7133335b86c70f 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_INSPECT7 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 "foo" then 22 assert_equal(words.item(i), "foo") 23 when "bar" then 24 assert_equal(words.item(i), "bar") 25 when "first" then 26 assert_equal(words.item(i), "first") 27 when "second" then 28 assert_equal(words.item(i), "second") 29 when "am" then 30 assert_equal(words.item(i), "am") 31 when "stram" then 32 assert_equal(words.item(i), "stram") 33 when "gram" then 34 assert_equal(words.item(i), "gram") 35 end 36 i := i + 1 37 end 38 end 39 40 words: ARRAY[STRING] 41 once 42 Result := {ARRAY[STRING] 1, << "foo", "bar", "first", "second", "am", "stram", "gram" >> } 43 end 44 45feature {} 46 cpt: INTEGER 47 48 assert_equal (given, expected: STRING) 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_string(expected) 57 std_output.put_string(once "<, but got >") 58 std_output.put_string(given) 59 std_output.put_string("<%N") 60 end 61 end 62 63end -- class TEST_INSPECT7 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-- ------------------------------------------------------------------------------------------------------------------------------