Sha256: d6b7286a63fdb6d1d2d3e4b8b4af7028ac7ded57c4b70c799b1a35ac16b908d0

Contents?: true

Size: 1.35 KB

Versions: 86

Compression:

Stored size: 1.35 KB

Contents

require "spec"
require "../src/*"

describe "PascalsTriangle" do
  it "will return the first 0 row(s)" do
    PascalsTriangle.rows(0).should eq([] of Int32)
  end

  pending "will return the first 1 row(s)" do
    PascalsTriangle.rows(1).should eq([[1]])
  end

  pending "will return the first 2 row(s)" do
    PascalsTriangle.rows(2).should eq([[1], [1, 1]])
  end

  pending "will return the first 3 row(s)" do
    PascalsTriangle.rows(3).should eq([[1], [1, 1], [1, 2, 1]])
  end

  pending "will return the first 4 row(s)" do
    PascalsTriangle.rows(4).should eq([[1], [1, 1], [1, 2, 1], [1, 3, 3, 1]])
  end

  pending "will return the first 5 row(s)" do
    PascalsTriangle.rows(5).should eq([[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1]])
  end

  pending "will return the first 6 row(s)" do
    PascalsTriangle.rows(6).should eq([[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1], [1, 5, 10, 10, 5, 1]])
  end

  pending "will return the first 10 row(s)" do
    PascalsTriangle.rows(10).should eq([[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1], [1, 5, 10, 10, 5, 1], [1, 6, 15, 20, 15, 6, 1], [1, 7, 21, 35, 35, 21, 7, 1], [1, 8, 28, 56, 70, 56, 28, 8, 1], [1, 9, 36, 84, 126, 126, 84, 36, 9, 1]])
  end

  pending "will raise an Argument error for negative rows" do
    expect_raises(ArgumentError) do
      PascalsTriangle.rows(-1)
    end
  end
end

Version data entries

86 entries across 86 versions & 1 rubygems

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