Sha256: 69137690fdde6e5a40632a6a9956dc49c6c23346c346131013734f1c6d535850

Contents?: true

Size: 848 Bytes

Versions: 70

Compression:

Stored size: 848 Bytes

Contents

use "collections"
use "ponytest"

actor Main is TestList
  new create(env: Env) =>
    PonyTest(env, this)

  fun tag tests(test: PonyTest) =>
    test(_TestPascalsTriangle)

class iso _TestPascalsTriangle is UnitTest
  fun name(): String => "pascals-triangle"

  fun apply(h: TestHelper) ? =>
    assert_rows_eq(h, 0, Array[Array[USize]])
    assert_rows_eq(h, 1, [[1]])
    assert_rows_eq(h, 2, [[1]; [1; 1]])
    assert_rows_eq(h, 3, [[1]; [1; 1]; [1; 2; 1]])
    assert_rows_eq(h, 4, [[1]; [1; 1]; [1; 2; 1]; [1; 3; 3; 1]])

  fun assert_rows_eq(
    h: TestHelper,
    count: USize,
    expected: Array[Array[USize]],
    loc: SourceLoc = __loc)
  ? =>
    let t = PascalsTriangle.rows(count)
    h.assert_eq[USize](t.size(), expected.size())
    for i in Range(0, expected.size()) do
      h.assert_array_eq[USize](expected(i), t(i))
    end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
trackler-2.1.0.28 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.27 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.26 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.25 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.24 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.23 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.22 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.21 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.20 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.19 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.18 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.17 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.16 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.15 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.14 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.13 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.12 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.11 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.10 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.1.0.9 tracks/pony/exercises/pascals-triangle/test.pony