Skip to content

Instantly share code, notes, and snippets.

@TheDudeWithTheThing
Created December 5, 2016 16:07
Show Gist options
  • Save TheDudeWithTheThing/dc8d50b0588c72b9de17905ce3d8a847 to your computer and use it in GitHub Desktop.
Save TheDudeWithTheThing/dc8d50b0588c72b9de17905ce3d8a847 to your computer and use it in GitHub Desktop.
require './sky_skraper.rb'
require 'pry'
describe SkySkraper do
describe '#area' do
subject { SkySkraper.area(coords) }
context 'two coords with overlap' do
let(:coords) { [[11, 14, 2], [12, 13, 5]] }
it { is_expected.to eq(9) }
end
context 'two coords no overlap' do
let(:coords) { [[2, 3, 2], [3, 4, 8]] }
it { is_expected.to eq(10) }
end
context 'all overlap everywhere' do
let(:coords) { [[2, 3, 2], [2, 3, 8]] }
it { is_expected.to eq(8) }
end
context 'one set of coords' do
let(:coords) { [[0, 10, 2]] }
it { is_expected.to eq(20) }
end
context 'many sets of coords' do
let(:coords) { [[0, 10, 3], [3, 5, 7], [6, 7, 8], [9, 11, 2]] }
it { is_expected.to eq(45) }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment