From 3813d0b6f1300af74609694e52fcc226a18717c3 Mon Sep 17 00:00:00 2001 From: Varun Somani Date: Thu, 7 Sep 2023 01:30:18 -0700 Subject: [PATCH] Add test case for invalid non digit cc number (#1182) Adding this test case to handle case where we have non-numeric cc number along with a valid cc number. This is discovered when we filter with is_numeric() instead of !is_whitespace() all test case does pass. To handle such scenario adding this test case. --- src/exercises/day-1/luhn.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/exercises/day-1/luhn.rs b/src/exercises/day-1/luhn.rs index ce2c6ba2..5fd26ca9 100644 --- a/src/exercises/day-1/luhn.rs +++ b/src/exercises/day-1/luhn.rs @@ -51,6 +51,7 @@ fn main() { #[test] fn test_non_digit_cc_number() { assert!(!luhn("foo")); + assert!(!luhn("foo 0 0")); } #[test]