isbn_test 16-Sep-2015 21:48:51 ISBN_TEST MATLAB version Test the ISBN library. 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_IS_ISBN_DIGIT_TEST CH_IS_ISBN_DIGIT is TRUE if a character represents an ISBN digit. C CH_IS_ISBN_DIGIT(C) "0" 1 "1" 1 "2" 1 "3" 1 "4" 1 "5" 1 "6" 1 "7" 1 "8" 1 "9" 1 "X" 1 "x" 1 "Y" 0 "?" 0 "*" 0 " " 0 CH_TO_DIGIT_TEST CH_TO_DIGIT: 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 I4_TO_ISBN_DIGIT_TEST I4_TO_ISBN_DIGIT converts digits 0 to 10 to an ISBN digit. 0 48 1 49 2 50 3 51 4 52 5 53 6 54 7 55 8 56 9 57 10 88 I4VEC_PRINT_TEST I4VEC_PRINT prints an I4VEC The I4VEC: 1: 91 2: 92 3: 93 4: 94 ISBN_CHECK_DIGIT_CALCULATE_TEST ISBN_CHECK_DIGIT_CALCULATE calculates the 10-th digit (the check digit) of a 10-digit ISBN. ISBN check digit of "0-306-40615-2" is "2", expecting "2" ISBN check digit of "0 8493 9640" is "9", expecting "9" ISBN check digit of "158488059" is "7", expecting "7" ISBN_DIGIT_TO_I4_TEST ISBN_DIGIT_TO_I4 converts an ISBN digit to an I4 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 X 10 ISBN_IS_VALID_TEST ISBN_IS_VALID reports whether a ISBN is valid. Validity of "0-306-40615-2" is 1, expecting 1 Validity of "0-326-40615-2" is 0, expecting 0 Validity of "0 8493 9640 9" is 1, expecting 1 Validity of "0 8493 9640 3" is 0, expecting 0 Validity of "0-3870-9654-X" is 1, expecting 1 Validity of "0-201-38597-x" is 1, expecting 1 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 S_TO_ISBN_DIGITS_TEST S_TO_ISBN_DIGITS: string -> ISBN digit vector Test string: "34E9X-70.6" Extracted 5 digits: 1: 3 2: 4 3: 9 4: 10 5: 7 Test string: "34E9X-70.6" Extracted 7 digits: 1: 3 2: 4 3: 9 4: 10 5: 7 6: 0 7: 6 ISBN_TEST Normal end of execution. 16-Sep-2015 21:48:51 diary off