omega-rosetta
aien-dev/omega-rosetta
Brought by drakestapleton
omega-rosetta / exercises / scrabble-score / test.om
| 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/scrabble-score/canonical-data.json at |
| 47 | note commit 650bebeb39ad40439175288042aece982b0a90a9 (2026-10-19), MIT licence, |
| 48 | note https://github.com/exercism/problem-specifications |
| 49 | note 11 cases kept, 0 skipped |
| 50 | text s0 "a" |
| 51 | text c1 "score: lowercase letter" |
| 52 | text s2 "A" |
| 53 | text c3 "score: uppercase letter" |
| 54 | text s4 "f" |
| 55 | text c5 "score: valuable letter" |
| 56 | text s6 "at" |
| 57 | text c7 "score: short word" |
| 58 | text s8 "zoo" |
| 59 | text c9 "score: short, valuable word" |
| 60 | text s10 "street" |
| 61 | text c11 "score: medium word" |
| 62 | text s12 "quirky" |
| 63 | text c13 "score: medium, valuable word" |
| 64 | text s14 "OxyphenButazone" |
| 65 | text c15 "score: long, mixed-case word" |
| 66 | text s16 "pinata" |
| 67 | text c17 "score: english-like word" |
| 68 | text z18 "z" |
| 69 | text c19 "score: empty input" |
| 70 | text s20 "abcdefghijklmnopqrstuvwxyz" |
| 71 | text c21 "score: entire alphabet available" |
| 72 | note canonical case f46cda29-1ca5-4ef2-bd45-388a767e3db2 |
| 73 | fn tc0 to bool |
| 74 | ret eq score s0 1 |
| 75 | end |
| 76 | note canonical case f7794b49-f13e-45d1-a933-4e48459b2201 |
| 77 | fn tc1 to bool |
| 78 | ret eq score s2 1 |
| 79 | end |
| 80 | note canonical case eaba9c76-f9fa-49c9-a1b0-d1ba3a5b31fa |
| 81 | fn tc2 to bool |
| 82 | ret eq score s4 4 |
| 83 | end |
| 84 | note canonical case f3c8c94e-bb48-4da2-b09f-e832e103151e |
| 85 | fn tc3 to bool |
| 86 | ret eq score s6 2 |
| 87 | end |
| 88 | note canonical case 71e3d8fa-900d-4548-930e-68e7067c4615 |
| 89 | fn tc4 to bool |
| 90 | ret eq score s8 12 |
| 91 | end |
| 92 | note canonical case d3088ad9-570c-4b51-8764-c75d5a430e99 |
| 93 | fn tc5 to bool |
| 94 | ret eq score s10 6 |
| 95 | end |
| 96 | note canonical case fa20c572-ad86-400a-8511-64512daac352 |
| 97 | fn tc6 to bool |
| 98 | ret eq score s12 22 |
| 99 | end |
| 100 | note canonical case 9336f0ba-9c2b-4fa0-bd1c-2e2d328cf967 |
| 101 | fn tc7 to bool |
| 102 | ret eq score s14 41 |
| 103 | end |
| 104 | note canonical case 1e34e2c3-e444-4ea7-b598-3c2b46fd2c10 |
| 105 | fn tc8 to bool |
| 106 | ret eq score s16 8 |
| 107 | end |
| 108 | note canonical case 4efe3169-b3b6-4334-8bae-ff4ef24a7e4f |
| 109 | fn tc9 to bool |
| 110 | ret eq score part z18 0 0 0 |
| 111 | end |
| 112 | note canonical case 3b305c1c-f260-4e15-a5b5-cb7d3ea7c3d7 |
| 113 | fn tc10 to bool |
| 114 | ret eq score s20 87 |
| 115 | end |
| 116 | fn main to int |
| 117 | tcheck tc0 c1 |
| 118 | tcheck tc1 c3 |
| 119 | tcheck tc2 c5 |
| 120 | tcheck tc3 c7 |
| 121 | tcheck tc4 c9 |
| 122 | tcheck tc5 c11 |
| 123 | tcheck tc6 c13 |
| 124 | tcheck tc7 c15 |
| 125 | tcheck tc8 c17 |
| 126 | tcheck tc9 c19 |
| 127 | tcheck tc10 c21 |
| 128 | ret int get tfails 0 |
| 129 | end |