Listing 7: Testing intersection.
class Lineclass TestLine < Test::Unit::TestCase def set_up @line1 = Line.new(Point.new(5.0,0.0),Point.new(5.0,10.0))#vert @line2 = Line.new(Point.new(0.0,5.0),Point.new(10.0,5.0))#horiz end def test_intersection ip = @line1.intersection @line2 assert_equal(Point,ip.class) assert_equal(5.0,ip.x) assert_equal(5.0,ip.y) end end