File tree Expand file tree Collapse file tree 2 files changed +36
-13
lines changed Expand file tree Collapse file tree 2 files changed +36
-13
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,28 @@ def test_misc7(self):
137137 """ )
138138
139139 assert test .varWord ('a' ) == 1
140-
141-
142-
140+
141+
142+ def test_misc8 (self ):
143+
144+ test .runCode ("""
145+ var
146+ p: PByte;
147+ ptr: pointer;
148+ i: byte;
149+
150+ tb, bf: array [0..31] of byte;
151+
152+ begin
153+ ptr:=pointer($3043);
154+ i:=3;
155+ tb[3] := $a3;
156+ bf[3] := $9a;
157+
158+ p:=pointer(ptr + tb[i] + bf[i] shl 8);
159+
160+ end.
161+ """ )
162+
163+ assert test .varWord ('p' ) == 51942
164+
Original file line number Diff line number Diff line change 55
66class Test_Structs :
77
8- @pytest .mark .skip (reason = "don't know how packed record works, so unable to assert properly (bocianu)" )
98 def test_struct1 (self ):
109
1110 test .runCode ("""
@@ -35,12 +34,12 @@ def test_struct1(self):
3534 end.
3635
3736 """ )
38-
39- monsteradr = mem . readWord ( labels [ 'MAIN.MONSTER' ] )
40- for i in range ( 0 , 4 ):
41- monster = mem . readWord ( monsteradr ) + i * 2
42- assert mem . read ( monster ) == i
43- # assert mem.read(monster+6 ) == i * 2;
37+
38+ monsterArrayAddress = test . varWord ( 'monster' )
39+ monstersArray = test . getArray ( monsterArrayAddress , 4 , element_size = 2 )
40+ for i in range ( 0 , 3 ):
41+ assert test . getByte ( monstersArray [ i ] ) == i
42+ assert test . getByte ( monstersArray [ i ] + 5 ) == i * 2
4443
4544
4645 def test_struct2 (self ):
@@ -68,10 +67,10 @@ def test_struct2(self):
6867
6968 end.
7069 """ )
71-
70+
7271 monsterArrayAddress = test .varWord ('monster' )
7372 monstersArray = test .getArray (monsterArrayAddress , 4 , element_size = 2 )
74- for i in range (0 ,4 ):
73+ for i in range (0 ,3 ):
7574 assert test .getByte (monstersArray [i ]) == i
7675 assert test .getByte (monstersArray [i ] + 1 ) == i * 2
7776
@@ -99,5 +98,7 @@ def test_struct3(self):
9998
10099 end.
101100 """ )
102-
101+
103102 assert test .varWord ('w' ) == 2000
103+
104+
You can’t perform that action at this time.
0 commit comments