Sha256: 8345b16641dd03b0e87f4ebd17fe9db955227107dee6d78c6c1964a332bfc623

Contents?: true

Size: 1.83 KB

Versions: 129

Compression:

Stored size: 1.83 KB

Contents

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

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

129 entries across 129 versions & 1 rubygems

Version Path
trackler-2.2.1.78 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.77 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.76 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.75 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.74 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.73 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.72 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.71 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.70 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.69 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.68 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.67 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.66 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.65 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.64 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.63 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.62 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.61 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.60 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt
trackler-2.2.1.59 tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt