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/perfect-numbers/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 / perfect-numbers / test.om` 136 lines ยท 3937 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/perfect-numbers/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 c0 "classify: Perfect numbers / Smallest perfect number is classified correctly" 51 text c1 "classify: Perfect numbers / Medium perfect number is classified correctly" 52 text c2 "classify: Perfect numbers / Large perfect number is classified correctly" 53 text c3 "classify: Abundant numbers / Smallest abundant number is classified correctly" 54 text c4 "classify: Abundant numbers / Medium abundant number is classified correctly" 55 text c5 "classify: Abundant numbers / Large abundant number is classified correctly" 56 text c6 "classify: Abundant numbers / Perfect square abundant number is classified correctly" 57 text c7 "classify: Deficient numbers / Smallest prime deficient number is classified correctly" 58 text c8 "classify: Deficient numbers / Smallest non-prime deficient number is classified correctly" 59 text c9 "classify: Deficient numbers / Medium deficient number is classified correctly" 60 text c10 "classify: Deficient numbers / Large deficient number is classified correctly" 61 text c11 "classify: Deficient numbers / Edge case (no factors other than itself) is classified correctly" 62 text c12 "classify: Invalid inputs / Zero is rejected (as it is not a positive integer)" 63 text c13 "classify: Invalid inputs / Negative integer is rejected (as it is not a positive integer)" 64 note canonical case `163e8e86`-7bfd-4ee2-bd68-`d083dc3381a3` 65 fn tc0 to bool 66 ret eq classify 6 1 67 end 68 note canonical case `169a7854`-0431-4ae0-9815-`c3b6d967436d` 69 fn tc1 to bool 70 ret eq classify 28 1 71 end 72 note canonical case `ee3627c4`-7b36-4245-ba7c-`8727d585f402` 73 fn tc2 to bool 74 ret eq classify `33550336` 1 75 end 76 note canonical case `80ef7cf8`-9ea8-49b9-8b2d-`d9cb3db3ed7e` 77 fn tc3 to bool 78 ret eq classify 12 2 79 end 80 note canonical case `3e300e0d`-1a12-4f11-8c48-`d1027165ab60` 81 fn tc4 to bool 82 ret eq classify 30 2 83 end 84 note canonical case `ec7792e6`-8786-449c-b005-`ce6dd89a772b` 85 fn tc5 to bool 86 ret eq classify `33550335` 2 87 end 88 note canonical case `05f15b93`-849c-45e9-9c7d-`1ea131ef7d10` 89 fn tc6 to bool 90 ret eq classify 196 2 91 end 92 note canonical case `e610fdc7`-2b6e-43c3-a51c-`b70fb37413ba` 93 fn tc7 to bool 94 ret eq classify 2 3 95 end 96 note canonical case `0beb7f66`-753a-443f-8075-`ad7fbd9018f3` 97 fn tc8 to bool 98 ret eq classify 4 3 99 end 100 note canonical case `1c802e45`-b4c6-4962-93d7-`1cad245821ef` 101 fn tc9 to bool 102 ret eq classify 32 3 103 end 104 note canonical case `47dd569f`-9e5a-4a11-9a47-`a4e91c8c28aa` 105 fn tc10 to bool 106 ret eq classify `33550337` 3 107 end 108 note canonical case `a696dec8`-6147-4d68-afad-`d38de5476a56` 109 fn tc11 to bool 110 ret eq classify 1 3 111 end 112 note canonical case `72445cee`-660c-4d75-8506-`6c40089dc302` 113 fn tc12 to bool 114 ret eq classify 0 0 115 end 116 note canonical case `2d72ce2c`-6802-49ac-8ece-`c790ba3dae13` 117 fn tc13 to bool 118 ret eq classify -1 0 119 end 120 fn main to int 121 tcheck tc0 c0 122 tcheck tc1 c1 123 tcheck tc2 c2 124 tcheck tc3 c3 125 tcheck tc4 c4 126 tcheck tc5 c5 127 tcheck tc6 c6 128 tcheck tc7 c7 129 tcheck tc8 c8 130 tcheck tc9 c9 131 tcheck tc10 c10 132 tcheck tc11 c11 133 tcheck tc12 c12 134 tcheck tc13 c13 135 ret int get tfails 0 136 end