Warm-Up Exercise: A Basic Calculator
Verify Your Work
Inject a bug into
Implement the steps and make the scenarios pass.
RpnCalculator
to convince yourself everything is connected properly.
Feature: Basic Arithmetic# Try to change one of the values below to provoke a failure
Scenario: Addition
Given a calculator I just turned on
When I push 4
And I push 5
And I add
Then the result is 9# Try to change one of the values below to provoke a failure
Scenario: Another Addition
Given a calculator I just turned on
When I push 4
And I push -7
And I add
Then the result is -3Scenario Outline: Subtract
Given a calculator I just turned on
When I push <a>
And I push <b>
And I subtract
Then the result is <result> Examples:
| a | b | result |
| 3 | 2 | 1 |
| 2 | 3 | -1 |
Implement the steps and make the scenarios pass.
(Reading...)
Formatting Hints:
To format... | use this markup: |
---|---|
source code | {source:lang=java|lineNumbers=false}...{source} (Supported languages: java, cpp, csharp, c, python.) |
bold text | __some text__ |
italicized text | ~~some text~~ |
underlined text | @@some text@@ |
a method or class name | ``myMethod(...)`` |