From 78070c115fb1bd8f85d3f9264dd547a1f9834a6a Mon Sep 17 00:00:00 2001 From: Karol Stasiak Date: Thu, 26 Mar 2020 01:47:26 +0100 Subject: [PATCH] Some tests that would have prevented few latest commits --- .../scala/millfork/test/BasicSymonTest.scala | 18 +++++++++++++++++ src/test/scala/millfork/test/LongTest.scala | 20 ++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/test/scala/millfork/test/BasicSymonTest.scala b/src/test/scala/millfork/test/BasicSymonTest.scala index 58e79334..ea4c31bc 100644 --- a/src/test/scala/millfork/test/BasicSymonTest.scala +++ b/src/test/scala/millfork/test/BasicSymonTest.scala @@ -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) + } } diff --git a/src/test/scala/millfork/test/LongTest.scala b/src/test/scala/millfork/test/LongTest.scala index e78f3173..b03952fa 100644 --- a/src/test/scala/millfork/test/LongTest.scala +++ b/src/test/scala/millfork/test/LongTest.scala @@ -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)( """