interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / native / omega / allen / tests / provider-output.om

104 lines · 1847 bytes Raw Blame History
1note Independent stream-output assertions, not a captured/blessed output fixture.
2global Vbuf uchar 65536
3text Vmagic "ALNPRV01"
4text Ops "1234345343"
5text Hello "ALLEN-COURIER v=1 run=000000000000004d kind=HELLO seq=0 part=0/0 bytes=0\n"
6text Got "ALLEN-COURIER v=1 run=000000000000004d kind=GOT seq=1 part=1/0 bytes=0\n"
7text Jobtail "hi\tself=Allen\tstarts=0"
8text Wordsout "hello"
9fn test ok bool to void
10check ok add get Checks 0 1
11end
12fn vword off ulong to ulong
13v = ulong 0
14for i ulong 8
15v = or v shl ulong get Vbuf add off i mul i 8
16end
17ret v
18end
19fn vbyte at ulong expected uchar to void
20test eq get Vbuf at expected
21end
22fn verify n ulong to int
23p = ulong 0
24count = ulong 0
25while lt p n
26if or lt sub n p 40 ge count 10
27ret 65
28end
29for i ulong 8
30vbyte add p i get Vmagic i
31end
32op = vword add p 8
33status = vword add p 16
34event = vword add p 24
35size = vword add p 32
36p = add p 40
37if gt size sub n p
38ret 65
39end
40test eq op sub ulong get Ops count 48
41wanted = ulong 1
42if or eq count 2 eq count 4
43wanted = 3
44end
45if eq count 7
46wanted = 3
47end
48test eq status wanted
49if eq count 6
50test eq event 1
51test eq size len Wordsout
52for i ulong len Wordsout
53vbyte add p i get Wordsout i
54end
55else
56test eq event 0
57end
58if eq count 2
59test eq size len Hello
60for i ulong len Hello
61vbyte add p i get Hello i
62end
63end
64if eq count 7
65test eq size len Got
66for i ulong len Got
67vbyte add p i get Got i
68end
69end
70if eq count 4
71test ge size len Jobtail
72if ge size len Jobtail
73at = add p sub size len Jobtail
74for i ulong len Jobtail
75vbyte add at i get Jobtail i
76end
77end
78end
79if and ne wanted 3 ne count 6
80test eq size 0
81end
82p = add p size
83count = add count 1
84end
85test eq count 10
86if ne get Fails 0 0
87ret 1
88end
89ret 0
90end
91fn main to int
92n = ulong 0
93while lt n len Vbuf
94r = read 0 Vbuf n sub len Vbuf n
95if lt r 0
96ret 74
97end
98if eq r 0
99ret verify n
100end
101n = add n ulong r
102end
103ret 65
104end