Skip to content

Commit f2f8a98

Browse files
committed
Add runtime tests for this case
1 parent 2515cec commit f2f8a98

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

tests/runtime/cases/arr_addr.bas

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
REM test @arr(x, y) for GLOBAL scope
2+
3+
#include "lib/tst_framework.bas"
4+
INIT("Testing @ARRAY(a, b, c...)")
5+
6+
DIM aglobal(2, 2) as UByte => {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}}
7+
PRINT aglobal(1, 1); " -> ";
8+
POKE @aglobal(1, 1), 99
9+
PRINT aglobal(1, 1); " ";
10+
SHOW_RESULTLN(aglobal(1, 1) = 99)
11+
12+
13+
SUB test1
14+
REM test @arr(x, y) for LOCAL scope
15+
DIM alocal(2, 2) as UByte => {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}}
16+
PRINT alocal(1, 1); " -> ";
17+
POKE @alocal(1, 1), 99
18+
PRINT alocal(1, 1); " ";
19+
SHOW_RESULTLN(alocal(1, 1) = 99)
20+
END SUB
21+
test1
22+
23+
24+
DIM aglobal1(2, 2) as UByte => {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}}
25+
SUB test2(alocal() as UByte)
26+
REM test @arr(x, y) for PARAM scope
27+
PRINT alocal(1, 1); " -> ";
28+
POKE @alocal(1, 1), 99
29+
PRINT alocal(1, 1); " ";
30+
SHOW_RESULTLN(alocal(1, 1) = 99)
31+
32+
END SUB
33+
test2(aglobal1)
34+
35+
FINISH
6.75 KB
Binary file not shown.

0 commit comments

Comments
 (0)