From ef2f5b59187e5dedcbf6b36ce657f211358cb465 Mon Sep 17 00:00:00 2001 From: Karol Stasiak Date: Fri, 11 Feb 2022 21:48:24 +0100 Subject: [PATCH] Add test --- .../millfork/test/ReturnDispatchSuite.scala | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/scala/millfork/test/ReturnDispatchSuite.scala b/src/test/scala/millfork/test/ReturnDispatchSuite.scala index 938010ac..47cbff7c 100644 --- a/src/test/scala/millfork/test/ReturnDispatchSuite.scala +++ b/src/test/scala/millfork/test/ReturnDispatchSuite.scala @@ -167,4 +167,22 @@ class ReturnDispatchSuite extends FunSuite with Matchers { | void success() {} """.stripMargin) } + test("Optimization test") { + EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Motorola6809)( + """ + | byte output @$c000 + | void main () { + | if true { + | return [1] { + | 1 @ success + | } + | } + | } + | void success() { + | output = 42 + | } + """.stripMargin) { m => + m.readByte(0xc000) should equal(42) + } + } }