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.52 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.51 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.50 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.49 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.48 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.47 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.46 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.45 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.44 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.43 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.42 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.41 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.40 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.39 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.38 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.37 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.36 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.35 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.34 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt
trackler-2.2.1.33 tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt