Skip to content

Commit

Permalink
Add test cases for task 5 (see #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Vanhoef authored and Peter Vanhoef committed Mar 21, 2017
1 parent fe71ae4 commit 1e8f59a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Calculator/Calculator/CalculatorBrain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,6 @@ struct CalculatorBrain {
return accumulator
}
}

var resultIsPending: Bool = false
}
13 changes: 13 additions & 0 deletions Calculator/CalculatorTests/CalculatorBrainTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,17 @@ class CalculatorBrainTests: XCTestCase {
testBrain.performOperation("x⁻¹")
XCTAssertEqual(testBrain.result, 0.25)
}

func testResultIsPendingTask5() {
var testBrain = CalculatorBrain()

testBrain.setOperand(4)
XCTAssertFalse(testBrain.resultIsPending)
testBrain.performOperation("+")
XCTAssertTrue(testBrain.resultIsPending)
testBrain.setOperand(9)
testBrain.performOperation("=")
XCTAssertFalse(testBrain.resultIsPending)
XCTAssertEqual(testBrain.result, 13)
}
}

0 comments on commit 1e8f59a

Please sign in to comment.