test/geometry/circle.rb in geometry-6.2 vs test/geometry/circle.rb in geometry-6.3

- old
+ new

@@ -86,16 +86,52 @@ end it "must calculate the correct radius" do circle.radius.must_equal 2 end + + it 'must have the correct min values' do + circle.min.must_equal Point[-2, -2] + circle.min.must_be_instance_of Geometry::PointIso + end + + it 'must have the correct max values' do + circle.max.must_equal Point[2, 2] + circle.max.must_be_instance_of Geometry::PointIso + end + + it 'must have the correct minmax values' do + circle.minmax.must_equal [Point[-2, -2], Point[2,2]] + end end + describe 'when constructed with a Rational diameter and no center' do + let(:circle) { Circle.new :diameter => Rational(5,3) } + + it 'must have the correct min values' do + circle.min.must_equal Point[-5/6, -5/6] + circle.min.must_be_instance_of Geometry::PointIso + end + + it 'must have the correct max values' do + circle.max.must_equal Point[5/6, 5/6] + circle.max.must_be_instance_of Geometry::PointIso + end + + it 'must have the correct minmax values' do + circle.minmax.must_equal [Point[-5/6, -5/6], Point[5/6,5/6]] + end + end + describe "properties" do subject { Circle.new center:[1,2], :diameter => 4 } it "must have a bounds property that returns a Rectangle" do subject.bounds.must_equal Rectangle.new([-1,0], [3,4]) + end + + it 'must always be closed' do + subject.closed?.must_equal true end it "must have a minmax property that returns the corners of the bounding rectangle" do subject.minmax.must_equal [Point[-1,0], Point[3,4]] end