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/space-age/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 / space-age / test.om` 123 lines ยท 2781 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/space-age/canonical-data.json at 47 note commit `650bebeb39ad40439175288042aece982b0a90a9` (2026-10-19), MIT licence, 48 note https://github.com/exercism/problem-specifications 49 note 9 cases kept, 0 skipped 50 text s0 "Earth" 51 text c1 "age: age on Earth" 52 text s2 "Mercury" 53 text c3 "age: age on Mercury" 54 text s4 "Venus" 55 text c5 "age: age on Venus" 56 text s6 "Mars" 57 text c7 "age: age on Mars" 58 text s8 "Jupiter" 59 text c9 "age: age on Jupiter" 60 text s10 "Saturn" 61 text c11 "age: age on Saturn" 62 text s12 "Uranus" 63 text c13 "age: age on Uranus" 64 text s14 "Neptune" 65 text c15 "age: age on Neptune" 66 text s16 "Sun" 67 text c17 "age: invalid planet causes error" 68 note canonical case `84f609af`-5a91-4d68-90a3-`9e32d8a5cd34` 69 fn tc0 to bool 70 v = age s0 `1000000000`.0 71 ret lt fabs sub v 31.69 0.005 72 end 73 note canonical case `ca20c4e9`-6054-458c-9312-`79679ffab40b` 74 fn tc1 to bool 75 v = age s2 `2134835688`.0 76 ret lt fabs sub v 280.88 0.005 77 end 78 note canonical case `502c6529`-fd1b-41d3-8fab-`65e03082b024` 79 fn tc2 to bool 80 v = age s4 `189839836`.0 81 ret lt fabs sub v 9.78 0.005 82 end 83 note canonical case `9ceadf5e`-a0d5-4388-9d40-`2c459227ceb8` 84 fn tc3 to bool 85 v = age s6 `2129871239`.0 86 ret lt fabs sub v 35.88 0.005 87 end 88 note canonical case `42927dc3`-fe5e-4f76-a5b5-`f737fc19bcde` 89 fn tc4 to bool 90 v = age s8 `901876382`.0 91 ret lt fabs sub v 2.41 0.005 92 end 93 note canonical case `8469b332`-7837-4ada-b27c-`00ee043ebcad` 94 fn tc5 to bool 95 v = age s10 `2000000000`.0 96 ret lt fabs sub v 2.15 0.005 97 end 98 note canonical case `999354c1`-76f8-4bb5-a672-`f317b6436743` 99 fn tc6 to bool 100 v = age s12 `1210123456`.0 101 ret lt fabs sub v 0.46 0.005 102 end 103 note canonical case `80096d30`-a0d4-4449-903e-`a381178355d8` 104 fn tc7 to bool 105 v = age s14 `1821023456`.0 106 ret lt fabs sub v 0.35 0.005 107 end 108 note canonical case `57b96e2a`-1178-40b7-b34d-`f3c9c34e4bf4` 109 fn tc8 to bool 110 ret lt age s16 `680804807`.0 0.0 111 end 112 fn main to int 113 tcheck tc0 c1 114 tcheck tc1 c3 115 tcheck tc2 c5 116 tcheck tc3 c7 117 tcheck tc4 c9 118 tcheck tc5 c11 119 tcheck tc6 c13 120 tcheck tc7 c15 121 tcheck tc8 c17 122 ret int get tfails 0 123 end