PageRenderTime 29ms CodeModel.GetById 25ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/test/tools/compiler/asm/test01.e

http://github.com/tybor/Liberty
Specman e | 53 lines | 43 code | 10 blank | 0 comment | 1 complexity | f5e5de99ab9ec27ea8f7e6ff49daf5a7 MD5 | raw file
 1class TEST01
 2
 3insert
 4   EIFFELTEST_TOOLS
 5   LIBERTY_ASM_MARSHALLER
 6
 7create {}
 8   make
 9
10feature {}
11   make
12      local
13         system: LIBERTY_ASM_SYSTEM
14         type: LIBERTY_ASM_TYPE
15         method: LIBERTY_ASM_METHOD
16         load_1, load_2: LIBERTY_ASM_LOAD_INT
17         add: LIBERTY_ASM_ADD_INT
18         return: LIBERTY_ASM_RETURN
19
20         string: STRING
21         string_input: STRING_INPUT_STREAM
22         string_output: STRING_OUTPUT_STREAM
23
24         read_system: TUPLE[LIBERTY_ASM_SYSTEM, FIXED_STRING]
25      do
26         create type.make(1, 0)
27         create load_1.make(1)
28         create load_2.make(2)
29         load_1.set_next(load_2)
30         create add.make
31         load_2.set_next(add)
32         create return.make
33         add.set_next(return)
34         create method.make(type, load_1, create {FAST_ARRAY[LIBERTY_ASM_PARAMETER]}.make(0))
35         create system.make({FAST_ARRAY[LIBERTY_ASM_TYPE] << type >>}, method)
36
37         string := ""
38         create string_output.connect_to(string)
39         write(string_output, system)
40
41         create string_input.from_string(string)
42         read_system := read(string_input)
43
44         if read_system.second /= Void then
45            std_error.put_string("*** ")
46            std_error.put_line(read_system.second)
47         end
48
49         assert(read_system.first /= Void)
50         assert(read_system.first.is_equal(system))
51      end
52
53end