Sha256: c8a22b3825890be36b392fd565190e92b477236693df667524a01be6bbd60c76

Contents?: true

Size: 852 Bytes

Versions: 25

Compression:

Stored size: 852 Bytes

Contents

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

class RomanSpec extends Specification {

    // register metaclass on Integers
    def setup() { new Roman() }

    @Unroll
    def "can convert arabic #arabic to roman #roman"() {
        expect:
            arabic.roman == roman
        where:
            arabic | roman
            1      | 'I'
            2      | 'II'
            3      | 'III'
            4      | 'IV'
            5      | 'V'
            6      | 'VI'
            9      | 'IX'
            27     | 'XXVII'
            48     | 'XLVIII'
            59     | 'LIX'
            93     | 'XCIII'
            141    | 'CXLI'
            163    | 'CLXIII'
            402    | 'CDII'
            575    | 'DLXXV'
            911    | 'CMXI'
            1024   | 'MXXIV'
            3000   | 'MMM'
    }

}

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
trackler-2.2.1.10 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.1.9 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.1.8 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.1.7 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.1.6 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.1.5 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.1.4 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.1.3 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.1.2 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.1.1 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.1.0 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.0.6 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.0.5 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.0.4 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.0.3 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.0.2 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.0.1 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.2.0.0 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.1.0.55 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy
trackler-2.1.0.54 tracks/groovy/exercises/roman-numerals/RomanSpec.groovy