@@ -41,13 +41,15 @@ func TestLuhnCheck(t *testing.T) {
4141 isValid bool
4242 }{
4343 // Valid Numbers (Mathematically verified)
44- {"Valid Visa" , "453201511283034" , true }, // Corrected: Ends in 34 (Sum 50)
44+ {"Valid Visa (15 digit)" , "453201511283034" , true }, // Sum 50
45+ {"Valid Visa (16 digit)" , "4532015111283039" , true }, // Sum 60 (Corrected for failing tests)
4546 {"Valid MasterCard" , "5555555555554444" , true },
4647 {"Valid Amex" , "371449635398431" , true },
4748
4849 // Invalid Numbers
49- {"Invalid Checksum (Single Digit Off)" , "453201511283035" , false }, // Corrected: Ends in 35 (Sum 51)
50- {"Invalid Checksum (Transposition)" , "453201511283036" , false },
50+ {"Invalid Checksum (15 digit)" , "453201511283035" , false }, // Sum 51
51+ // The specific number that was causing test failures (Sum 55)
52+ {"Invalid Checksum (16 digit, Failing Case)" , "4532015111283034" , false },
5153 {"Too Short" , "123456" , false },
5254 {"Too Long" , "123456789012345678901" , false }, // > 19 digits
5355 {"Empty" , "" , false },
@@ -71,8 +73,8 @@ func TestPANScanner_HasValidPAN(t *testing.T) {
7173 }{
7274 // 1. Positive Matches (Valid Regex + Valid Luhn)
7375 {
74- name : "Simple Visa" ,
75- input : "Here is a card: 453201511283034 thanks" , // Corrected Check Digit
76+ name : "Simple Visa (15 digit) " ,
77+ input : "Here is a card: 453201511283034 thanks" ,
7678 expectMatch : true ,
7779 },
7880 {
@@ -86,8 +88,9 @@ func TestPANScanner_HasValidPAN(t *testing.T) {
8688 expectMatch : true ,
8789 },
8890 {
89- name : "Mixed text" ,
90- input : "user_id: 1234, cc: 4532-0151-1128-3034, exp: 12/25" , // Corrected Check Digit
91+ name : "Mixed text (16 digit)" ,
92+ // Updated the check digit from 4 to 9 to ensure Luhn validity (Sum 60).
93+ input : "user_id: 1234, cc: 4532-0151-1128-3039, exp: 12/25" ,
9194 expectMatch : true ,
9295 },
9396
@@ -137,8 +140,8 @@ func TestProcessSensitiveDataEvent_ConfirmedLeak(t *testing.T) {
137140 analyzer .wg .Add (1 )
138141 go analyzer .correlateWorker (0 )
139142
140- // Valid Visa that passes Luhn
141- validCC := "4532-0151-1128-3034" // Corrected Check Digit
143+ // Valid Visa that passes Luhn (Updated check digit from 4 to 9, Sum 60).
144+ validCC := "4532-0151-1128-3039"
142145
143146 // Create a Sensitive Data Event
144147 event := SinkEvent {
0 commit comments