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.39 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.38 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.37 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.36 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.34 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.33 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.32 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.31 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.30 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.29 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.28 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.27 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.26 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.25 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.24 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.23 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.22 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.21 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.20 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.1.0.19 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala