Sha256: 6d825a39a85ef7c025c5dc4911fffa8a8d33268f048053315a7470c9e96e1cd1

Contents?: true

Size: 1.05 KB

Versions: 89

Compression:

Stored size: 1.05 KB

Contents

import org.junit.Test
import kotlin.test.assertEquals

class PascalsTriangleTest {

    @Test
    fun triangleWithFourRows() {
        val expectedOutput = listOf(
                listOf(1),
                listOf(1, 1),
                listOf(1, 2, 1),
                listOf(1, 3, 3, 1)
        )

        assertEquals(expectedOutput, PascalsTriangle.computeTriangle(4))
    }

    @Test
    fun triangleWithSixRows() {
        val expectedOutput = listOf(
                listOf(1),
                listOf(1, 1),
                listOf(1, 2, 1),
                listOf(1, 3, 3, 1),
                listOf(1, 4, 6, 4, 1),
                listOf(1, 5, 10, 10, 5, 1)
        )

        assertEquals(expectedOutput, PascalsTriangle.computeTriangle(6))
    }

    @Test
    fun expectEmptyTriangle() {
        val expectedOutput = emptyList<List<Int>>()

        assertEquals(expectedOutput, PascalsTriangle.computeTriangle(0))
    }

    @Test(expected = IllegalArgumentException::class)
    fun validatesNotNegativeRows() {
        PascalsTriangle.computeTriangle(-1)
    }
}

Version data entries

89 entries across 89 versions & 1 rubygems

Version Path
trackler-2.0.6.33 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.32 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.31 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.30 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.29 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.28 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.27 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.26 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.25 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.24 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.23 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.22 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.21 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.20 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.19 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.18 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.17 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.16 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.15 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt
trackler-2.0.6.14 tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt