/tutorial/triangle/version4/example3.e

http://github.com/tybor/Liberty · Specman e · 47 lines · 37 code · 9 blank · 1 comment · 7 complexity · 2595a973c8b8c8d4d238a308883402f9 MD5 · raw file

  1. class EXAMPLE3
  2. -- Test of the customized is_equal/copy of class TRIANGLE.
  3. create {ANY}
  4. main
  5. feature {ANY}
  6. main
  7. local
  8. x, y, z: POINT
  9. do
  10. create x.make(1.0, 2.0)
  11. create y.make(1.0, 2.0)
  12. create z.make(3.0, 4.0)
  13. if x = y then
  14. io.put_string("x = y%N")
  15. end
  16. if x /= y then
  17. io.put_string("x /= y%N")
  18. end
  19. if x.is_equal(y) then
  20. io.put_string("x.is_equal(y)%N")
  21. end
  22. if y.is_equal(z) then
  23. io.put_string("x.is_equal(y)%N")
  24. end
  25. y := x
  26. if x = y then
  27. io.put_string("x = y%N")
  28. end
  29. if x.is_equal(y) then
  30. io.put_string("x.is_equal(y)%N")
  31. end
  32. io.put_string("To get a clone of x:%N")
  33. y := x.twin
  34. if x /= y and then x.is_equal(y) then
  35. io.put_string("x /= y and then x.is_equal(y)%N")
  36. end
  37. end
  38. end -- class EXAMPLE3