Sha256: a9025e40dc65136b2d1229db1045f23e6f6559135e4246fcd825f08bb8cf00d9

Contents?: true

Size: 1.8 KB

Versions: 220

Compression:

Stored size: 1.8 KB

Contents

import org.scalatest.{Matchers, FlatSpec}

class PalindromeProductsTest extends FlatSpec with Matchers {

  it should "find smallest palindrome from a single digit factors" in {
    val (value, factors) = PalindromeProducts(1, 9).smallest
    value should be (1)
    factors should be (Set((1, 1)))
  }

  it should "find largest palindrome from a single digit factors" in {
    pending
    val (value, factors) = PalindromeProducts(0, 9).largest
    value should be (9)
    factors should be (Set((1, 9), (3, 3)))
  }

  it should "find smallest palindrome from a double digit factors" in {
    pending
    val (value, factors) = PalindromeProducts(10, 99).smallest
    value should be (121)
    factors should be (Set((11, 11)))
  }

  it should "find largest palindrome from a double digit factors" in {
    pending
    val (value, factors) = PalindromeProducts(10, 99).largest
    value should be (9009)
    factors should be (Set((91, 99)))
  }

  it should "find smallest palindrome from a triple digit factors" in {
    pending
    val (value, factors) = PalindromeProducts(100, 999).smallest
    value should be (10201)
    factors should be (Set((101, 101)))
  }

  it should "find largest palindrome from a triple digit factors" in {
    pending
    val (value, factors) = PalindromeProducts(100, 999).largest
    value should be (906609)
    factors should be (Set((913, 993)))
  }

  it should "find smallest palindrome from a four digit factors" in {
    pending
    val (value, factors) = PalindromeProducts(1000, 9999).smallest
    value should be (1002001)
    factors should be (Set((1001, 1001)))
  }

  it should "find largest palindrome from a four digit factors" in {
    pending
    val (value, factors) = PalindromeProducts(1000, 9999).largest
    value should be (99000099)
    factors should be (Set((9901, 9999)))
  }
}

Version data entries

220 entries across 220 versions & 1 rubygems

Version Path
trackler-2.1.0.18 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.17 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.16 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.15 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.14 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.13 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.12 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.11 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.10 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.9 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.8 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.7 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.6 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.5 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.4 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.3 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.2 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.1 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.0 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.0.8.55 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala