commit ecaa3f0

Devine Lu Linvega  ·  2025-07-01 02:48:13 +0000 UTC
parent 43baadf
Improved expansion tests
1 files changed,  +26, -20
+26, -20
 1@@ -2,48 +2,54 @@
 2 |100
 3 
 4 @on-reset ( -> )
 5-	;buf <pstr>
 6-	#2018 DEO
 7-	;buf <pstr>
 8-	#0a18 DEO
 9+	#800f DEO
10 	( | copy left )
11 	;buf #0006 ADD2 ;mmu-cpyl/a STA2
12 	;buf #0003 ADD2 ;mmu-cpyl/b STA2
13 	;mmu-cpyl .System/expansion DEO2
14-	;buf <pstr>
15-	#2018 DEO
16-	;res1 <pstr>
17-	#0a18 DEO
18+	;buf ;res1 ;dict/cpyl <test>
19 	( | copy right )
20 	;buf #0003 ADD2 ;mmu-cpyr/a STA2
21 	;buf #0009 ADD2 ;mmu-cpyr/b STA2
22 	;mmu-cpyr .System/expansion DEO2
23-	;buf <pstr>
24-	#2018 DEO
25-	;res2 <pstr>
26-	#0a18 DEO
27+	;buf ;res2 ;dict/cpyr <test>
28 	( | copy left )
29 	;buf #0009 ADD2 ;mmu-cpyl/a STA2
30 	;buf #0006 ADD2 ;mmu-cpyl/b STA2
31 	;mmu-cpyl .System/expansion DEO2
32-	;buf <pstr>
33-	#2018 DEO
34-	;res3 <pstr>
35-	#0a18 DEO
36+	;buf ;res3 ;dict/cpyl <test>
37 	( | memset )
38 	;buf #0003 ADD2 ;mmu-fill/a STA2
39 	;mmu-fill .System/expansion DEO2
40-	;buf <pstr>
41-	#2018 DEO
42-	;res4 <pstr>
43-	#0a18 DEO
44+	;buf ;res4 ;dict/fill <test>
45 	BRK
46 
47+@<test> ( a* b* -- )
48+	<pstr>
49+	#0013 SWP2 mem/cmp ?{
50+		#010f DEO ;dict/fail !<pstr> }
51+	;dict/pass !<pstr>
52+
53 @<pstr> ( str* -- )
54 	LDAk #18 DEO
55 	INC2 LDAk ?<pstr>
56 	POP2 JMP2r
57 
58+@mem/cmp ( a* length* b* -- t )
59+	STH2
60+	OVR2 ADD2 SWP2
61+	&>l
62+		EQU2k ?{
63+			LDAk LDAkr STHr NEQ ?{ INC2 INC2r !&>l } }
64+	POP2r EQU2 JMP2r
65+
66+@dict
67+	&cpyl "Expansion/cpyl: 20 $1
68+	&cpyr "Expansion/cpyr: 20 $1
69+	&fill "Expansion/fill: 20 $1
70+	&pass "pass 0a $1
71+	&fail "FAIL 0a $1
72+
73 @buf  [ "......[hello]..... $1 ]
74 @res1 [ "...[hello]lo]..... $1 ]
75 @res2 [ "...[hello[hello].. $1 ]