Sha256: d18ce5f8d9481ad428ee1212542bd1956193743b6c0945125a7e90860dcb097b

Contents?: true

Size: 1.34 KB

Versions: 37

Compression:

Stored size: 1.34 KB

Contents

import org.scalatest.{Matchers, FunSuite}

/** @version 1.1.0 */
class FlattenArrayTest extends FunSuite with Matchers {

  test("no nesting") {
    FlattenArray.flatten(List(0, 1, 2)) should be(List(0, 1, 2))
  }

  test("flattens array with just integers present") {
    pending
    FlattenArray.flatten(List(1, List(2, 3, 4, 5, 6, 7), 8)) should be(
      List(1, 2, 3, 4, 5, 6, 7, 8))
  }

  test("5 level nesting") {
    pending
    FlattenArray.flatten(List(0,
                              2,
                              List(List(2, 3), 8, 100, 4, List(List(List(50)))),
                              -2)) should be(
      List(0, 2, 2, 3, 8, 100, 4, 50, -2))
  }

  test("6 level nesting") {
    pending
    FlattenArray.flatten(List(
      1,
      List(2, List(List(3)), List(4, List(List(5))), 6, 7),
      8)) should be(List(1, 2, 3, 4, 5, 6, 7, 8))
  }

  test("6 level nest list with null values") {
    pending
    FlattenArray.flatten(
      List(0,
           2,
           List(List(2, 3), 8, List(List(100)), null, List(List(null))),
           -2)) should be(List(0, 2, 2, 3, 8, 100, -2))
  }

  test("all values in nested list are null") {
    pending
    FlattenArray.flatten(
      List(null,
           List(List(List(null))),
           null,
           null,
           List(List(null, null), null),
           null)) should be(List())
  }
}

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
trackler-2.2.1.107 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.106 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.105 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.104 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.103 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.102 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.101 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.100 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.99 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.98 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.97 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.96 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.95 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.94 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.93 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.92 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.91 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.90 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.89 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala
trackler-2.2.1.88 tracks/scala/exercises/flatten-array/src/test/scala/FlattenArrayTest.scala