/test/lib/io/test_input_stream1.e

http://github.com/tybor/Liberty · Specman e · 72 lines · 45 code · 4 blank · 23 comment · 0 complexity · 9c3dc0f71008e1e271f6cb3ad528d9bf 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_INPUT_STREAM1
  5. insert
  6. SYSTEM
  7. EIFFELTEST_TOOLS
  8. create {}
  9. main
  10. feature {ANY}
  11. main
  12. local
  13. tfr: TEXT_FILE_READ; value: INTEGER; path: STRING
  14. last_character:CHARACTER
  15. do
  16. path := "test_input_stream1.e"
  17. create tfr.connect_to(path)
  18. assert(tfr.is_connected)
  19. tfr.reach_and_skip("YOO" -- ICI
  20. )
  21. assert(tfr.last_character = 'O')
  22. assert(tfr.last_string.is_equal("YOO"))
  23. tfr.read_line
  24. assert(tfr.last_string.is_equal("%" -- ICI"))
  25. tfr.skip_separators
  26. last_character := tfr.last_character
  27. assert(tfr.last_character = ' ')
  28. tfr.read_word
  29. assert(tfr.last_string.is_equal(")"))
  30. tfr.skip_separators
  31. last_character := tfr.last_character
  32. assert(tfr.last_character = ' ')
  33. tfr.skip_separators
  34. assert(tfr.last_character = ' ')
  35. -- TEST01:12
  36. tfr.reach_and_skip("TEST01:")
  37. assert(tfr.last_character = ':')
  38. tfr.read_integer
  39. value := tfr.last_integer
  40. assert(value = 12)
  41. -- TEST02:3.5
  42. tfr.reach_and_skip("TEST02:")
  43. assert(tfr.last_character = ':')
  44. tfr.read_real
  45. assert(tfr.last_real = 3.5)
  46. tfr.reach_and_skip(path)
  47. assert(tfr.end_of_input)
  48. tfr.disconnect
  49. end
  50. end -- class TEST_INPUT_STREAM1
  51. --
  52. -- ------------------------------------------------------------------------------------------------------------------------------
  53. -- Copyright notice below. Please read.
  54. --
  55. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  56. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  57. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  58. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  59. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  60. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  61. --
  62. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  63. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  64. --
  65. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  66. --
  67. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  68. -- ------------------------------------------------------------------------------------------------------------------------------