From cb4b62501eccfda8db83b7fa56182191e4ced8b6 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Thu, 16 May 2024 15:42:34 -0700 Subject: [PATCH] Fix tests --- .../kotlin/explorer/code/CodeBuilderTest.kt | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/jvmTest/kotlin/dev/romainguy/kotlin/explorer/code/CodeBuilderTest.kt b/src/jvmTest/kotlin/dev/romainguy/kotlin/explorer/code/CodeBuilderTest.kt index bce01a07..551d6c3b 100644 --- a/src/jvmTest/kotlin/dev/romainguy/kotlin/explorer/code/CodeBuilderTest.kt +++ b/src/jvmTest/kotlin/dev/romainguy/kotlin/explorer/code/CodeBuilderTest.kt @@ -7,13 +7,13 @@ class CodeBuilderTest { @Test fun sourceToCodeMapping() { val code = buildCode { - writeInstruction(Instruction(address = 1, code = "m1 1", jumpAddress = null, lineNumber = 1)) - writeInstruction(Instruction(address = 2, code = "m1 2", jumpAddress = null, lineNumber = null)) - writeInstruction(Instruction(address = 3, code = "m1 3", jumpAddress = null, lineNumber = 2)) + writeInstruction(Instruction(address = 1, code = "m1 1", jumpAddress = -1, lineNumber = 1)) + writeInstruction(Instruction(address = 2, code = "m1 2", jumpAddress = -1, lineNumber = -1)) + writeInstruction(Instruction(address = 3, code = "m1 3", jumpAddress = -1, lineNumber = 2)) endMethod() - writeInstruction(Instruction(address = 1, code = "m2 1", jumpAddress = null, lineNumber = 3)) - writeInstruction(Instruction(address = 2, code = "m2 2", jumpAddress = null, lineNumber = null)) - writeInstruction(Instruction(address = 3, code = "m2 3", jumpAddress = null, lineNumber = 4)) + writeInstruction(Instruction(address = 1, code = "m2 1", jumpAddress = -1, lineNumber = 3)) + writeInstruction(Instruction(address = 2, code = "m2 2", jumpAddress = -1, lineNumber = -1)) + writeInstruction(Instruction(address = 3, code = "m2 3", jumpAddress = -1, lineNumber = 4)) }.build() assertThat(code.text.trimIndent()).isEqualTo( @@ -33,13 +33,13 @@ class CodeBuilderTest { @Test fun codeToSourceMapping() { val code = buildCode { - writeInstruction(Instruction(address = 1, code = "m1 1", jumpAddress = null, lineNumber = 1)) - writeInstruction(Instruction(address = 2, code = "m1 2", jumpAddress = null, lineNumber = null)) - writeInstruction(Instruction(address = 3, code = "m1 3", jumpAddress = null, lineNumber = 2)) + writeInstruction(Instruction(address = 1, code = "m1 1", jumpAddress = -1, lineNumber = 1)) + writeInstruction(Instruction(address = 2, code = "m1 2", jumpAddress = -1, lineNumber = -1)) + writeInstruction(Instruction(address = 3, code = "m1 3", jumpAddress = -1, lineNumber = 2)) endMethod() - writeInstruction(Instruction(address = 1, code = "m2 1", jumpAddress = null, lineNumber = 3)) - writeInstruction(Instruction(address = 2, code = "m2 2", jumpAddress = null, lineNumber = null)) - writeInstruction(Instruction(address = 3, code = "m2 3", jumpAddress = null, lineNumber = 4)) + writeInstruction(Instruction(address = 1, code = "m2 1", jumpAddress = -1, lineNumber = 3)) + writeInstruction(Instruction(address = 2, code = "m2 2", jumpAddress = -1, lineNumber = -1)) + writeInstruction(Instruction(address = 3, code = "m2 3", jumpAddress = -1, lineNumber = 4)) }.build() val text = code.text.trimIndent()