Sha256: 0abd9b9d9ad1575f945fb35355fc4b2fc955ab9a667023712735adf3c34747dd

Contents?: true

Size: 1.44 KB

Versions: 207

Compression:

Stored size: 1.44 KB

Contents

Palindromes = require('./palindromes')

describe "Palindrome", ->

  it "largest palindrome from single digit factors", ->
    palindromes = new Palindromes({maxFactor: 9})
    palindromes.generate()
    largest = palindromes.largest()
    expect(largest.value).toEqual(9)
    expect([[[3, 3], [1, 9]], [[1, 9], [3, 3]]]).toContain(largest.factors)

  xit "largest palindrome from double digit factors", ->
    palindromes = new Palindromes({ maxFactor: 99, minFactor: 10 })
    palindromes.generate()
    largest = palindromes.largest()
    expect(largest.value).toEqual(9009)
    expect(largest.factors).toEqual([[91, 99]])

  xit "smallest palindrome from double digit factors", ->
    palindromes = new Palindromes({ maxFactor: 99, minFactor: 10 })
    palindromes.generate()
    smallest = palindromes.smallest()
    expect(smallest.value).toEqual(121)
    expect(smallest.factors).toEqual([[11, 11]])

  xit "largest palindrome from triple digit factors", ->
    palindromes = new Palindromes({ maxFactor: 999, minFactor: 100 })
    palindromes.generate()
    largest = palindromes.largest()
    expect(largest.value).toEqual(906609)
    expect(largest.factors).toEqual([[913, 993]])

  xit "smallest palindrome from triple digit factors", ->
    palindromes = new Palindromes({ maxFactor: 999, minFactor: 100 })
    palindromes.generate()
    smallest = palindromes.smallest()
    expect(smallest.value).toEqual(10201)
    expect(smallest.factors).toEqual([[101, 101]])

Version data entries

207 entries across 207 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.179 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.178 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.177 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.176 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.175 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.174 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.173 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.172 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.171 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.170 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.169 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.167 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.166 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.165 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.164 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.163 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.162 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.161 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.2.1.160 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee