Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-rosetta/blob/main/exercises/isbn-verifier/test.om # omega-rosetta aien-dev/omega-rosetta Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-rosetta / exercises / isbn-verifier / test.om` 199 lines ยท 5163 bytes Raw Blame History 1 note ---- test harness (appended after the solution by exercise.sh) ---- 2 text tok "ok " 3 text tnok "not ok " 4 text tsep " - " 5 text tnl "\n" 6 global tfails ulong 1 7 global tnum ulong 1 8 fn temit a view uchar * to void 9 o = ulong 0 10 while lt o len a bound 4096 11 k = write 1 a o sub len a o 12 if le k 0 13 exit 2 14 end 15 o = add o ulong k 16 end 17 end 18 fn temitu n ulong to void 19 d = new uchar 20 0 20 i = ulong 20 21 v = n 22 while true bound 20 23 i = sub i 1 24 put d i uchar add rem v 10 48 25 v = div v 10 26 if eq v 0 27 break 28 end 29 end 30 temit part d i sub 20 i 31 end 32 note one TAP-style line per case; main returns the number of failed cases 33 fn tcheck c bool what view uchar * to void 34 put tnum 0 add get tnum 0 1 35 if c 36 temit tok 37 else 38 temit tnok 39 put tfails 0 add get tfails 0 1 40 end 41 temitu get tnum 0 42 temit tsep 43 temit what 44 temit tnl 45 end 46 note cases: exercism/problem-specifications exercises/isbn-verifier/canonical-data.json at 47 note commit `650bebeb39ad40439175288042aece982b0a90a9` (2026-10-19), MIT licence, 48 note https://github.com/exercism/problem-specifications 49 note 21 cases kept, 0 skipped 50 text s0 "3-598-21508-8" 51 text c1 "isValid: valid isbn" 52 text s2 "3-598-21508-9" 53 text c3 "isValid: invalid isbn check digit" 54 text s4 "3-598-21507-X" 55 text c5 "isValid: valid isbn with a check digit of 10" 56 text s6 "3-598-21507-A" 57 text c7 "isValid: check digit is a character other than X" 58 text s8 "4-598-21507-B" 59 text c9 "isValid: invalid check digit in isbn is not treated as zero" 60 text s10 "3-598-P1581-X" 61 text c11 "isValid: invalid character in isbn is not treated as zero" 62 text s12 "3-598-2X507-9" 63 text c13 "isValid: X is only valid as a check digit" 64 text s14 "3-598-21508-96" 65 text c15 "isValid: only one check digit is allowed" 66 text s16 "3-598-2X507-5" 67 text c17 "isValid: X is not substituted by the value 10" 68 text s18 "`3598215088`" 69 text c19 "isValid: valid isbn without separating dashes" 70 text s20 "359821507X" 71 text c21 "isValid: isbn without separating dashes and X as check digit" 72 text s22 "`359821507`" 73 text c23 "isValid: isbn without check digit and dashes" 74 text s24 "3598215078X" 75 text c25 "isValid: too long isbn and no dashes" 76 text s26 "00" 77 text c27 "isValid: too short isbn" 78 text s28 "3-598-21507" 79 text c29 "isValid: isbn without check digit" 80 text s30 "3-598-21515-X" 81 text c31 "isValid: check digit of X should not be used for 0" 82 text z32 "z" 83 text c33 "isValid: empty isbn" 84 text s34 "`134456729`" 85 text c35 "isValid: input is 9 characters" 86 text s36 "3132P34035" 87 text c37 "isValid: invalid characters are not ignored after checking length" 88 text s38 "3598P215088" 89 text c39 "isValid: invalid characters are not ignored before checking length" 90 text s40 "`98245726788`" 91 text c41 "isValid: input is too long but contains a valid isbn" 92 note canonical case `0caa3eac`-d2e3-4c29-8df8-`b188bc8c9292` 93 fn tc0 to bool 94 ret eq isvalid s0 true 95 end 96 note canonical case `19f76b53`-7c24-45f8-87b8-`4604d0ccd248` 97 fn tc1 to bool 98 ret eq isvalid s2 false 99 end 100 note canonical case `4164bfee`-fb0a-4a1c-9f70-`64c6a1903dcd` 101 fn tc2 to bool 102 ret eq isvalid s4 true 103 end 104 note canonical case `3ed50db1`-8982-4423-a993-`93174a20825c` 105 fn tc3 to bool 106 ret eq isvalid s6 false 107 end 108 note canonical case `9416f4a5`-fe01-4b61-a07b-`eb75892ef562` 109 fn tc4 to bool 110 ret eq isvalid s8 false 111 end 112 note canonical case `c19ba0c4`-014f-4dc3-a63f-`ff9aefc9b5ec` 113 fn tc5 to bool 114 ret eq isvalid s10 false 115 end 116 note canonical case `28025280`-2c39-4092-9719-`f3234b89c627` 117 fn tc6 to bool 118 ret eq isvalid s12 false 119 end 120 note canonical case `8005b57f`-f194-44ee-88d2-`a77ac4142591` 121 fn tc7 to bool 122 ret eq isvalid s14 false 123 end 124 note canonical case `fdb14c99`-4cf8-43c5-b06d-`eb1638eff343` 125 fn tc8 to bool 126 ret eq isvalid s16 false 127 end 128 note canonical case `f6294e61`-7e79-46b3-977b-`f48789a4945b` 129 fn tc9 to bool 130 ret eq isvalid s18 true 131 end 132 note canonical case `185ab99b`-3a1b-45f3-aeec-`b80d80b07f0b` 133 fn tc10 to bool 134 ret eq isvalid s20 true 135 end 136 note canonical case `7725a837`-ec8e-4528-a92a-`d981dd8cf3e2` 137 fn tc11 to bool 138 ret eq isvalid s22 false 139 end 140 note canonical case `47e4dfba`-9c20-46ed-9958-`4d3190630bdf` 141 fn tc12 to bool 142 ret eq isvalid s24 false 143 end 144 note canonical case `737f4e91`-cbba-4175-95bf-`ae630b41fb60` 145 fn tc13 to bool 146 ret eq isvalid s26 false 147 end 148 note canonical case `5458a128`-a9b6-4ff8-8afb-`674e74567cef` 149 fn tc14 to bool 150 ret eq isvalid s28 false 151 end 152 note canonical case `70b6ad83`-d0a2-4ca7-a4d5-`a9ab731800f7` 153 fn tc15 to bool 154 ret eq isvalid s30 false 155 end 156 note canonical case `94610459`-55ab-4c35-9b93-`ff6ea1a8e562` 157 fn tc16 to bool 158 ret eq isvalid part z32 0 0 false 159 end 160 note canonical case `7bff28d4`-d770-48cc-80d6-`b20b3a0fb46c` 161 fn tc17 to bool 162 ret eq isvalid s34 false 163 end 164 note canonical case `ed6e8d1b`-382c-4081-8326-`8b772c581fec` 165 fn tc18 to bool 166 ret eq isvalid s36 false 167 end 168 note canonical case `daad3e58`-ce00-4395-8a8e-`e3eded1cdc86` 169 fn tc19 to bool 170 ret eq isvalid s38 false 171 end 172 note canonical case `fb5e48d8`-7c03-4bfb-a088-`b101df16fdc3` 173 fn tc20 to bool 174 ret eq isvalid s40 false 175 end 176 fn main to int 177 tcheck tc0 c1 178 tcheck tc1 c3 179 tcheck tc2 c5 180 tcheck tc3 c7 181 tcheck tc4 c9 182 tcheck tc5 c11 183 tcheck tc6 c13 184 tcheck tc7 c15 185 tcheck tc8 c17 186 tcheck tc9 c19 187 tcheck tc10 c21 188 tcheck tc11 c23 189 tcheck tc12 c25 190 tcheck tc13 c27 191 tcheck tc14 c29 192 tcheck tc15 c31 193 tcheck tc16 c33 194 tcheck tc17 c35 195 tcheck tc18 c37 196 tcheck tc19 c39 197 tcheck tc20 c41 198 ret int get tfails 0 199 end