ecattez / shahmat

A Chess implementation with the Domain Driven Design
https://ecattez.github.io/shahmat/
GNU General Public License v3.0
3 stars 0 forks source link

Feature: Promotion #3

Closed ecattez closed 4 years ago

ecattez commented 4 years ago

Feature: Promotion

Scenario: Promotion is proposed when a pawn reaches the other side of the chess board

GIVEN a <color> pawn in <from>
WHEN the pawn is moved forward
THEN a promotion is proposed in <to>

Example:
    | color | from | to |
    | WHITE | A7 | A8 |
    | WHITE | B7 | B8 |
    | WHITE | C7 | C8 |
    | WHITE | D7 | D8 |
    | WHITE | E7 | E8 |
    | WHITE | F7 | F8 |
    | WHITE | G7 | G8 |
    | WHITE | H7 | H8 |
    | BLACK | A2 | A1 |
    | BLACK | B2 | B1 |
    | BLACK | C2 | C1 |
    | BLACK | D2 | D1 |
    | BLACK | E2 | E1 |
    | BLACK | F2 | F1 |
    | BLACK | G2 | G1 |
    | BLACK | H2 | H1 |

Scenario: Pawn can not be promoted for pawn nor a king

GIVEN a pawn in the other side of the chess board
WHEN the pawn is promoted to a <promotion-type>
THEN the promotion is refused
WITH "Piece can not promote" as reason

Example:
    | promotion-type |
    | PAWN |
    | KING |

Scenario: Pawn may be promoted for a non king piece

GIVEN a pawn in the other side of the chess board
WHEN the pawn is promoted to a <promotion-type>
THEN a <promotion-type> replaces the pawn

Example:
    | promotion-type |
    | QUEEN |
    | KNIGHT |
    | ROOK |
    | BISHOP |

Scenario: Pawn can not be promoted if it has not been offered to it

GIVEN a pawn not in the other side of the chess board
WHEN the pawn is promoted to a valid piece
THEN the promotion is refused
WITH "Piece can not be promoted" as reason

Scenario: No piece can be moved while a pawn is promoted

GIVEN a pawn in the other side of the chess board
AND the promotion is proposed
WHEN an other piece is moved
THEN the move is refused