-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathday12_tests.tal
92 lines (78 loc) · 1.79 KB
/
day12_tests.tal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
~library/macros.tal
~library/devices.tal
( variables )
|0000
|0100 @program
T< "parse-line: >T
S< >S ;test-parse-line JSR2 ( EXPECT 0x00 )
S< "start-end 0a 'A >S ;test-parse-line JSR2 ( EXPECT 0x01 st-en )
;get-byte-from-input JSR2 EMIT LF ( EXPECT A )
S< "AB-CD 0a >S ;test-parse-line JSR2 ( EXPECT 0x01 AB-CD CD-AB )
S< "start-AB 0a >S ;test-parse-line JSR2 ( EXPECT 0x01 st-AB )
S< "AB-end 0a >S ;test-parse-line JSR2 ( EXPECT 0x01 AB-en )
T< "parse-lines: >T
S<
"AB-CD 0a
"start-AB 0a
"AB-end 0a
>S ;test-parse-lines JSR2 ( EXPECT AB-CD CD-AB st-AB AB-en )
T< "walk-paths: >T
S<
"start-ab 0a
"start-bc 0a
"ab-bc 0a
"bc-end 0a
>S ;test-walk-paths JSR2
( EXPECT st-ab st-bc ab-bc bc-ab bc-en )
( EXPECT stabbcen. )
( EXPECT stbcabbcen. )
( EXPECT stbcen. )
( EXPECT 3 )
S<
"start-AB 0a
"AB-bc 0a
"AB-end 0a
>S ;test-walk-paths JSR2
( EXPECT st-AB AB-bc bc-AB AB-en )
( EXPECT stABbcABbcABen. )
( EXPECT stABbcABen. )
( EXPECT stABen. )
( EXPECT 3 )
T< "👍 >T
BRK !
~day12_lib.tal
~library/test.tal
( s* -- )
@test-parse-line
;init-paths JSR2
;make-get-byte JSR2 ;parse-line JSR2 DBGBYTEn POP SP
;dump-paths JSR2
LF
RTN
( s* -- )
@test-parse-lines
;init-paths JSR2
;make-get-byte JSR2 ;parse-lines JSR2
;dump-paths JSR2
LF
RTN
( s* -- )
@test-walk-paths
;init-paths JSR2
;make-get-byte JSR2 ;parse-lines JSR2
;dump-paths JSR2 LF
;walk-paths JSR2
;path-count ;print64 JSR2 LF
RTN
( s* -- get-byte )
@make-get-byte
;input STA2
;get-byte-from-input
RTN
( -- b )
@get-byte-from-input
[ ;input LDA2 ] LDA STH
[ ;input LDA2 ] INC2 [ ;input STA2 ]
STHr
RTN
@input $2