/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

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