Sha256: 42af1961de6d6b9ecd25a2784e6aa425524ad9f99de1b18db8f25bf2c1aef343

Contents?: true

Size: 855 Bytes

Versions: 172

Compression:

Stored size: 855 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

172 entries across 172 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.138 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.137 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.136 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.135 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.134 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.133 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.132 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.131 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.130 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.129 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.128 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.127 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.126 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.125 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.124 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.123 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.122 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.121 tracks/pony/exercises/pascals-triangle/test.pony
trackler-2.2.1.120 tracks/pony/exercises/pascals-triangle/test.pony