Sha256: 3e490d177d82e80dd88753ee511bb97cf35abdec331dddad62f9fd87bd0abb05

Contents?: true

Size: 1.02 KB

Versions: 209

Compression:

Stored size: 1.02 KB

Contents

import org.scalatest.{Matchers, FlatSpec}

class PascalsTriangleTest extends FlatSpec with Matchers {
  it should "handle 1 row" in {
    PascalsTriangle.triangle(1) should be (List(List(1)))
  }

  it should "handle 2 rows" in {
    pending
    PascalsTriangle.triangle(2) should be (List(List(1), List(1, 1)))
  }

  it should "handle 3 rows" in {
    pending
    PascalsTriangle.triangle(3) should be (List(List(1), List(1, 1), List(1, 2, 1)))
  }

  it should "handle 4 rows" in {
    pending
    PascalsTriangle.triangle(4) should be (List(List(1), List(1, 1),
      List(1, 2, 1), List(1, 3, 3, 1)))
  }

  it should "handle 5 rows" in {
    pending
    PascalsTriangle.triangle(5) should be (List(List(1), List(1, 1),
      List(1, 2, 1), List(1, 3, 3, 1), List(1, 4, 6, 4, 1)))
  }

  it should "handle 20 rows" in {
    pending
    PascalsTriangle.triangle(20).takeRight(1).head should be (List(1, 19,
      171, 969, 3876, 11628, 27132, 50388, 75582, 92378,
      92378, 75582, 50388, 27132, 11628, 3876, 969, 171,
      19, 1))
  }
}

Version data entries

209 entries across 209 versions & 1 rubygems

Version Path
trackler-2.2.1.3 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.2.1.2 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.2.1.1 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.2.1.0 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.2.0.6 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.2.0.5 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.2.0.4 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.2.0.3 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.2.0.2 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.2.0.1 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.2.0.0 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.1.0.55 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.1.0.54 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.1.0.53 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.1.0.52 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.1.0.51 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.1.0.50 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.1.0.49 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.1.0.48 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala
trackler-2.1.0.47 tracks/scala/exercises/pascals-triangle/src/test/scala/PascalsTriangleTest.scala