/test/language/instruction/inspect/test_inspect7.e

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