Sha256: 151b22af5ea87977a0bee65499ecee724df9535838acb6574290db079c2ac775

Contents?: true

Size: 1.71 KB

Versions: 145

Compression:

Stored size: 1.71 KB

Contents

import org.junit.Test
import org.junit.Ignore
import kotlin.test.assertFalse
import kotlin.test.assertTrue

class LuhnTest {


    @Test
    fun singleDigitStringsCannotBeValid() {
        assertFalse(Luhn.isValid("1"))
    }

    @Ignore
    @Test
    fun singleZeroIsInvalid() {
        assertFalse(Luhn.isValid("0"))
    }

    @Ignore
    @Test
    fun simpleValidSINThatRemainsValidIfReversed() {
        assertTrue(Luhn.isValid("059"))
        assertTrue(Luhn.isValid("950"))
    }

    @Ignore
    @Test
    fun simpleValidSINThatBecomesInvalidIfReversed() {
        assertTrue(Luhn.isValid("59"))
        assertFalse(Luhn.isValid("95"))
    }

    @Ignore
    @Test
    fun validCanadianSIN() {
        assertTrue(Luhn.isValid("055 444 285"))
    }

    @Ignore
    @Test
    fun invalidCanadianSIN() {
        assertFalse(Luhn.isValid("055 444 286"))
    }

    @Ignore
    @Test
    fun invalidCreditCard() {
        assertFalse(Luhn.isValid("8273 1232 7352 0569"))
    }

    @Ignore
    @Test
    fun validStringsWithNonDigitIncludedBecomeInvalid() {
        assertFalse(Luhn.isValid("055a 444 285"))
    }

    @Ignore
    @Test
    fun validStringsWithPunctuationIncludedBecomeInvalid() {
        assertFalse(Luhn.isValid("055-444-285"))
    }

    @Ignore
    @Test
    fun validStringsWithSymbolsIncludedBecomeInvalid() {
        assertFalse(Luhn.isValid("055£ 444$ 285"))
    }

    @Ignore
    @Test
    fun singleZeroWithSpaceIsInvalid() {
        assertFalse(Luhn.isValid(" 0"))
    }

    @Ignore
    @Test
    fun moreThanSingleZeroIsValid() {
        assertTrue(Luhn.isValid("0000 0"))
    }

    @Ignore
    @Test
    fun inputDigit9IsCorrectlyConvertedToOutputDigit9() {
        assertTrue(Luhn.isValid("091"))
    }

}

Version data entries

145 entries across 145 versions & 1 rubygems

Version Path
trackler-2.2.1.32 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.31 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.30 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.29 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.28 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.27 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.26 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.25 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.24 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.23 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.22 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.21 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.20 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.19 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.18 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.17 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.16 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.15 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.14 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.13 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt