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/raindrops/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 / raindrops / test.om` 225 lines ยท 5469 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/raindrops/canonical-data.json at 47 note commit `650bebeb39ad40439175288042aece982b0a90a9` (2026-10-19), MIT licence, 48 note https://github.com/exercism/problem-specifications 49 note 18 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 e0 "1" 62 text c1 "convert: the sound for 1 is 1" 63 text e2 "Pling" 64 text c3 "convert: the sound for 3 is Pling" 65 text e4 "Plang" 66 text c5 "convert: the sound for 5 is Plang" 67 text e6 "Plong" 68 text c7 "convert: the sound for 7 is Plong" 69 text e8 "Pling" 70 text c9 "convert: the sound for 6 is Pling as it has a factor 3" 71 text e10 "8" 72 text c11 "convert: 2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base" 73 text e12 "Pling" 74 text c13 "convert: the sound for 9 is Pling as it has a factor 3" 75 text e14 "Plang" 76 text c15 "convert: the sound for 10 is Plang as it has a factor 5" 77 text e16 "Plong" 78 text c17 "convert: the sound for 14 is Plong as it has a factor of 7" 79 text e18 "PlingPlang" 80 text c19 "convert: the sound for 15 is PlingPlang as it has factors 3 and 5" 81 text e20 "PlingPlong" 82 text c21 "convert: the sound for 21 is PlingPlong as it has factors 3 and 7" 83 text e22 "Plang" 84 text c23 "convert: the sound for 25 is Plang as it has a factor 5" 85 text e24 "Pling" 86 text c25 "convert: the sound for 27 is Pling as it has a factor 3" 87 text e26 "PlangPlong" 88 text c27 "convert: the sound for 35 is PlangPlong as it has factors 5 and 7" 89 text e28 "Plong" 90 text c29 "convert: the sound for 49 is Plong as it has a factor 7" 91 text e30 "52" 92 text c31 "convert: the sound for 52 is 52" 93 text e32 "PlingPlangPlong" 94 text c33 "convert: the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7" 95 text e34 "Plang" 96 text c35 "convert: the sound for 3125 is Plang as it has a factor 5" 97 note canonical case `1575d549`-e502-46d4-a8e1-`6b7bec6123d8` 98 fn tc0 to bool 99 o = new uchar 1024 0 100 n = convert 1 o 101 ret tbeq part o 0 n e0 102 end 103 note canonical case `1f51a9f9`-4895-4539-b182-`d7b0a5ab2913` 104 fn tc1 to bool 105 o = new uchar 1024 0 106 n = convert 3 o 107 ret tbeq part o 0 n e2 108 end 109 note canonical case `2d9bfae5`-2b21-4bcd-9629-`c8c0e388f3e0` 110 fn tc2 to bool 111 o = new uchar 1024 0 112 n = convert 5 o 113 ret tbeq part o 0 n e4 114 end 115 note canonical case `d7e60daa`-32ef-4c23-b688-`2abff46c4806` 116 fn tc3 to bool 117 o = new uchar 1024 0 118 n = convert 7 o 119 ret tbeq part o 0 n e6 120 end 121 note canonical case `6bb4947b`-a724-430c-923f-`f0dc3d62e56a` 122 fn tc4 to bool 123 o = new uchar 1024 0 124 n = convert 6 o 125 ret tbeq part o 0 n e8 126 end 127 note canonical case `ce51e0e8`-d9d4-446d-9949-`96eac4458c2d` 128 fn tc5 to bool 129 o = new uchar 1024 0 130 n = convert 8 o 131 ret tbeq part o 0 n e10 132 end 133 note canonical case `0dd66175`-e3e2-47fc-8750-`d01739856671` 134 fn tc6 to bool 135 o = new uchar 1024 0 136 n = convert 9 o 137 ret tbeq part o 0 n e12 138 end 139 note canonical case `022c44d3`-2182-4471-95d7-`c575af225c96` 140 fn tc7 to bool 141 o = new uchar 1024 0 142 n = convert 10 o 143 ret tbeq part o 0 n e14 144 end 145 note canonical case `37ab74db`-fed3-40ff-b7b9-`04acdfea8edf` 146 fn tc8 to bool 147 o = new uchar 1024 0 148 n = convert 14 o 149 ret tbeq part o 0 n e16 150 end 151 note canonical case `31f92999`-6afb-40ee-9aa4-`6d15e3334d0f` 152 fn tc9 to bool 153 o = new uchar 1024 0 154 n = convert 15 o 155 ret tbeq part o 0 n e18 156 end 157 note canonical case `ff9bb95d`-6361-4602-be2c-`653fe5239b54` 158 fn tc10 to bool 159 o = new uchar 1024 0 160 n = convert 21 o 161 ret tbeq part o 0 n e20 162 end 163 note canonical case `d2e75317`-b72e-40ab-8a64-`6734a21dece1` 164 fn tc11 to bool 165 o = new uchar 1024 0 166 n = convert 25 o 167 ret tbeq part o 0 n e22 168 end 169 note canonical case `a09c4c58`-c662-4e32-97fe-`f1501ef7125c` 170 fn tc12 to bool 171 o = new uchar 1024 0 172 n = convert 27 o 173 ret tbeq part o 0 n e24 174 end 175 note canonical case `bdf061de`-8564-4899-a843-`14b48b722789` 176 fn tc13 to bool 177 o = new uchar 1024 0 178 n = convert 35 o 179 ret tbeq part o 0 n e26 180 end 181 note canonical case `c4680bee`-69ba-439d-99b5-`70c5fd1a7a83` 182 fn tc14 to bool 183 o = new uchar 1024 0 184 n = convert 49 o 185 ret tbeq part o 0 n e28 186 end 187 note canonical case `17f2bc9a`-b65a-4d23-8ccd-`266e8c271444` 188 fn tc15 to bool 189 o = new uchar 1024 0 190 n = convert 52 o 191 ret tbeq part o 0 n e30 192 end 193 note canonical case `e46677ed`-ff1a-419f-a740-`5c713d2830e4` 194 fn tc16 to bool 195 o = new uchar 1024 0 196 n = convert 105 o 197 ret tbeq part o 0 n e32 198 end 199 note canonical case `13c6837a`-0fcd-4b86-a0eb-`20572f7deb0b` 200 fn tc17 to bool 201 o = new uchar 1024 0 202 n = convert 3125 o 203 ret tbeq part o 0 n e34 204 end 205 fn main to int 206 tcheck tc0 c1 207 tcheck tc1 c3 208 tcheck tc2 c5 209 tcheck tc3 c7 210 tcheck tc4 c9 211 tcheck tc5 c11 212 tcheck tc6 c13 213 tcheck tc7 c15 214 tcheck tc8 c17 215 tcheck tc9 c19 216 tcheck tc10 c21 217 tcheck tc11 c23 218 tcheck tc12 c25 219 tcheck tc13 c27 220 tcheck tc14 c29 221 tcheck tc15 c31 222 tcheck tc16 c33 223 tcheck tc17 c35 224 ret int get tfails 0 225 end