Sha256: 1b8d77ca2cd0c289ce4f7794f87e62f6235721bd9196a35273d2c7ffc8ba5f6d

Contents?: true

Size: 1.85 KB

Versions: 59

Compression:

Stored size: 1.85 KB

Contents

import org.junit.Ignore
import org.junit.Test
import java.util.Collections.emptySet
import kotlin.test.assertEquals

/*
 * version: 1.1.0
 */
class MatrixTest {

    @Test
    fun testCanIdentifySingleSaddlePoint() {
        val matrix = Matrix(listOf(
            listOf(9, 8, 7),
            listOf(5, 3, 2),
            listOf(6, 6, 7)
        ))

        val expectedSaddlePoints = setOf(MatrixCoordinate(1, 0))

        assertEquals(expectedSaddlePoints, matrix.saddlePoints)
    }

    @Ignore
    @Test
    fun testCanIdentifyThatEmptyMatrixHasNoSaddlePoints() {
        val matrix = Matrix(listOf(emptyList()))

        val expectedSaddlePoints = emptySet<MatrixCoordinate>()

        assertEquals(expectedSaddlePoints, matrix.saddlePoints)
    }

    @Ignore
    @Test
    fun testCanIdentifyLackOfSaddlePointsWhenThereAreNone() {
        val matrix = Matrix(listOf(
            listOf(1, 2, 3),
            listOf(3, 1, 2),
            listOf(2, 3, 1)
        ))

        val expectedSaddlePoints = emptySet<MatrixCoordinate>()

        assertEquals(expectedSaddlePoints, matrix.saddlePoints)
    }

    @Ignore
    @Test
    fun testCanIdentifyMultipleSaddlePoints() {
        val matrix = Matrix(listOf(
            listOf(4, 5, 4),
            listOf(3, 5, 5),
            listOf(1, 5, 4)
        ))

        val expectedSaddlePoints = setOf(
            MatrixCoordinate(0, 1),
            MatrixCoordinate(1, 1),
            MatrixCoordinate(2, 1)
        )

        assertEquals(expectedSaddlePoints, matrix.saddlePoints)
    }

    @Ignore
    @Test
    fun testCanIdentifySaddlePointInBottomRightCorner() {
        val matrix = Matrix(listOf(
            listOf(8, 7, 9),
            listOf(6, 7, 6),
            listOf(3, 2, 5)
        ))

        val expectedSaddlePoints = setOf(MatrixCoordinate(2, 2))

        assertEquals(expectedSaddlePoints, matrix.saddlePoints)
    }

}

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
trackler-2.2.1.29 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.28 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.27 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.26 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.25 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.24 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.23 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.22 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.21 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.20 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.19 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.18 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.17 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.16 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.15 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.14 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.13 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.12 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.11 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.10 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt