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/atbash-cipher/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 / atbash-cipher / test.om` 203 lines ยท 4830 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/atbash-cipher/canonical-data.json at 47 note commit `650bebeb39ad40439175288042aece982b0a90a9` (2026-10-19), MIT licence, 48 note https://github.com/exercism/problem-specifications 49 note 14 cases kept, 0 skipped 50 fn tbeq a view uchar * b view uchar * to bool 51 if ne len a len b 52 ret false 53 end 54 for i ulong len a 55 if ne get a i get b i 56 ret false 57 end 58 end 59 ret true 60 end 61 text s0 "yes" 62 text e1 "bvh" 63 text c2 "encode: encode / encode yes" 64 text s3 "no" 65 text e4 "ml" 66 text c5 "encode: encode / encode no" 67 text s6 "OMG" 68 text e7 "lnt" 69 text c8 "encode: encode / encode OMG" 70 text s9 "O M G" 71 text e10 "lnt" 72 text c11 "encode: encode / encode spaces" 73 text s12 "mindblowingly" 74 text e13 "nrmwy oldrm tob" 75 text c14 "encode: encode / encode mindblowingly" 76 text s15 "Testing,1 2 3, testing." 77 text e16 "gvhgr mt123 gvhgr mt" 78 text c17 "encode: encode / encode numbers" 79 text s18 "Truth is fiction." 80 text e19 "gifgs rhurx grlm" 81 text c20 "encode: encode / encode deep thought" 82 text s21 "The quick brown fox jumps over the lazy dog." 83 text e22 "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt" 84 text c23 "encode: encode / encode all the letters" 85 text s24 "vcvix rhn" 86 text e25 "exercism" 87 text c26 "decode: decode / decode exercism" 88 text s27 "zmlyh gzxov rhlug vmzhg vkkrm thglm v" 89 text e28 "anobstacleisoftenasteppingstone" 90 text c29 "decode: decode / decode a sentence" 91 text s30 "gvhgr mt123 gvhgr mt" 92 text e31 "testing123testing" 93 text c32 "decode: decode / decode numbers" 94 text s33 "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt" 95 text e34 "thequickbrownfoxjumpsoverthelazydog" 96 text c35 "decode: decode / decode all the letters" 97 text s36 "vc vix r hn" 98 text e37 "exercism" 99 text c38 "decode: decode / decode with too many spaces" 100 text s39 "zmlyhgzxovrhlugvmzhgvkkrmthglmv" 101 text e40 "anobstacleisoftenasteppingstone" 102 text c41 "decode: decode / decode with no spaces" 103 note canonical case `2f47ebe1`-eab9-4d6b-b3c6-`627562a31c77` 104 fn tc0 to bool 105 o = new uchar 1024 0 106 n = encode s0 o 107 ret tbeq part o 0 n e1 108 end 109 note canonical case `b4ffe781`-ea81-4b74-b268-`cc58ba21c739` 110 fn tc1 to bool 111 o = new uchar 1024 0 112 n = encode s3 o 113 ret tbeq part o 0 n e4 114 end 115 note canonical case `10e48927`-24ab-4c4d-9d3f-`3067724ace00` 116 fn tc2 to bool 117 o = new uchar 1024 0 118 n = encode s6 o 119 ret tbeq part o 0 n e7 120 end 121 note canonical case `d59b8bc3`-509a-4a9a-834c-`6f501b98750b` 122 fn tc3 to bool 123 o = new uchar 1024 0 124 n = encode s9 o 125 ret tbeq part o 0 n e10 126 end 127 note canonical case `31d44b11`-81b7-4a94-8b43-`4af6a2449429` 128 fn tc4 to bool 129 o = new uchar 1024 0 130 n = encode s12 o 131 ret tbeq part o 0 n e13 132 end 133 note canonical case `d503361a`-1433-48c0-aae0-`d41b5baa33ff` 134 fn tc5 to bool 135 o = new uchar 1024 0 136 n = encode s15 o 137 ret tbeq part o 0 n e16 138 end 139 note canonical case `79c8a2d5`-0772-42d4-b41b-`531d0b5da926` 140 fn tc6 to bool 141 o = new uchar 1024 0 142 n = encode s18 o 143 ret tbeq part o 0 n e19 144 end 145 note canonical case `9ca13d23`-d32a-4967-a1fd-`6100b8742bab` 146 fn tc7 to bool 147 o = new uchar 1024 0 148 n = encode s21 o 149 ret tbeq part o 0 n e22 150 end 151 note canonical case `bb50e087`-7fdf-48e7-9223-`284fe7e69851` 152 fn tc8 to bool 153 o = new uchar 1024 0 154 n = decode s24 o 155 ret tbeq part o 0 n e25 156 end 157 note canonical case `ac021097`-cd5d-4717-8907-`b0814b9e292c` 158 fn tc9 to bool 159 o = new uchar 1024 0 160 n = decode s27 o 161 ret tbeq part o 0 n e28 162 end 163 note canonical case `18729de3`-de74-49b8-b68c-`025eaf77f851` 164 fn tc10 to bool 165 o = new uchar 1024 0 166 n = decode s30 o 167 ret tbeq part o 0 n e31 168 end 169 note canonical case `0f30325f`-f53b-415d-ad3e-`a7a4f63de034` 170 fn tc11 to bool 171 o = new uchar 1024 0 172 n = decode s33 o 173 ret tbeq part o 0 n e34 174 end 175 note canonical case `39640287`-30c6-4c8c-9bac-`9d613d1a5674` 176 fn tc12 to bool 177 o = new uchar 1024 0 178 n = decode s36 o 179 ret tbeq part o 0 n e37 180 end 181 note canonical case `b34edf13`-34c0-49b5-aa21-`0768928000d5` 182 fn tc13 to bool 183 o = new uchar 1024 0 184 n = decode s39 o 185 ret tbeq part o 0 n e40 186 end 187 fn main to int 188 tcheck tc0 c2 189 tcheck tc1 c5 190 tcheck tc2 c8 191 tcheck tc3 c11 192 tcheck tc4 c14 193 tcheck tc5 c17 194 tcheck tc6 c20 195 tcheck tc7 c23 196 tcheck tc8 c26 197 tcheck tc9 c29 198 tcheck tc10 c32 199 tcheck tc11 c35 200 tcheck tc12 c38 201 tcheck tc13 c41 202 ret int get tfails 0 203 end