07-Jan-2022 22:46:28 luhn_test(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Test luhn(). ch_is_digit_test(): ch_is_digit() is TRUE if a character represents a digit. C CH_IS_DIGIT(C) "0" 1 "1" 1 "2" 1 "3" 1 "4" 1 "5" 1 "6" 1 "7" 1 "8" 1 "9" 1 "X" 0 "?" 0 " " 0 ch_to_digit_test(): ch_to_digit_test() converts character -> decimal digit 1 "0" 0 2 "1" 1 3 "2" 2 4 "3" 3 5 "4" 4 6 "5" 5 7 "6" 6 8 "7" 7 9 "8" 8 10 "9" 9 11 "X" -1 12 "?" -1 13 " " -1 s_digits_count_test(): S_DIGITS_COUNT counts the digits in a string. We count 7 digits in "34E94-70.6" We count 0 digits in "Not a one!" We count 3 digits in "%8*k >>>> # SEVEN-0.3" s_to_digits_test(): S_TO_DIGITS: string -> digit vector Test string: "34E94-70.6" Extracted 5 digits: 1: 3 2: 4 3: 9 4: 4 5: 7 Test string: "34E94-70.6" Extracted 7 digits: 1: 3 2: 4 3: 9 4: 4 5: 7 6: 0 7: 6 luhn_check_digit_calculate_test(): LUHN_CHECK_DIGIT_CALCULATE calculates the check digit for a string of digits Check digit of "7992739871" is 3, expecting 3 Check digit of "9876234510" is 0, expecting 0 Check digit of "246897531" is 9, expecting 9 Check digit of "135798642" is 9, expecting 9 luhn_is_valid_test(): LUHN_IS_VALID determines whether a string with final Luhn check digit is valid. Validity of "79927398713" is 1, expecting 1 Validity of "79924398713" is 0, expecting 0 Validity of "79927398711" is 0, expecting 0 luhn_test(): Normal end of execution. 07-Jan-2022 22:46:28