mirror of
https://github.com/KarolS/millfork.git
synced 2025-04-18 22:41:02 +00:00
more tests
This commit is contained in:
parent
9229092309
commit
1beb695151
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user