Sha256: 6ce4d995ae4f90cd1dc740de54c448627f8002c0f56436c9ff2c8a9702e0ade2

Contents?: true

Size: 1013 Bytes

Versions: 69

Compression:

Stored size: 1013 Bytes

Contents

if !System.get_env("EXERCISM_TEST_EXAMPLES") do
  Code.load_file("flatten_array.exs", __DIR__)
end

ExUnit.start()
ExUnit.configure(exclude: :pending, trace: true)

defmodule FlattenArrayTest do
  use ExUnit.Case

  test "returns original list if there is nothing to flatten" do
    assert FlattenArray.flatten([1, 2, 3]) == [1, 2, 3]
  end

  @tag :pending
  test "flattens an empty nested list" do
    assert FlattenArray.flatten([[]]) == []
  end

  @tag :pending
  test "flattens a nested list" do
    assert FlattenArray.flatten([1, [2, [3], 4], 5, [6, [7, 8]]]) == [1, 2, 3, 4, 5, 6, 7, 8]
  end

  @tag :pending
  test "removes nil from list" do
    assert FlattenArray.flatten([1, nil, 2]) == [1, 2]
  end

  @tag :pending
  test "removes nil from a nested list" do
    assert FlattenArray.flatten([1, [2, nil, 4], 5]) == [1, 2, 4, 5]
  end

  @tag :pending
  test "returns an empty list if all values in nested list are nil" do
    assert FlattenArray.flatten([nil, [nil], [nil, [nil]]]) == []
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.179 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.178 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.177 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.176 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.175 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.174 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.173 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.172 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.171 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.170 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.169 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.167 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.166 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.165 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.164 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.163 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.162 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.161 tracks/elixir/exercises/flatten-array/flatten_array_test.exs
trackler-2.2.1.160 tracks/elixir/exercises/flatten-array/flatten_array_test.exs