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 / nth-prime / test.om

82 lines · 1778 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/nth-prime/canonical-data.json at
47note commit 650bebeb39ad40439175288042aece982b0a90a9 (2026-10-19), MIT licence,
48note https://github.com/exercism/problem-specifications
49note 5 cases kept, 0 skipped
50text c0 "prime: first prime"
51text c1 "prime: second prime"
52text c2 "prime: sixth prime"
53text c3 "prime: big prime"
54text c4 "prime: there is no zeroth prime"
55note canonical case 75c65189-8aef-471a-81de-0a90c728160c
56fn tc0 to bool
57ret eq prime 1 2
58end
59note canonical case 2c38804c-295f-4701-b728-56dea34fd1a0
60fn tc1 to bool
61ret eq prime 2 3
62end
63note canonical case 56692534-781e-4e8c-b1f9-3e82c1640259
64fn tc2 to bool
65ret eq prime 6 13
66end
67note canonical case fce1e979-0edb-412d-93aa-2c744e8f50ff
68fn tc3 to bool
69ret eq prime 10001 104743
70end
71note canonical case bd0a9eae-6df7-485b-a144-80e13c7d55b2
72fn tc4 to bool
73ret eq prime 0 0
74end
75fn main to int
76tcheck tc0 c0
77tcheck tc1 c1
78tcheck tc2 c2
79tcheck tc3 c3
80tcheck tc4 c4
81ret int get tfails 0
82end