commit db118a4

Devine Lu Linvega  ·  2026-06-21 18:09:46 +0000 UTC
parent f7f5896
(File) Added test for partial dir read
1 files changed,  +28, -2
+28, -2
 1@@ -20,7 +20,8 @@
 2 	;dict/stat-of file/test-stat-of <test>
 3 	( | dir )
 4 	;dict/dir-spacer file/test-dir-spacer <test>
 5-	( | cleanup )
 6+	;dict/dir-partial file/test-dir-partial <test>
 7+	( ;dict/dir-nostream file/test-dir-nostream <test> ) ( | cleanup )
 8 	;file/name .File/name DEO2
 9 	#01 .File/delete DEO
10 	BRK
11@@ -108,6 +109,22 @@
12 
13 	&dirpath ". 00
14 
15+@file/test-dir-partial ( -- pass )
16+	( a ) LIT "~ ;&dirbuf #0007 ADD2 STA
17+	( b ) LIT "~ ;&dirbuf #0009 ADD2 STA
18+	;&dirpath .File/name DEO2
19+	#0008 .File/length DEO2
20+	;&dirbuf .File/read DEO2
21+	( b ) LIT "~ ;&dirbuf #0009 ADD2 LDA EQU
22+	( a ) LIT "~ ;&dirbuf #0007 ADD2 LDA NEQ AND JMP2r
23+
24+@file/test-dir-nostream ( -- pass )
25+	;&dirpath .File/name DEO2
26+	#0008 .File/length DEO2
27+	;&bufa .File/read DEO2
28+	;&bufb .File/read DEO2
29+	;&bufa ;&bufb !str/cmp
30+
31 (
32 @|Helpers )
33 
34@@ -125,6 +142,13 @@
35 	.Console/write DEO
36 	INC2 !/<print>
37 
38+@str/cmp ( a* b* -- f )
39+	STH2
40+	&>wc
41+		LDAk ?{ &d LDA LDAr STHr EQU JMP2r }
42+		LDAk LDAkr STHr NEQ ?&d
43+		INC2 INC2r !&>wc
44+
45 (
46 @|Assets )
47 
48@@ -137,6 +161,8 @@
49 	&read-of "File/read(overflow): 20 $1
50 	&stat-of "File/stat(overflow): 20 $1
51 	&dir-spacer "File/dir(spacer): 20 $1
52+	&dir-nostream "File/dir(nostream): 20 $1
53+	&dir-partial "File/dir(partial): 20 $1
54 	&fail "fail 0a $1
55 	&pass "pass 0a $1
56 
57@@ -145,5 +171,5 @@
58 	( stat buf ) &stat-buf &stat-hs $2 &stat-ls $2
59 	( null buf ) &null-buf $4
60 	&name "test.txt $1
61-	&unknown-name "abcdefghj $1 &dirbuf $200
62+	&unknown-name "abcdefghj $1 &dirbuf $200 &bufa $8 &bufb $8
63