Sha256: 29ec5793040a636521ac861ce8ff40967a4af1af8d8466e931829b72ef30db1e

Contents?: true

Size: 1.08 KB

Versions: 69

Compression:

Stored size: 1.08 KB

Contents

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

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

defmodule PascalsTriangleTest do
  use ExUnit.Case

  # @tag pending
  test "one row" do
    assert PascalsTriangle.rows(1) == [[1]]
  end

  @tag :pending
  test "two rows" do
    assert PascalsTriangle.rows(2) == [[1], [1, 1]]
  end

  @tag :pending
  test "three rows" do
    assert PascalsTriangle.rows(3) == [[1], [1, 1], [1, 2, 1]]
  end

  @tag :pending
  test "fourth row" do
    assert List.last(PascalsTriangle.rows(4)) == [1, 3, 3, 1]
  end

  @tag :pending
  test "fifth row" do
    assert List.last(PascalsTriangle.rows(5)) == [1, 4, 6, 4, 1]
  end

  @tag :pending
  test "twentieth row" do
    expected = [
      1,
      19,
      171,
      969,
      3876,
      11_628,
      27_132,
      50_388,
      75_582,
      92_378,
      92_378,
      75_582,
      50_388,
      27_132,
      11_628,
      3876,
      969,
      171,
      19,
      1
    ]

    assert List.last(PascalsTriangle.rows(20)) == expected
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

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