The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Feature: Basic Calculator Functions
  In order to check I've written the Calculator class correctly
  As a developer I want to check some basic operations
  So that I can have confidence in my Calculator class.

  Background:
    Given a usable "Calculator" class

  Scenario: First Key Press on the Display
    Given a new Calculator object
    And having pressed 1
    Then the display should show 1

  Scenario: Several Key Presses on the Display
    Given a new Calculator object
    And having pressed 1 and 2 and 3 and . and 5 and 0
    Then the display should show 123.50

  Scenario: Pressing Clear Wipes the Display
    Given a new Calculator object
    And having pressed 1 and 2 and 3
    And having pressed C
    Then the display should show 0

  Scenario: Add as you go
    Given a new Calculator object
    And having pressed 1 and 2 and 3 and + and 4 and 5 and 6 and +
    Then the display should show 579

  Scenario: Basic arithmetic
    Given a new Calculator object
    And having keyed <first>
    And having keyed <operator>
    And having keyed <second>
    And having pressed =
    Then the display should show <result>
    Examples:
      | first | operator | second | result |
      | 5.0   | +        | 5.0    | 10     |
      | 6     | /        | 3      | 2      |
      | 10    | *        | 7.550  | 75.5   |
      | 3     | -        | 10     | -7     |

  Scenario: Separation of calculations
    Given a new Calculator object
    And having successfully performed the following calculations
      | first | operator | second | result |
      | 0.5   | +        | 0.1    | 0.6    |
      | 0.01  | /        | 0.01   | 1      |
      | 10    | *        | 1      | 10     |
    And having pressed 3
    Then the display should show 3

  Scenario: Ticker Tape
    Given a new Calculator object
    And having entered the following sequence
      """
      1 + 2 + 3 + 4 + 5 + 6 -
      100
      * 13 \=\=\= + 2 =
      """
    Then the display should show -1025
----------DIVIDER----------
---
line: 1
name: Basic Calculator Functions
satisfaction:
  - In order to check I've written the Calculator class correctly
  - As a developer I want to check some basic operations
  - So that I can have confidence in my Calculator class.
scenarios:
  -
    background: 0
    data: []
    line: 9
    name: First Key Press on the Display
    steps:
      -
        data: ~
        line: 10
        text: a new Calculator object
        verb: Given
        verb_original: Given
      -
        data: ~
        line: 11
        text: having pressed 1
        verb: Given
        verb_original: And
      -
        data: ~
        line: 12
        text: the display should show 1
        verb: Then
        verb_original: Then
  -
    background: 0
    data: []

    line: 14
    name: Several Key Presses on the Display
    steps:
      -
        data: ~
        line: 15
        text: a new Calculator object
        verb: Given
        verb_original: Given
      -
        data: ~
        line: 16
        text: having pressed 1 and 2 and 3 and . and 5 and 0
        verb: Given
        verb_original: And
      -
        data: ~
        line: 17
        text: the display should show 123.50
        verb: Then
        verb_original: Then
  -
    background: 0
    data: []

    line: 19
    name: Pressing Clear Wipes the Display
    steps:
      -
        data: ~
        line: 20
        text: a new Calculator object
        verb: Given
        verb_original: Given
      -
        data: ~
        line: 21
        text: having pressed 1 and 2 and 3
        verb: Given
        verb_original: And
      -
        data: ~
        line: 22
        text: having pressed C
        verb: Given
        verb_original: And
      -
        data: ~
        line: 23
        text: the display should show 0
        verb: Then
        verb_original: Then
  -
    background: 0
    data: []

    line: 25
    name: Add as you go
    steps:
      -
        data: ~
        line: 26
        text: a new Calculator object
        verb: Given
        verb_original: Given
      -
        data: ~
        line: 27
        text: having pressed 1 and 2 and 3 and + and 4 and 5 and 6 and +
        verb: Given
        verb_original: And
      -
        data: ~
        line: 28
        text: the display should show 579
        verb: Then
        verb_original: Then
  -
    background: 0
    data:
      -
        first: '5.0'
        operator: +
        result: 10
        second: '5.0'
      -
        first: 6
        operator: /
        result: 2
        second: 3
      -
        first: 10
        operator: "*"
        result: '75.5'
        second: '7.550'
      -
        first: 3
        operator: "-"
        result: -7
        second: 10
    line: 30
    name: Basic arithmetic
    steps:
      -
        data: ~
        line: 31
        text: a new Calculator object
        verb: Given
        verb_original: Given
      -
        data: ~
        line: 32
        text: having keyed <first>
        verb: Given
        verb_original: And
      -
        data: ~
        line: 33
        text: having keyed <operator>
        verb: Given
        verb_original: And
      -
        data: ~
        line: 34
        text: having keyed <second>
        verb: Given
        verb_original: And
      -
        data: ~
        line: 35
        text: having pressed =
        verb: Given
        verb_original: And
      -
        data: ~
        line: 36
        text: the display should show <result>
        verb: Then
        verb_original: Then
  -
    background: 0
    data: []

    line: 44
    name: Separation of calculations
    steps:
      -
        data: ~
        line: 45
        text: a new Calculator object
        verb: Given
        verb_original: Given
      -
        data:
          -
            first: '0.5'
            operator: +
            result: '0.6'
            second: '0.1'
          -
            first: '0.01'
            operator: /
            result: 1
            second: '0.01'
          -
            first: 10
            operator: "*"
            result: 10
            second: 1
        line: 46
        text: having successfully performed the following calculations
        verb: Given
        verb_original: And
      -
        data: ~
        line: 51
        text: having pressed 3
        verb: Given
        verb_original: And
      -
        data: ~
        line: 52
        text: the display should show 3
        verb: Then
        verb_original: Then
  -
    background: 0
    data: []

    line: 54
    name: Ticker Tape
    steps:
      -
        data: ~
        line: 55
        text: a new Calculator object
        verb: Given
        verb_original: Given
      -
        data: "1 + 2 + 3 + 4 + 5 + 6 -\n100\n* 13 === + 2 =\n"
        line: 56
        text: having entered the following sequence
        verb: Given
        verb_original: And
      -
        data: ~
        line: 62
        text: the display should show -1025
        verb: Then
        verb_original: Then