/test/language/instruction/inspect/test_inspect9.e
Specman e | 104 lines | 76 code | 7 blank | 21 comment | 1 complexity | 1f0afb1d167496f1a95534b20cbef919 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_INSPECT9 5 6create {} 7 make 8 9feature {ANY} 10 make 11 local 12 i, j: 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 from 26 j := words_2.lower 27 until 28 j > words_2.upper 29 loop 30 inspect 31 words_2 @ j 32 when "pic" then 33 assert_equal(words_2.item(j), "pic") 34 when "co" then 35 assert_equal(words_2.item(j), "co") 36 when "le" then 37 assert_equal(words_2.item(j), "le") 38 when "gram" then 39 assert_equal(words_2.item(j), "gram") 40 end 41 j := j + 1 42 end 43 when "first" then 44 assert_equal(words.item(i), "first") 45 when "second" then 46 assert_equal(words.item(i), "second") 47 when "am" then 48 assert_equal(words.item(i), "am") 49 when "stram" then 50 assert_equal(words.item(i), "stram") 51 when "gram" then 52 assert_equal(words.item(i), "gram") 53 end 54 i := i + 1 55 end 56 end 57 58 words: ARRAY[STRING] 59 once 60 Result := {ARRAY[STRING] 1, << "foo", "bar", "first", "second", "am", "stram", "gram" >> } 61 end 62 63 words_2: ARRAY[STRING] 64 once 65 Result := {ARRAY[STRING] 1, << "pic", "co", "le", "gram" >> } 66 end 67 68feature {} 69 cpt: INTEGER 70 71 assert_equal (given, expected: STRING) 72 do 73 cpt := cpt + 1 74 if not given.is_equal(expected) then 75 sedb_breakpoint 76 std_output.put_string(once "TEST_INSPECT9: ERROR Test # ") 77 std_output.put_integer(cpt) 78 std_output.put_string(once ": expected >") 79 std_output.put_string(expected) 80 std_output.put_string(once "<, but got >") 81 std_output.put_string(given) 82 std_output.put_string("<%N") 83 end 84 end 85 86end -- class TEST_INSPECT9 87-- 88-- ------------------------------------------------------------------------------------------------------------------------------ 89-- Copyright notice below. Please read. 90-- 91-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, 92-- as published by the Free Software Foundation; either version 2, or (at your option) any later version. 93-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty 94-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have 95-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free 96-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 97-- 98-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE 99-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE 100-- 101-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN 102-- 103-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr 104-- ------------------------------------------------------------------------------------------------------------------------------