main pita/uxn12 / etc / tests / console.tal
 1( 54K . printf "ghi" | uxncli console.rom "abc" "def" )
 2
 3|10 @Console/vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
 4|0050 @Varvara/version
 5
 6|100
 7
 8@on-reset ( -> )
 9	;meta #06 DEO2
10	;on-console .Console/vector DEO2
11	BRK
12
13@meta 00
14	( name ) "Console 20 "Device 20 "Test(80K) 0a
15	( details ) "Testing 20 "Program 0a
16	( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
17	( date ) "24 20 "Jun 20 "2026 00
18	( . ) 01
19	( - ) 56 =Varvara/version
20
21@on-console ( -> )
22	.Console/type DEI .Console/read DEI
23	( inc ) [ LIT2 &ptr =expect ] INC2k INC2 ,&ptr STR2
24	DUP2 ;expect/end EQU2 ?pass
25	LDA2 NEQ2 ?fail
26	BRK
27
28@fail ( -> )
29	;dict/fail str/<print>
30	#010f DEO
31	BRK
32
33@pass ( type read ptr* -> )
34	POP2 POP2 ;dict/pass str/<print>
35	#800f DEO
36	BRK
37
38(
39@|Utils )
40
41@str/<print> ( str* -- )
42	LDAk DUP ?{ POP POP2 JMP2r }
43	#18 DEO
44	INC2 !/<print>
45
46(
47@|Data )
48
49@expect [
50	02 "a 02 "b 02 "c 03 0a 02 "d 02 "e 02 "f 04 0a
51	01 "g 01 "h 01 "i ]
52	&end [ 04 0a ]
53
54@dict
55	&pass "Console: 20 "pass 0a $1
56	&fail "Console: 20 "fail 0a $1
57