mirror of
https://github.com/KarolS/millfork.git
synced 2024-06-11 15:29:34 +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)
|
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 => }
|
|""".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…
Reference in New Issue
Block a user