/test/language/instruction/inspect/test_inspect9.e

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