assignment_rspec_calculator#84
Open
chadl76 wants to merge 4 commits into
Open
Conversation
remis1889
reviewed
May 14, 2017
remis1889
left a comment
There was a problem hiding this comment.
Missing tests for memory and memory= methods
| require 'calculator.rb' | ||
|
|
||
| describe Calculator do | ||
|
|
There was a problem hiding this comment.
create a common instance for Calculator and use it throughout the specs.
let(:c) { Calculator.new }
|
|
||
| it 'properly adds two negative numbers' do | ||
| expect(Calculator.new.add(-1,-2)).to eq(-3) | ||
| end |
There was a problem hiding this comment.
test for floating point numbers too.
| it 'should divide two integers without remainder' do | ||
| expect(Calculator.new.divide(8,2)).to eq(4) | ||
| end | ||
| end |
There was a problem hiding this comment.
You should also test if the result of a division with remainder is a Float
| end | ||
| it 'should raise number to its negative power' do | ||
| expect(Calculator.new.pow(2,-3)).to eq(2 ** -3) | ||
| end |
There was a problem hiding this comment.
Also, test for cases when the exponent is zero and a decimal
|
|
||
| describe '#sqrt' do | ||
| it 'should return the square root of integer' do | ||
| expect(Calculator.new.sqrt(16)).to eq(Math.sqrt(16)) |
There was a problem hiding this comment.
also, write tests for negative argument, round roots and non-round roots.
|
|
||
| describe '#stringify' do | ||
| it 'should return answer as a string' do | ||
| expect(Calculator.new(true).add(1,1)).to eq(2.to_s) |
There was a problem hiding this comment.
write tests for other main operations too when stringify is true
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.