Sha256: 0f2778ce01c672c32b33ef1cbe33113f72c67786277bc1f8fbc3d79dfa694fd4

Contents?: true

Size: 1.03 KB

Versions: 134

Compression:

Stored size: 1.03 KB

Contents

@Grab('org.spockframework:spock-core:1.0-groovy-2.4')
import spock.lang.*

class ScrabbleScoreSpec extends Specification {

    def 'lowercase letter'() {
        expect:
        ScrabbleScore.scoreWord('a') == 1
    }

    def 'uppercase letter'() {
        expect:
        ScrabbleScore.scoreWord('A') == 1
    }

    def 'valuable letter'() {
        expect:
        ScrabbleScore.scoreWord('f') == 4
    }

    def 'empty input'() {
        expect:
        ScrabbleScore.scoreWord('') == 0
    }

    @Unroll
    def 'score for word #word should be #expectedScore'() {
        when:
        def score = ScrabbleScore.scoreWord(word)

        then:
        score == expectedScore

        where:
        word                         | expectedScore
        'at'                         | 2
        'zoo'                        | 12
        'street'                     | 6
        'quirky'                     | 22
        'OxyphenButazone'            | 41
        'pinata'                     | 8
        'abcdefghijklmnopqrstuvwxyz' | 87
    }

}

Version data entries

134 entries across 134 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.179 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.178 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.177 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.176 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.175 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.174 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.173 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.172 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.171 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.170 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.169 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.167 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.166 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.165 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.164 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.163 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.162 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.161 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy
trackler-2.2.1.160 tracks/groovy/exercises/scrabble-score/ScrabbleScoreSpec.groovy