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.2.0.3 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.0.2 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.0.1 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.0.0 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.55 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.54 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.53 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.52 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.51 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.50 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.49 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.48 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.47 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.46 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.45 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.44 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.43 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.42 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.41 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.40 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala