Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43626d2
commit f63e64f
Showing
2 changed files
with
102 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,77 @@ | ||
require 'spec_helper' | ||
|
||
describe GeoMagic::SquareRadius do | ||
describe '#new' do | ||
let(:center) do | ||
{:lat => 40, :long => 11} | ||
let(:center) do | ||
{:lat => 40, :long => 11} | ||
end | ||
|
||
let(:distance) { 0.5.km } | ||
|
||
let(:center_point) do | ||
GeoMagic::Point.new :lat => 40, :long => 11 | ||
end | ||
|
||
|
||
describe '#new' do | ||
it "should create a new square radius from an array" do | ||
square = GeoMagic::SquareRadius.new [30, 10], distance | ||
puts square.inspect | ||
end | ||
|
||
let(:distance) { 0.5.km } | ||
|
||
it "should create a new square radius" do | ||
square = GeoMagic::SquareRadius.new center, distance | ||
puts square.inspect | ||
end | ||
|
||
it "should create a new square radius from a point" do | ||
square = GeoMagic::SquareRadius.new center_point, distance | ||
puts square.inspect | ||
end | ||
end | ||
|
||
describe '#double' do | ||
let (:square) do | ||
GeoMagic::SquareRadius.new center, distance | ||
end | ||
|
||
it "should double the radius distance and return new square" do | ||
other_square = square.double | ||
other_square.distance.should_not == square.distance | ||
puts square.inspect | ||
end | ||
end | ||
|
||
describe '#double!' do | ||
let (:square) do | ||
GeoMagic::SquareRadius.new center, distance | ||
end | ||
|
||
it "should double the radius distance" do | ||
square.double! | ||
puts square.inspect | ||
end | ||
end | ||
|
||
describe '#halve' do | ||
let (:square) do | ||
GeoMagic::SquareRadius.new center, distance | ||
end | ||
|
||
it "should halve the radius distance and return new square" do | ||
other_square = square.halve | ||
other_square.distance.should_not == square.distance | ||
puts square.inspect | ||
end | ||
end | ||
|
||
describe '#halve!' do | ||
let (:square) do | ||
GeoMagic::SquareRadius.new center, distance | ||
end | ||
|
||
it "should halve the radius distance" do | ||
square.halve! | ||
puts square.inspect | ||
end | ||
end | ||
end |