Skip to content

Instantly share code, notes, and snippets.

@rspec
Created December 30, 2009 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rspec/266479 to your computer and use it in GitHub Desktop.
Save rspec/266479 to your computer and use it in GitHub Desktop.
Feature: code-breaker submits guess
The code-breaker submits a guess of four numbers. The game marks the guess
with + and - signs.
For each number in the guess that matches the number and position of a number
in the secret code, the mark includes one +. For each number in the guess
that matches the number but not the position of a number in the secret code,
a - is added to the mark.
Scenario Outline: submit guess
Given the secret code is <code>
When I guess <guess>
Then the mark should be <mark>
Scenarios: all numbers correct
| code | guess | mark |
| 1234 | 1234 | ++++ |
| 1234 | 1243 | ++-- |
| 1234 | 1423 | +--- |
| 1234 | 4321 | ---- |
Scenarios: 3 numbers correct
| code | guess | mark |
| 1234 | 5234 | +++ |
| 1234 | 5134 | ++- |
| 1234 | 5124 | +-- |
| 1234 | 5123 | --- |
Scenarios: 2 numbers correct
| code | guess | mark |
| 1234 | 5254 | ++ |
| 1234 | 5154 | +- |
| 1234 | 2545 | -- |
Scenarios: 1 number correct
| code | guess | mark |
| 1234 | 1555 | + |
| 1234 | 5515 | - |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment