Created
November 14, 2012 08:52
-
-
Save FranckSilvestre/4071051 to your computer and use it in GitHub Desktop.
Stimule and responses with Spock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package chess | |
import spock.lang.Specification | |
import spock.lang.Unroll | |
import static chess.PieceCouleur.BLANC | |
import static chess.PieceCouleur.NOIR | |
class PionSpecification3 extends Specification { | |
@Unroll | |
def "deplacement du pion"() { | |
setup: | |
def pion = new Pion(positionHorizontale: posHor, positionVerticale: posVer, pieceCouleur: couleur) | |
when: | |
def depOk = pion.bouge(depHor, depVer) | |
then: | |
depOk == depCorrect | |
if (depOk) { | |
pion.positionHorizontale == ((int)posHor)+depHor | |
pion.positionVerticale == posVer+depVer | |
} | |
where: | |
couleur | posHor | posVer | depHor | depVer | depCorrect | |
BLANC | "a" | 2 | 0 | 3 | false | |
BLANC | "a" | 2 | 0 | 2 | true | |
BLANC | "a" | 3 | 0 | 2 | false | |
BLANC | "a" | 3 | 0 | 1 | true | |
BLANC | "a" | 3 | 0 | -1 | false | |
NOIR | "a" | 7 | 0 | -1 | true | |
NOIR | "a" | 7 | 0 | 1 | false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment