Sha256: 5d200c4b8eb4e40e8889e1c15f5972f2e244ddb5f4a4b2ca8489ddd259bcd0ff

Contents?: true

Size: 1.44 KB

Versions: 189

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 "largets 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

189 entries across 189 versions & 1 rubygems

Version Path
trackler-2.0.8.29 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.28 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.27 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.26 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.24 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.23 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.22 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.21 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.20 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.19 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.18 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.17 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.16 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.15 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.14 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.13 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.12 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.11 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.10 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee
trackler-2.0.8.9 tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee