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.1.36 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.35 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.34 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.33 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.32 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.31 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.30 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.29 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.28 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.27 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.26 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.25 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.24 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.23 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.22 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.21 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.20 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.19 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.18 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala
trackler-2.2.1.17 tracks/scala/exercises/palindrome-products/src/test/scala/PalindromeProductsTest.scala