Sun Aug 6 09:45:55 2023 chrpak_test(): Python version:3.8.10 Test chrpak(). ch_cap_test(): ch_cap() uppercases a character. C ch_cap(C) F F f F 1 1 b B & & ch_is_digit_test(): ch_is_digit() is TRUE if a character is a decimal digit. 0 "0" True 1 "1" True 2 "2" True 3 "3" True 4 "4" True 5 "5" True 6 "6" True 7 "7" True 8 "8" True 9 "9" True 10 "X" False 11 "?" False 12 " " False ch_is_isbn_digit_test() ch_is_isbn_digit() is TRUE if a character is an ISBN digit. "0" True "1" True "2" True "3" True "4" True "5" True "6" True "7" True "8" True "9" True "X" True "x" True "Y" False "*" False "?" False " " False ch_to_digit_test(): ch_to_digit(): character -> decimal digit 0 "0" 0 1 "1" 1 2 "2" 2 3 "3" 3 4 "4" 4 5 "5" 5 6 "6" 6 7 "7" 7 8 "8" 8 9 "9" 9 10 "X" -1 11 "?" -1 12 " " -1 ch_to_rot13_test(): ch_to_rot13() "encodes" characters using ROT13 (and digits using ROT5). A second application of the function returns the original character. CH : ABCDEFGHIJKLMNOPQRSTUVWXYZ ROT13(CH) : NOPQRSTUVWXYZABCDEFGHIJKLM ROT13(ROT13(CH)): ABCDEFGHIJKLMNOPQRSTUVWXYZ CH : CH_TO_ROT13 "encodes" characters using ROT13 ROT13(CH) : PU_GB_EBG68 "rapbqrf" punenpgref hfvat EBG68 ROT13(ROT13(CH)): CH_TO_ROT13 "encodes" characters using ROT13 chvec_lt_test(): chvec_lt(c1,c2) is TRUE if c1 < c2 for character strings c1 and c2. C1 C2 C1 character. -2 "*" -1 -1 "*" -1 0 "0" 0 1 "1" 1 2 "2" 2 3 "3" 3 4 "4" 4 5 "5" 5 6 "6" 6 7 "7" 7 8 "8" 8 9 "9" 9 10 "*" -1 11 "*" -1 digits_decimal_to_r8_test(): digits_decimal_to_r8() converts base 10 digits of a number into a real value; Given decimal digits: [1 2 0 3 4] and "decimal place" p = -2 corresponding value is r8 = 0.012034000000000001 Given decimal digits: [9 8 7 6 5 4 3] and "decimal place" p = 3 corresponding value is r8 = 9876.543000000001 Given decimal digits: [3 1 4 1 5 9 2 6 5] and "decimal place" p = 0 corresponding value is r8 = 3.14159265 digits_sexagesimal_print_test(): digits_sexagesimal_print() prints a real number as a sexagesimal quantity; Sexagesimal digit vector: [11 12 0 14 15] p = -5: 00.00,00,00,00,11,12,00,14,15 p = -4: 00.00,00,00,11,12,00,14,15 p = -3: 00.00,00,11,12,00,14,15 p = -2: 00.00,11,12,00,14,15 p = -1: 00.11,12,00,14,15 p = 0: 11.12,00,14,15 p = 1: 11,12.00,14,15 p = 2: 11,12,00.14,15 p = 3: 11,12,00,14.15 p = 4: 11,12,00,14,15. p = 5: 11,12,00,14,15,00. digits_sexagesimal_to_r8_test(): digits_sexagesimal_to_r8() converts base 60 digits of a number into a real value; Given sexagesimal digits: [ 4 37 46 40] and sexagesimal "decimal place" p = 3 corresponding value is r8 = 1000000.0 Given sexagesimal digits: [ 3 8 29 44 0 47 25] and sexagesimal "decimal place" p = 0 corresponding value is r8 = 3.141592653570816 Given sexagesimal digits: [ 1 24 51 10 7 46 6 4] and sexagesimal "decimal place" p = 0 corresponding value is r8 = 1.4142135623728282 hex_digit_to_i4_test(): hex_digit_to_i4() converts hex_digit -> integer Hex -> I4 -> Hex " " 0 "0" "0" 0 "0" "1" 1 "1" "2" 2 "2" "3" 3 "3" "4" 4 "4" "5" 5 "5" "6" 6 "6" "7" 7 "7" "8" 8 "8" "9" 9 "9" "a" 10 "A" "b" 11 "B" "c" 12 "C" "d" 13 "D" "e" 14 "E" "f" 15 "F" "A" 10 "A" "B" 11 "B" "C" 12 "C" "D" 13 "D" "E" 14 "E" "F" 15 "F" "?" -1 "?" i4_length_test() i4_length() computes the "length" of an integer. I4 Length 0 1 1 1 -1 2 140 3 -1952 5 123456 6 i4_to_hex_digit_test(): i4_to_hex_digit() converts integer -> hex digit I4 Hex I4 0 "0" 0 1 "1" 1 2 "2" 2 3 "3" 3 4 "4" 4 5 "5" 5 6 "6" 6 7 "7" 7 8 "8" 8 9 "9" 9 10 "A" 10 11 "B" 11 12 "C" 12 13 "D" 13 14 "E" 14 15 "F" 15 i4_to_month_abb_test(): i4_to_month_abb() returns an abbreviated month name. I4 Month abb -1 "?" 0 "Jan" 1 "Feb" 2 "Mar" 3 "Apr" 4 "May" 5 "Jun" 6 "Jul" 7 "Aug" 8 "Sep" 9 "Oct" 10 "Nov" 11 "Dec" 12 "?" i4_to_month_name_test(): i4_to_month_name() returns a month name. I4 Month name -1 "?" 0 "January" 1 "February" 2 "March" 3 "April" 4 "May" 5 "June" 6 "July" 7 "August" 8 "September" 9 "October" 10 "November" 11 "December" 12 "?" i4_to_isbn_digit_test() i4_to_isbn_digit() converts digits 0 to 10 to an ISBN digit. 0 "0" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8" 9 "9" 10 "X" i4vec_print_test(): i4vec_print() prints an I4VEC. Here is an I4VEC: 0 91 1 92 2 93 3 94 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 "x" 10 "Y" -1 "*" -1 "?" -1 " " -1 r8_to_digits_decimal_test(): r8_to_digits_decimal() converts a real number to its representation in base 10; 8 decimal digits of 0.01 0 1 0.01 1 0 0.001 2 0 0.0001 3 0 1e-05 4 0 1e-06 5 0 1e-07 6 0 1e-08 7 0 1e-09 8 decimal digits of 1.4142135623730951 0 1 1 1 4 0.1 2 1 0.01 3 4 0.001 4 2 0.0001 5 1 1e-05 6 3 1e-06 7 5 1e-07 8 decimal digits of 3.141592653589793 0 3 1 1 1 0.1 2 4 0.01 3 1 0.001 4 5 0.0001 5 9 1e-05 6 2 1e-06 7 6 1e-07 8 decimal digits of 1000000.0 0 1 1000000 1 0 100000 2 0 10000 3 0 1000 4 0 100 5 0 10 6 0 1 7 0 0.1 r8_to_digits_sexagesimal_test(): r8_to_digits_sexagesimal() converts a real number to its representation in base 60; 8 sexagesimal digits of 0.01 0 36 0.0002777777777777778 1 0 4.6296296296296296e-06 2 0 7.71604938271605e-08 3 0 1.286008230452675e-09 4 0 2.1433470507544583e-11 5 0 3.5722450845907634e-13 6 0 5.9537418076512724e-15 7 0 9.922903012752122e-17 8 sexagesimal digits of 1.4142135623730951 0 1 1 1 24 0.016666666666666666 2 51 0.0002777777777777778 3 10 4.6296296296296296e-06 4 7 7.71604938271605e-08 5 46 1.286008230452675e-09 6 6 2.1433470507544583e-11 7 4 3.5722450845907634e-13 8 sexagesimal digits of 3.141592653589793 0 3 1 1 8 0.016666666666666666 2 29 0.0002777777777777778 3 44 4.6296296296296296e-06 4 0 7.71604938271605e-08 5 47 1.286008230452675e-09 6 25 2.1433470507544583e-11 7 53 3.5722450845907634e-13 8 sexagesimal digits of 1000000.0 0 4 216000 1 37 3600 2 46 60 3 40 1 4 0 0.016666666666666666 5 0 0.0002777777777777778 6 0 4.6296296296296296e-06 7 0 7.71604938271605e-08 rat_to_s_test(): rat_to_s() converts a rational to a string. A B A/B 3 4 3/4 1 1000 1/1000 20 1 20/1 8 4 8/4 -10 7 -10/7 9 -15 9/-15 -11 -11 -11/-11 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_len_trim_test(): s_len_trim() returns the length of string to the last nonblank. LEN S_LEN_TRIM ---------S--------- 8 8 "Hi, Bob!" 23 18 " How are you? " 4 0 " " s_quote_test(): s_quote() quotes a string S1 with a mark MARK. ----S1---- ---MARK--- ----S2---- Hi, Bob! " "Hi, Bob!" De Loop LoopDeLoop s_to_caesar_test(): s_to_caesar() applies a Caesar shift cipher to a string. S2 = S_TO_CAESAR ( S1, K ), varying K. K ---------------S1---------------- ---------------S2---------------- -5 "A man, a plan, a canal: Panama!" "V hvi, v kgvi, v xvivg: Kvivhv!" -4 "A man, a plan, a canal: Panama!" "W iwj, w lhwj, w ywjwh: Lwjwiw!" -3 "A man, a plan, a canal: Panama!" "X jxk, x mixk, x zxkxi: Mxkxjx!" -2 "A man, a plan, a canal: Panama!" "Y kyl, y njyl, y aylyj: Nylyky!" -1 "A man, a plan, a canal: Panama!" "Z lzm, z okzm, z bzmzk: Ozmzlz!" 0 "A man, a plan, a canal: Panama!" "A man, a plan, a canal: Panama!" 1 "A man, a plan, a canal: Panama!" "B nbo, b qmbo, b dbobm: Qbobnb!" 2 "A man, a plan, a canal: Panama!" "C ocp, c rncp, c ecpcn: Rcpcoc!" 3 "A man, a plan, a canal: Panama!" "D pdq, d sodq, d fdqdo: Sdqdpd!" 4 "A man, a plan, a canal: Panama!" "E qer, e tper, e gerep: Tereqe!" 5 "A man, a plan, a canal: Panama!" "F rfs, f uqfs, f hfsfq: Ufsfrf!" S2 = S_TO_CAESAR ( S1, K ). S3 = S_TO_CAESAR ( S2, -K ) K ------------S1------------ ------------S2------------ ------------S3------------ -5 "The key is under the mat" "Ocz fzt dn piyzm ocz hvo" "The key is under the mat" -4 "The key is under the mat" "Pda gau eo qjzan pda iwp" "The key is under the mat" -3 "The key is under the mat" "Qeb hbv fp rkabo qeb jxq" "The key is under the mat" -2 "The key is under the mat" "Rfc icw gq slbcp rfc kyr" "The key is under the mat" -1 "The key is under the mat" "Sgd jdx hr tmcdq sgd lzs" "The key is under the mat" 0 "The key is under the mat" "The key is under the mat" "The key is under the mat" 1 "The key is under the mat" "Uif lfz jt voefs uif nbu" "The key is under the mat" 2 "The key is under the mat" "Vjg mga ku wpfgt vjg ocv" "The key is under the mat" 3 "The key is under the mat" "Wkh nhb lv xqghu wkh pdw" "The key is under the mat" 4 "The key is under the mat" "Xli oic mw yrhiv xli qex" "The key is under the mat" 5 "The key is under the mat" "Ymj pjd nx zsijw ymj rfy" "The key is under the mat" s_to_digits_test(): s_to_digits: string -> digit vector Test string: "34E94-70.6" Extracted 5 digits: 0 3 1 4 2 9 3 4 4 7 Test string: "34E94-70.6" Extracted 7 digits: 0 3 1 4 2 9 3 4 4 7 5 0 6 6 s_to_isbn_digits_test(): s_to_isbn_digits(): string -> ISBN digit vector Test string: "34E9X-70.6" Extracted 5 digits: 0 3 1 4 2 9 3 10 4 7 Test string: "34E9X-70.6" Extracted 7 digits: 0 3 1 4 2 9 3 10 4 7 5 0 6 6 s_to_rot13_test(): s_to_rot13(): applies the ROT13 cipher to a string. S2 = S_TO_ROT13 ( S1 ). -------------------S1------------------- -------------------S2------------------- "abcdefghijklmnopqrstuvwxyz" "nopqrstuvwxyzabcdefghijklm" "Cher" "Pure" "James Thurston Howell III" "Wnzrf Guhefgba Ubjryy VVV" "The bill is $1,205,837.49 so pay now!" "Gur ovyy vf $6,750,382.94 fb cnl abj!" S2 = S_TO_ROT13 ( S1 ). S3 = S_TO_ROT13 ( S2 ). -------------------S1------------------- -------------------S3------------------- "abcdefghijklmnopqrstuvwxyz" "abcdefghijklmnopqrstuvwxyz" "Cher" "Cher" "James Thurston Howell III" "James Thurston Howell III" "The bill is $1,205,837.49 so pay now!" "The bill is $1,205,837.49 so pay now!" chrpak_test(): Normal end of execution. Sun Aug 6 09:45:55 2023