test/geometry/line.rb in geometry-6.3 vs test/geometry/line.rb in geometry-6.4
- old
+ new
@@ -111,22 +111,85 @@
subject { Geometry::PointSlopeLine.new [1,2], 3 }
it "must have a slope attribute" do
subject.slope.must_equal 3
end
+
+ it "must handle equality" do
+ line2 = Geometry::PointSlopeLine.new([1,2], 3)
+ line3 = Geometry::PointSlopeLine.new([1,1], 4)
+ subject.must_equal line2
+ subject.wont_equal line3
+ end
+
+ it 'must handle equality with a SlopeInterceptLine' do
+ line2 = Geometry::SlopeInterceptLine.new(3, -1)
+ line3 = Geometry::SlopeInterceptLine.new(4, -1)
+ line2.must_equal subject
+ line3.wont_equal subject
+ end
+
+ it 'must handle equality with a TwoPointLine' do
+ line2 = Geometry::TwoPointLine.new([1,2], [2,5])
+ line3 = Geometry::TwoPointLine.new([1,2], [2,4])
+ line2.must_equal subject
+ line3.wont_equal subject
+ end
end
describe Geometry::SlopeInterceptLine do
subject { Geometry::SlopeInterceptLine.new 3, 2 }
it "must have a slope attribute" do
subject.slope.must_equal 3
end
+
+ it "must handle equality" do
+ line2 = Geometry::SlopeInterceptLine.new(3, 2)
+ line3 = Geometry::SlopeInterceptLine.new(4, 3)
+ subject.must_equal line2
+ subject.wont_equal line3
+ end
+
+ it 'must handle equality with a PointSlopeLine' do
+ line2 = Geometry::PointSlopeLine.new([0,2], 3)
+ line3 = Geometry::PointSlopeLine.new([0,2], 2)
+ line2.must_equal subject
+ line3.wont_equal subject
+ end
+
+ it 'must handle equality with a TwoPointLine' do
+ line2 = Geometry::TwoPointLine.new([0,2], [1,5])
+ line3 = Geometry::TwoPointLine.new([0,2], [1,4])
+ line2.must_equal subject
+ line3.wont_equal subject
+ end
end
describe Geometry::TwoPointLine do
subject { Geometry::TwoPointLine.new [1,2], [3,4] }
it "must have a slope attribute" do
subject.slope.must_equal 1
+ end
+
+ it "must handle equality" do
+ line2 = Geometry::TwoPointLine.new([1,2], [3,4])
+ line3 = Geometry::TwoPointLine.new([1,1], [5,5])
+ subject.must_equal line2
+ subject.wont_equal line3
+ end
+
+ it 'must handle equality with a PointSlopeLine' do
+ line2 = Geometry::PointSlopeLine.new([1,2], 1)
+ line3 = Geometry::PointSlopeLine.new([1,2], 2)
+ line2.must_equal subject
+ line3.wont_equal subject
+ end
+
+ it 'must handle equality with a SlopeInterceptLine' do
+ line2 = Geometry::SlopeInterceptLine.new(1, 1)
+ line3 = Geometry::SlopeInterceptLine.new(1, -1)
+ line2.must_equal subject
+ line3.wont_equal subject
end
end