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.12 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.11 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.10 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.9 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.8 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.7 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.6 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.5 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.4 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.3 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.2 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.1 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.0 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.0.6 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.0.5 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.0.4 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.0.3 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.0.2 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.0.1 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.0.0 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt