/tutorial/triangle/version4/example1.e

http://github.com/tybor/Liberty · Specman e · 22 lines · 18 code · 3 blank · 1 comment · 0 complexity · 4c597f9ce587e683abc6e798df7ad8cc MD5 · raw file

  1. class EXAMPLE1
  2. -- Using files is really easy too.
  3. create {ANY}
  4. main
  5. feature {ANY}
  6. main
  7. local
  8. p1: POINT; file_name: STRING; file: TEXT_FILE_WRITE
  9. do
  10. create p1.make(1.0, 2.0)
  11. p1.translate(1.0, 2.0)
  12. p1.display_on(io)
  13. file_name := "my_file.txt"
  14. create file.connect_to(file_name)
  15. p1.display_on(file)
  16. file.disconnect
  17. io.put_string("And the same output in %"" + file_name + "%" on the disk.%N")
  18. end
  19. end -- class EXAMPLE1