interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / si / rosetta / exercises / perfect-numbers / test.om

136 lines · 3937 bytes Raw Blame History
1note ---- test harness (appended after the solution by exercise.sh) ----
2text tok "ok "
3text tnok "not ok "
4text tsep " - "
5text tnl "\n"
6global tfails ulong 1
7global tnum ulong 1
8fn temit a view uchar * to void
9o = ulong 0
10while lt o len a bound 4096
11k = write 1 a o sub len a o
12if le k 0
13exit 2
14end
15o = add o ulong k
16end
17end
18fn temitu n ulong to void
19d = new uchar 20 0
20i = ulong 20
21v = n
22while true bound 20
23i = sub i 1
24put d i uchar add rem v 10 48
25v = div v 10
26if eq v 0
27break
28end
29end
30temit part d i sub 20 i
31end
32note one TAP-style line per case; main returns the number of failed cases
33fn tcheck c bool what view uchar * to void
34put tnum 0 add get tnum 0 1
35if c
36temit tok
37else
38temit tnok
39put tfails 0 add get tfails 0 1
40end
41temitu get tnum 0
42temit tsep
43temit what
44temit tnl
45end
46note cases: exercism/problem-specifications exercises/perfect-numbers/canonical-data.json at
47note commit 650bebeb39ad40439175288042aece982b0a90a9 (2026-10-19), MIT licence,
48note https://github.com/exercism/problem-specifications
49note 14 cases kept, 0 skipped
50text c0 "classify: Perfect numbers / Smallest perfect number is classified correctly"
51text c1 "classify: Perfect numbers / Medium perfect number is classified correctly"
52text c2 "classify: Perfect numbers / Large perfect number is classified correctly"
53text c3 "classify: Abundant numbers / Smallest abundant number is classified correctly"
54text c4 "classify: Abundant numbers / Medium abundant number is classified correctly"
55text c5 "classify: Abundant numbers / Large abundant number is classified correctly"
56text c6 "classify: Abundant numbers / Perfect square abundant number is classified correctly"
57text c7 "classify: Deficient numbers / Smallest prime deficient number is classified correctly"
58text c8 "classify: Deficient numbers / Smallest non-prime deficient number is classified correctly"
59text c9 "classify: Deficient numbers / Medium deficient number is classified correctly"
60text c10 "classify: Deficient numbers / Large deficient number is classified correctly"
61text c11 "classify: Deficient numbers / Edge case (no factors other than itself) is classified correctly"
62text c12 "classify: Invalid inputs / Zero is rejected (as it is not a positive integer)"
63text c13 "classify: Invalid inputs / Negative integer is rejected (as it is not a positive integer)"
64note canonical case 163e8e86-7bfd-4ee2-bd68-d083dc3381a3
65fn tc0 to bool
66ret eq classify 6 1
67end
68note canonical case 169a7854-0431-4ae0-9815-c3b6d967436d
69fn tc1 to bool
70ret eq classify 28 1
71end
72note canonical case ee3627c4-7b36-4245-ba7c-8727d585f402
73fn tc2 to bool
74ret eq classify 33550336 1
75end
76note canonical case 80ef7cf8-9ea8-49b9-8b2d-d9cb3db3ed7e
77fn tc3 to bool
78ret eq classify 12 2
79end
80note canonical case 3e300e0d-1a12-4f11-8c48-d1027165ab60
81fn tc4 to bool
82ret eq classify 30 2
83end
84note canonical case ec7792e6-8786-449c-b005-ce6dd89a772b
85fn tc5 to bool
86ret eq classify 33550335 2
87end
88note canonical case 05f15b93-849c-45e9-9c7d-1ea131ef7d10
89fn tc6 to bool
90ret eq classify 196 2
91end
92note canonical case e610fdc7-2b6e-43c3-a51c-b70fb37413ba
93fn tc7 to bool
94ret eq classify 2 3
95end
96note canonical case 0beb7f66-753a-443f-8075-ad7fbd9018f3
97fn tc8 to bool
98ret eq classify 4 3
99end
100note canonical case 1c802e45-b4c6-4962-93d7-1cad245821ef
101fn tc9 to bool
102ret eq classify 32 3
103end
104note canonical case 47dd569f-9e5a-4a11-9a47-a4e91c8c28aa
105fn tc10 to bool
106ret eq classify 33550337 3
107end
108note canonical case a696dec8-6147-4d68-afad-d38de5476a56
109fn tc11 to bool
110ret eq classify 1 3
111end
112note canonical case 72445cee-660c-4d75-8506-6c40089dc302
113fn tc12 to bool
114ret eq classify 0 0
115end
116note canonical case 2d72ce2c-6802-49ac-8ece-c790ba3dae13
117fn tc13 to bool
118ret eq classify -1 0
119end
120fn main to int
121tcheck tc0 c0
122tcheck tc1 c1
123tcheck tc2 c2
124tcheck tc3 c3
125tcheck tc4 c4
126tcheck tc5 c5
127tcheck tc6 c6
128tcheck tc7 c7
129tcheck tc8 c8
130tcheck tc9 c9
131tcheck tc10 c10
132tcheck tc11 c11
133tcheck tc12 c12
134tcheck tc13 c13
135ret int get tfails 0
136end