omega-rosetta
aien-dev/omega-rosetta
Brought by drakestapleton
omega-rosetta / exercises / isogram / 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/isogram/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 | text z0 "z" |
| 51 | text c1 "isIsogram: empty string" |
| 52 | text s2 "isogram" |
| 53 | text c3 "isIsogram: isogram with only lower case characters" |
| 54 | text s4 "eleven" |
| 55 | text c5 "isIsogram: word with one duplicated character" |
| 56 | text s6 "zzyzx" |
| 57 | text c7 "isIsogram: word with one duplicated character from the end of the alphabet" |
| 58 | text s8 "subdermatoglyphic" |
| 59 | text c9 "isIsogram: longest reported english isogram" |
| 60 | text s10 "Alphabet" |
| 61 | text c11 "isIsogram: word with duplicated character in mixed case" |
| 62 | text s12 "alphAbet" |
| 63 | text c13 "isIsogram: word with duplicated character in mixed case, lowercase first" |
| 64 | text s14 "thumbscrew-japingly" |
| 65 | text c15 "isIsogram: hypothetical isogrammic word with hyphen" |
| 66 | text s16 "thumbscrew-jappingly" |
| 67 | text c17 "isIsogram: hypothetical word with duplicated character following hyphen" |
| 68 | text s18 "six-year-old" |
| 69 | text c19 "isIsogram: isogram with duplicated hyphen" |
| 70 | text s20 "Emily Jung Schwartzkopf" |
| 71 | text c21 "isIsogram: made-up name that is an isogram" |
| 72 | text s22 "accentor" |
| 73 | text c23 "isIsogram: duplicated character in the middle" |
| 74 | text s24 "angola" |
| 75 | text c25 "isIsogram: same first and last characters" |
| 76 | text s26 "up-to-date" |
| 77 | text c27 "isIsogram: word with duplicated character and with two hyphens" |
| 78 | note canonical case a0e97d2d-669e-47c7-8134-518a1e2c4555 |
| 79 | fn tc0 to bool |
| 80 | ret eq isisogram part z0 0 0 true |
| 81 | end |
| 82 | note canonical case 9a001b50-f194-4143-bc29-2af5ec1ef652 |
| 83 | fn tc1 to bool |
| 84 | ret eq isisogram s2 true |
| 85 | end |
| 86 | note canonical case 8ddb0ca3-276e-4f8b-89da-d95d5bae78a4 |
| 87 | fn tc2 to bool |
| 88 | ret eq isisogram s4 false |
| 89 | end |
| 90 | note canonical case 6450b333-cbc2-4b24-a723-0b459b34fe18 |
| 91 | fn tc3 to bool |
| 92 | ret eq isisogram s6 false |
| 93 | end |
| 94 | note canonical case a15ff557-dd04-4764-99e7-02cc1a385863 |
| 95 | fn tc4 to bool |
| 96 | ret eq isisogram s8 true |
| 97 | end |
| 98 | note canonical case f1a7f6c7-a42f-4915-91d7-35b2ea11c92e |
| 99 | fn tc5 to bool |
| 100 | ret eq isisogram s10 false |
| 101 | end |
| 102 | note canonical case 14a4f3c1-3b47-4695-b645-53d328298942 |
| 103 | fn tc6 to bool |
| 104 | ret eq isisogram s12 false |
| 105 | end |
| 106 | note canonical case 423b850c-7090-4a8a-b057-97f1cadd7c42 |
| 107 | fn tc7 to bool |
| 108 | ret eq isisogram s14 true |
| 109 | end |
| 110 | note canonical case 93dbeaa0-3c5a-45c2-8b25-428b8eacd4f2 |
| 111 | fn tc8 to bool |
| 112 | ret eq isisogram s16 false |
| 113 | end |
| 114 | note canonical case 36b30e5c-173f-49c6-a515-93a3e825553f |
| 115 | fn tc9 to bool |
| 116 | ret eq isisogram s18 true |
| 117 | end |
| 118 | note canonical case cdabafa0-c9f4-4c1f-b142-689c6ee17d93 |
| 119 | fn tc10 to bool |
| 120 | ret eq isisogram s20 true |
| 121 | end |
| 122 | note canonical case 5fc61048-d74e-48fd-bc34-abfc21552d4d |
| 123 | fn tc11 to bool |
| 124 | ret eq isisogram s22 false |
| 125 | end |
| 126 | note canonical case 310ac53d-8932-47bc-bbb4-b2b94f25a83e |
| 127 | fn tc12 to bool |
| 128 | ret eq isisogram s24 false |
| 129 | end |
| 130 | note canonical case 0d0b8644-0a1e-4a31-a432-2b3ee270d847 |
| 131 | fn tc13 to bool |
| 132 | ret eq isisogram s26 false |
| 133 | end |
| 134 | fn main to int |
| 135 | tcheck tc0 c1 |
| 136 | tcheck tc1 c3 |
| 137 | tcheck tc2 c5 |
| 138 | tcheck tc3 c7 |
| 139 | tcheck tc4 c9 |
| 140 | tcheck tc5 c11 |
| 141 | tcheck tc6 c13 |
| 142 | tcheck tc7 c15 |
| 143 | tcheck tc8 c17 |
| 144 | tcheck tc9 c19 |
| 145 | tcheck tc10 c21 |
| 146 | tcheck tc11 c23 |
| 147 | tcheck tc12 c25 |
| 148 | tcheck tc13 c27 |
| 149 | ret int get tfails 0 |
| 150 | end |