more tests

This commit is contained in:
Karol Stasiak 2023-01-27 18:16:36 +01:00
parent 9229092309
commit 1beb695151
2 changed files with 41 additions and 0 deletions

View File

@ -714,4 +714,21 @@ class ArraySuite extends FunSuite with Matchers with AppendedClues {
m.readByte(0x4008) should equal('9'.toInt)
}
}
test("Arrays of pointers") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos)(
"""
|const array arr1 = [1, 2, 3]
|const array arr2 = [101, 102, 103]
|array(pointer) arrs = [ arr1, arr2 ]
|byte output @$c000
|void main() {
| pointer p
| p = arrs[1]
| output = p[0]
|}
""".stripMargin) { m =>
m.readByte(0xc000) should equal(101)
}
}
}

View File

@ -362,4 +362,28 @@ class StructSuite extends FunSuite with Matchers {
| }
|""".stripMargin){m => }
}
test("Assigning struct fields via pointers") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086, Cpu.Motorola6809)("""
struct STRUCT1 { word a }
struct STRUCT2 { word b }
pointer.STRUCT1 pS1
pointer.STRUCT2 pS2
STRUCT1 s1 @$c000
STRUCT2 s2
noinline void f() {
pS1->a = pS2->b
}
void main() {
s2.b = $405
pS1 = s1.pointer
pS2 = s2.pointer
f()
}
"""){m =>
m.readWord(0xc000) should equal(0x405)
}
}
}