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/square-root/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 / square-root / test.om` 88 lines ยท 1961 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/square-root/canonical-data.json at 47 note commit `650bebeb39ad40439175288042aece982b0a90a9` (2026-10-19), MIT licence, 48 note https://github.com/exercism/problem-specifications 49 note 6 cases kept, 0 skipped 50 text c0 "squareRoot: root of 1" 51 text c1 "squareRoot: root of 4" 52 text c2 "squareRoot: root of 25" 53 text c3 "squareRoot: root of 81" 54 text c4 "squareRoot: root of 196" 55 text c5 "squareRoot: root of 65025" 56 note canonical case `9b748478`-7b0a-490c-b87a-`609dacf631fd` 57 fn tc0 to bool 58 ret eq squareroot 1 1 59 end 60 note canonical case `7d3aa9ba`-9ac6-4e93-a18b-`2e8b477139bb` 61 fn tc1 to bool 62 ret eq squareroot 4 2 63 end 64 note canonical case `6624aabf`-3659-4ae0-a1c8-`25ae7f33c6ef` 65 fn tc2 to bool 66 ret eq squareroot 25 5 67 end 68 note canonical case `93beac69`-265e-4429-abb1-`94506b431f81` 69 fn tc3 to bool 70 ret eq squareroot 81 9 71 end 72 note canonical case fbddfeda-8c4f-4bc4-87ca-`6991af35360e` 73 fn tc4 to bool 74 ret eq squareroot 196 14 75 end 76 note canonical case `c03d0532`-8368-4734-a8e0-`f96a9eb7fc1d` 77 fn tc5 to bool 78 ret eq squareroot 65025 255 79 end 80 fn main to int 81 tcheck tc0 c0 82 tcheck tc1 c1 83 tcheck tc2 c2 84 tcheck tc3 c3 85 tcheck tc4 c4 86 tcheck tc5 c5 87 ret int get tfails 0 88 end