PageRenderTime 29ms CodeModel.GetById 20ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/test/language/unclassified/test_endian02.e

http://github.com/tybor/Liberty
Specman e | 90 lines | 64 code | 5 blank | 21 comment | 0 complexity | 93609b4f80fc6edcb470d6aa992e897d 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_ENDIAN02
 5
 6inherit
 7   EIFFELTEST_TOOLS
 8
 9create {}
10   make
11
12feature {ANY}
13   file_tools: FILE_TOOLS
14      once
15         create Result
16      end
17
18   make
19      local
20         bfw: BINARY_FILE_WRITE; bfr: BINARY_FILE_READ
21      do
22         create bfw.connect_to("test_endian02.dat")
23         assert(bfw.is_connected)
24         bfw.put_integer_32_native_endian(1)
25         bfw.put_integer_32_native_endian(2)
26         bfw.put_integer_32_native_endian(3)
27         bfw.put_integer_32_native_endian(4)
28         bfw.put_integer_32_big_endian(1)
29         bfw.put_integer_32_big_endian(2)
30         bfw.put_integer_32_big_endian(3)
31         bfw.put_integer_32_big_endian(4)
32         bfw.put_integer_32_little_endian(1)
33         bfw.put_integer_32_little_endian(2)
34         bfw.put_integer_32_little_endian(3)
35         bfw.put_integer_32_little_endian(4)
36         bfw.disconnect
37         assert(not bfw.is_connected)
38         create bfr.connect_to("test_endian02.dat")
39         assert(bfr.is_connected)
40         bfr.read_integer_32_native_endian
41         assert(bfr.last_integer_32 = 1)
42         bfr.read_integer_32_native_endian
43         assert(bfr.last_integer_32 = 2)
44         bfr.read_integer_32_native_endian
45         assert(bfr.last_integer_32 = 3)
46         bfr.read_integer_32_native_endian
47         assert(bfr.last_integer_32 = 4)
48         bfr.read_integer_32_big_endian
49         assert(bfr.last_integer_32 = 1)
50         bfr.read_integer_32_big_endian
51         assert(bfr.last_integer_32 = 2)
52         bfr.read_integer_32_big_endian
53         assert(bfr.last_integer_32 = 3)
54         bfr.read_integer_32_big_endian
55         assert(bfr.last_integer_32 = 4)
56         bfr.read_integer_32_little_endian
57         assert(bfr.last_integer_32 = 1)
58         bfr.read_integer_32_little_endian
59         assert(bfr.last_integer_32 = 2)
60         bfr.read_integer_32_little_endian
61         assert(bfr.last_integer_32 = 3)
62         bfr.read_integer_32_little_endian
63         assert(bfr.last_integer_32 = 4)
64         assert(not bfr.end_of_input)
65         bfr.read_byte
66         assert(bfr.end_of_input)
67         bfr.disconnect
68         assert(not bfr.is_connected)
69         file_tools.delete("test_endian02.dat")
70      end
71
72end -- class TEST_ENDIAN02
73--
74-- ------------------------------------------------------------------------------------------------------------------------------
75-- Copyright notice below. Please read.
76--
77-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
78-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
79-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
80-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
81-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
82-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
83--
84-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
85-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
86--
87-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
88--
89-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
90-- ------------------------------------------------------------------------------------------------------------------------------