Last active
August 29, 2015 14:03
-
-
Save glassbead0/a97b06aef00f9df29797 to your computer and use it in GitHub Desktop.
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
require 'rspec' | |
require './lib/primes.rb' | |
describe isPrime? do | |
describe 'one is neither prime nor composite' do | |
it 'should return nil if 1 is passed' do | |
expect(isPrime?(1)).to eq(nil) | |
end | |
end | |
describe 'some prime numbers' do | |
it 'should return true for prime numbers' do | |
expect(isPrime?(2)).to eq(true) | |
expect(isPrime?(3)).to eq(true) | |
expect(isPrime?(5)).to eq(true) | |
expect(isPrime?(11)).to eq(true) | |
expect(isPrime?(8111)).to eq(true) | |
end | |
end | |
describe 'some composite numbers' do | |
it 'should return false for composite numbers' do | |
expect(isPrime?(4)).to eq(false) | |
expect(isPrime?(9)).to eq(false) | |
expect(isPrime?(12)).to eq(false) | |
expect(isPrime?(10000)).to eq(false) | |
expect(isPrime?(8374968)).to eq(false) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment