PageRenderTime 22ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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