Sha256: 79f7fcd09b69e51027d41267ffa6b4eb70087d72b373714d48fbc5de73d09772

Contents?: true

Size: 622 Bytes

Versions: 168

Compression:

Stored size: 622 Bytes

Contents

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

class NthPrimeSpec extends Specification {

    def 'can calculate the first prime'() {
        expect: NthPrime.nth(1) == 2
    }

    def 'can calculate the second prime'() {
        expect: NthPrime.nth(2) == 3
    }

    def 'can calculate the sixth prime'() {
        expect: NthPrime.nth(6) == 13
    }

    def 'can calculate a big prime'() {
        expect: NthPrime.nth(10001) == 104743
    }

    def 'throws exception when asked for the zeroth prime'() {
        when: NthPrime.nth(0)
        then: thrown(ArithmeticException)
    }

}

Version data entries

168 entries across 168 versions & 1 rubygems

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