Sha256: c0f0f156993206c1d10f9ba282c43dfd4607ef16e3ac5aec30d7a4becc383020

Contents?: true

Size: 1.18 KB

Versions: 305

Compression:

Stored size: 1.18 KB

Contents

extern crate luhn;

use luhn::*;

#[test]
fn single_digit_string_is_invalid() {
    assert!(!is_valid("1"));
}

#[test]
#[ignore]
fn single_zero_string_is_invalid() {
    assert!(!is_valid("0"));
}

#[test]
#[ignore]
fn simple_valid_sin() {
    assert!(is_valid(" 5 9 "));
}

#[test]
#[ignore]
fn valid_canadian_sin_is_valid() {
    assert!(is_valid("046 454 286"));
}

#[test]
#[ignore]
fn invalid_canadian_sin_is_invalid() {
    assert!(!is_valid("046 454 287"));
}

#[test]
#[ignore]
fn invalid_credit_card_is_invalid() {
    assert!(!is_valid("8273 1232 7352 0569"));
}

#[test]
#[ignore]
fn strings_that_contain_non_digits_are_invalid() {
    assert!(!is_valid("046a 454 286"));
}

#[test]
#[ignore]
fn punctuation_is_invalid() {
    assert!(!is_valid("055-444-285"));
}

#[test]
#[ignore]
fn symbols_are_invalid() {
    assert!(!is_valid("055£ 444$ 285"));
}

#[test]
#[ignore]
fn single_digit_with_space_is_invalid() {
    assert!(!is_valid(" 0"));
}

#[test]
#[ignore]
fn lots_of_zeros_are_valid() {
    assert!(is_valid(" 00000"));
}

#[test]
#[ignore]
fn another_valid_sin() {
    assert!(is_valid("055 444 285"));
}

#[test]
#[ignore]
fn nine_doubled_is_nine() {
    assert!(is_valid("091"));
}

Version data entries

305 entries across 305 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.179 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.178 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.177 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.176 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.175 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.174 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.173 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.172 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.171 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.170 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.169 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.167 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.166 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.165 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.164 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.163 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.162 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.161 tracks/rust/exercises/luhn/tests/luhn.rs
trackler-2.2.1.160 tracks/rust/exercises/luhn/tests/luhn.rs