1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-12-24 15:29:23 +00:00

Some tests that would have prevented few latest commits

This commit is contained in:
Karol Stasiak 2020-03-26 01:47:26 +01:00
parent 59882cf765
commit 78070c115f
2 changed files with 37 additions and 1 deletions

View File

@ -310,4 +310,22 @@ class BasicSymonTest extends FunSuite with Matchers {
| }
|""".stripMargin){_=>}
}
test("Lookup") {
EmuUnoptimizedRun(
"""
|noinline byte f() = 1
|void g() @$5 extern
|alias h = f
|alias i = g
|
|void main() {
| if f() != 1 {
| g()
| h()
| i()
| }
|}
|""".stripMargin)
}
}

View File

@ -1,7 +1,7 @@
package millfork.test
import millfork.Cpu
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun}
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUnoptimizedRun, ShouldNotCompile}
import org.scalatest.{FunSuite, Matchers}
/**
@ -9,6 +9,24 @@ import org.scalatest.{FunSuite, Matchers}
*/
class LongTest extends FunSuite with Matchers {
test("Long constants") {
EmuUnoptimizedRun(
"""
|const long x1 = 0
|const long x2 = 3
|const long x3 = $ffffffff
|const int24 x4 = 0
|const int24 x5 = 3
|const int24 x6 = $ffffff
|void main() {}
|""".stripMargin)
ShouldNotCompile(
"""
|const int24 x1 = $ffffffff
|void main() {}
|""".stripMargin)
}
test("Long assignment") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
"""