Sha256: e5c2768a6312bc1d78dfa25355628298e1d49f3502ae636ca398f741495962d5

Contents?: true

Size: 1.24 KB

Versions: 89

Compression:

Stored size: 1.24 KB

Contents

import org.assertj.core.api.Assertions.assertThat
import org.junit.Test

class ChangeTest {

    @Test
    fun singleCoinChange() {
        assertThat(Change(setOf(1, 5, 10, 25, 100)).issue(25)).containsExactly(25)
    }

    @Test
    fun multipleCoinChange() {
        assertThat(Change(setOf(1, 5, 10, 25, 100)).issue(15)).containsExactly(5, 10)
    }

    @Test
    fun changeWithLilliputianCoins() {
        assertThat(Change(setOf(1, 4, 15, 20, 50)).issue(23)).containsExactly(4, 4, 15)
    }

    @Test
    fun changeWithLowerElboniaCoins() {
        assertThat(Change(setOf(1, 5, 10, 21, 25)).issue(63)).containsExactly(21,21,21)
    }

    @Test
    fun largeTargetValues() {
        assertThat(Change(setOf(1, 2, 5, 10, 20, 50, 100)).issue(999)).containsExactly(2, 2, 5, 20, 20, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100)
    }

    @Test
    fun noCoinsMake0Change() {
        assertThat(Change(setOf(1, 5, 10, 21, 25)).issue(0)).isEmpty()
    }

    @Test(expected = IllegalArgumentException::class)
    fun errorTestingForChangeSmallerThanTheSmallestCoin() {
        Change(setOf(5, 10)).issue(3)
    }

    @Test(expected = IllegalArgumentException::class)
    fun cannotFindNegativeChangeValues() {
        Change(setOf(1, 2, 5)).issue(-5)
    }
}

Version data entries

89 entries across 89 versions & 1 rubygems

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