Sha256: 7a4d53118e28491a49828fcbcec9db433d28390d3b820bd51fb552d3cebb9de2

Contents?: true

Size: 1003 Bytes

Versions: 326

Compression:

Stored size: 1003 Bytes

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

326 entries across 326 versions & 1 rubygems

Version Path
trackler-2.2.1.109 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.108 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.107 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.106 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.105 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.104 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.103 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.102 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.101 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.100 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.99 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.98 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.97 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.96 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.95 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.94 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.93 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.92 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.91 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs
trackler-2.2.1.90 tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs