From 5e194536a8efcdcd57c6029495eabe1b1a6f735e Mon Sep 17 00:00:00 2001 From: meisl Date: Sun, 11 Jul 2021 18:18:27 +0200 Subject: [PATCH] * refactor compiler tests, again prog8test.helpers (TODO: remove duplication) --- compiler/test/AsmgenTests.kt | 20 +--- compiler/test/Helpers.kt | 101 ++++++++++++++++++ compiler/test/TestCompilerOnCharLit.kt | 69 +++--------- compiler/test/TestCompilerOnExamples.kt | 21 ++-- .../test/TestCompilerOnImportsAndIncludes.kt | 53 +++------ compiler/test/TestMemory.kt | 44 +++----- compiler/test/TestNumbers.kt | 7 +- compiler/test/TestNumericLiteralValue.kt | 11 +- compiler/test/TestPetscii.kt | 6 +- compiler/test/ZeropageTests.kt | 9 +- compilerAst/test/Helpers.kt | 1 - 11 files changed, 173 insertions(+), 169 deletions(-) create mode 100644 compiler/test/Helpers.kt diff --git a/compiler/test/AsmgenTests.kt b/compiler/test/AsmgenTests.kt index 20a77c71d..fe346680e 100644 --- a/compiler/test/AsmgenTests.kt +++ b/compiler/test/AsmgenTests.kt @@ -1,11 +1,10 @@ package prog8tests +import org.junit.jupiter.api.* import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.equalTo -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import prog8.ast.IBuiltinFunctions -import prog8.ast.IMemSizer +import prog8tests.helpers.* + import prog8.ast.Module import prog8.ast.Program import prog8.ast.base.* @@ -17,18 +16,9 @@ import prog8.compiler.target.c64.C64MachineDefinition import prog8.compiler.target.cpu6502.codegen.AsmGen import java.nio.file.Path + @TestInstance(TestInstance.Lifecycle.PER_CLASS) class TestAsmGen6502 { - private class DummyFunctions: IBuiltinFunctions { - override val names: Set = emptySet() - override val purefunctionNames: Set = emptySet() - override fun constValue(name: String, args: List, position: Position, memsizer: IMemSizer): NumericLiteralValue? = null - override fun returnType(name: String, args: MutableList) = InferredTypes.InferredType.unknown() - } - - private class DummyMemsizer: IMemSizer { - override fun memorySize(dt: DataType): Int = 0 - } private fun createTestProgram(): Program { /* @@ -76,7 +66,7 @@ locallabel: val module = Module("test", mutableListOf(block), Position.DUMMY, null) module.linkParents(ParentSentinel) - val program = Program("test", mutableListOf(module), DummyFunctions(), DummyMemsizer()) + val program = Program("test", mutableListOf(module), DummyFunctions, DummyMemsizer) module.program = program return program } diff --git a/compiler/test/Helpers.kt b/compiler/test/Helpers.kt new file mode 100644 index 000000000..00d5f36ff --- /dev/null +++ b/compiler/test/Helpers.kt @@ -0,0 +1,101 @@ +package prog8tests.helpers + +import kotlin.test.* +import kotlin.io.path.* +import java.nio.file.Path + +import prog8.ast.IBuiltinFunctions +import prog8.ast.IMemSizer +import prog8.ast.IStringEncoding +import prog8.ast.base.DataType +import prog8.ast.base.Position +import prog8.ast.expressions.Expression +import prog8.ast.expressions.InferredTypes +import prog8.ast.expressions.NumericLiteralValue +import prog8.compiler.CompilationResult +import prog8.compiler.compileProgram +import prog8.compiler.target.ICompilationTarget + +// TODO: find a way to share with compiler/test/Helpers.kt, while still being able to amend it (-> compileFixture(..)) + +internal fun compileFixture( + filename: String, + platform: ICompilationTarget, + optimize: Boolean = false +) : CompilationResult { + val filepath = fixturesDir.resolve(filename) + assumeReadableFile(filepath) + val result = compileProgram( + filepath, + optimize, + writeAssembly = true, + slowCodegenWarnings = false, + platform.name, + libdirs = listOf(), + outputDir + ) + assertTrue(result.success, "compilation should succeed") + return result +} + +val workingDir = Path("").absolute() // Note: Path(".") does NOT work..! +val fixturesDir = workingDir.resolve("test/fixtures") +val resourcesDir = workingDir.resolve("res") +val outputDir = workingDir.resolve("build/tmp/test") + +inline fun assumeReadable(path: Path) { + assertTrue(path.isReadable(), "sanity check: should be readable: ${path.absolute()}") +} + +inline fun assumeReadableFile(path: Path) { + assertTrue(path.isRegularFile(), "sanity check: should be normal file: ${path.absolute()}") +} + +inline fun assumeDirectory(path: Path) { + assertTrue(path.isDirectory(), "sanity check; should be directory: $path") +} + +inline fun assumeNotExists(path: Path) { + assertFalse(path.exists(), "sanity check: should not exist: ${path.absolute()}") +} + +inline fun sanityCheckDirectories(workingDirName: String? = null) { + if (workingDirName != null) + assertEquals(workingDirName, workingDir.fileName.toString(), "name of current working dir") + assumeDirectory(workingDir) + assumeDirectory(fixturesDir) + assumeDirectory(resourcesDir) + assumeDirectory(outputDir) + +} + + +val DummyEncoding = object : IStringEncoding { + override fun encodeString(str: String, altEncoding: Boolean): List { + TODO("Not yet implemented") + } + + override fun decodeString(bytes: List, altEncoding: Boolean): String { + TODO("Not yet implemented") + } +} + +val DummyFunctions = object : IBuiltinFunctions { + override val names: Set = emptySet() + override val purefunctionNames: Set = emptySet() + override fun constValue( + name: String, + args: List, + position: Position, + memsizer: IMemSizer + ): NumericLiteralValue? = null + + override fun returnType(name: String, args: MutableList) = InferredTypes.InferredType.unknown() +} + +val DummyMemsizer = object : IMemSizer { + override fun memorySize(dt: DataType): Int = 0 +} + + + diff --git a/compiler/test/TestCompilerOnCharLit.kt b/compiler/test/TestCompilerOnCharLit.kt index 43344200e..01561bac2 100644 --- a/compiler/test/TestCompilerOnCharLit.kt +++ b/compiler/test/TestCompilerOnCharLit.kt @@ -1,16 +1,14 @@ package prog8tests -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import kotlin.io.path.* +import org.junit.jupiter.api.* import kotlin.test.* +import prog8tests.helpers.* import prog8.ast.IFunctionCall import prog8.ast.base.DataType import prog8.ast.base.VarDeclType import prog8.ast.expressions.IdentifierReference import prog8.ast.expressions.NumericLiteralValue -import prog8.compiler.compileProgram import prog8.compiler.target.Cx16Target @@ -21,31 +19,16 @@ import prog8.compiler.target.Cx16Target */ @TestInstance(TestInstance.Lifecycle.PER_CLASS) class TestCompilerOnCharLit { - val workingDir = Path("").absolute() // Note: Path(".") does NOT work..! - val fixturesDir = workingDir.resolve("test/fixtures") - val outputDir = workingDir.resolve("build/tmp/test") - @Test - fun sanityCheckDirectories() { - assertEquals("compiler", workingDir.fileName.toString()) - assertTrue(fixturesDir.isDirectory(), "sanity check; should be directory: $fixturesDir") - assertTrue(outputDir.isDirectory(), "sanity check; should be directory: $outputDir") + @BeforeAll + fun setUp() { + sanityCheckDirectories("compiler") } @Test fun testCharLitAsRomsubArg() { - val filepath = fixturesDir.resolve("charLitAsRomsubArg.p8") - val compilationTarget = Cx16Target - val result = compileProgram( - filepath, - optimize = false, - writeAssembly = true, - slowCodegenWarnings = false, - compilationTarget.name, - libdirs = listOf(), - outputDir - ) - assertTrue(result.success, "compilation should succeed") + val platform = Cx16Target + val result = compileFixture("charLitAsRomsubArg.p8", platform) val program = result.programAst val startSub = program.entrypoint() @@ -55,23 +38,14 @@ class TestCompilerOnCharLit { "char literal should have been replaced by ubyte literal") val arg = funCall.args[0] as NumericLiteralValue assertEquals(DataType.UBYTE, arg.type) - assertEquals(compilationTarget.encodeString("\n", false)[0], arg.number) + assertEquals(platform.encodeString("\n", false)[0], arg.number) } @Test fun testCharVarAsRomsubArg() { - val filepath = fixturesDir.resolve("charVarAsRomsubArg.p8") - val compilationTarget = Cx16Target - val result = compileProgram( - filepath, - optimize = false, - writeAssembly = true, - slowCodegenWarnings = false, - compilationTarget.name, - libdirs = listOf(), - outputDir - ) - assertTrue(result.success, "compilation should succeed") + val platform = Cx16Target + val result = compileFixture("charVarAsRomsubArg.p8", platform) + val program = result.programAst val startSub = program.entrypoint() val funCall = startSub.statements.filterIsInstance()[0] @@ -91,23 +65,14 @@ class TestCompilerOnCharLit { "char literal should have been replaced by ubyte literal") val initializerValue = decl.value as NumericLiteralValue assertEquals(DataType.UBYTE, initializerValue.type) - assertEquals(compilationTarget.encodeString("\n", false)[0], initializerValue.number) + assertEquals(platform.encodeString("\n", false)[0], initializerValue.number) } @Test fun testCharConstAsRomsubArg() { - val filepath = fixturesDir.resolve("charConstAsRomsubArg.p8") - val compilationTarget = Cx16Target - val result = compileProgram( - filepath, - optimize = false, - writeAssembly = true, - slowCodegenWarnings = false, - compilationTarget.name, - libdirs = listOf(), - outputDir - ) - assertTrue(result.success, "compilation should succeed") + val platform = Cx16Target + val result = compileFixture("charConstAsRomsubArg.p8", platform) + val program = result.programAst val startSub = program.entrypoint() val funCall = startSub.statements.filterIsInstance()[0] @@ -119,12 +84,12 @@ class TestCompilerOnCharLit { assertEquals(VarDeclType.CONST, decl.type) assertEquals(DataType.UBYTE, decl.datatype) assertEquals( - compilationTarget.encodeString("\n", false)[0], + platform.encodeString("\n", false)[0], (decl.value as NumericLiteralValue).number) } is NumericLiteralValue -> { assertEquals( - compilationTarget.encodeString("\n", false)[0], + platform.encodeString("\n", false)[0], arg.number) } else -> assertIs(funCall.args[0]) // make test fail diff --git a/compiler/test/TestCompilerOnExamples.kt b/compiler/test/TestCompilerOnExamples.kt index b8343f6a1..dec08e28a 100644 --- a/compiler/test/TestCompilerOnExamples.kt +++ b/compiler/test/TestCompilerOnExamples.kt @@ -1,9 +1,8 @@ package prog8tests -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance +import org.junit.jupiter.api.* import kotlin.test.* -import kotlin.io.path.* +import prog8tests.helpers.* import prog8.compiler.compileProgram import prog8.compiler.target.C64Target @@ -17,21 +16,17 @@ import prog8.compiler.target.ICompilationTarget */ @TestInstance(TestInstance.Lifecycle.PER_CLASS) class TestCompilerOnExamples { - val workingDir = Path("").absolute() // Note: Path(".") does NOT work..! - val examplesDir = workingDir.resolve("../examples") - val outputDir = workingDir.resolve("build/tmp/test") + private val examplesDir = workingDir.resolve("../examples") - - @Test - fun sanityCheckDirectories() { - assertEquals("compiler", workingDir.fileName.toString()) - assertTrue(examplesDir.isDirectory(), "sanity check; should be directory: $examplesDir") - assertTrue(outputDir.isDirectory(), "sanity check; should be directory: $outputDir") + @BeforeAll + fun setUp() { + sanityCheckDirectories("compiler") + assumeDirectory(examplesDir) } // TODO: make assembly stage testable - in case of failure (eg of 64tass) it Process.exit s - fun testExample(nameWithoutExt: String, platform: ICompilationTarget, optimize: Boolean) { + private fun testExample(nameWithoutExt: String, platform: ICompilationTarget, optimize: Boolean) { val filepath = examplesDir.resolve("$nameWithoutExt.p8") val result = compileProgram( filepath, diff --git a/compiler/test/TestCompilerOnImportsAndIncludes.kt b/compiler/test/TestCompilerOnImportsAndIncludes.kt index 57d3cf960..835c1ea1f 100644 --- a/compiler/test/TestCompilerOnImportsAndIncludes.kt +++ b/compiler/test/TestCompilerOnImportsAndIncludes.kt @@ -1,9 +1,8 @@ package prog8tests -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import kotlin.io.path.* +import org.junit.jupiter.api.* import kotlin.test.* +import prog8tests.helpers.* import prog8.ast.expressions.AddressOf import prog8.ast.expressions.IdentifierReference @@ -12,6 +11,7 @@ import prog8.ast.statements.FunctionCallStatement import prog8.ast.statements.Label import prog8.compiler.compileProgram import prog8.compiler.target.Cx16Target +import kotlin.io.path.name /** @@ -21,36 +21,21 @@ import prog8.compiler.target.Cx16Target */ @TestInstance(TestInstance.Lifecycle.PER_CLASS) class TestCompilerOnImportsAndIncludes { - val workingDir = Path("").absolute() // Note: Path(".") does NOT work..! - val fixturesDir = workingDir.resolve("test/fixtures") - val outputDir = workingDir.resolve("build/tmp/test") - @Test - fun sanityCheckDirectories() { - assertEquals("compiler", workingDir.fileName.toString()) - assertTrue(fixturesDir.isDirectory(), "sanity check; should be directory: $fixturesDir") - assertTrue(outputDir.isDirectory(), "sanity check; should be directory: $outputDir") + @BeforeAll + fun setUp() { + sanityCheckDirectories("compiler") } @Test fun testImportFromSameFolder() { val filepath = fixturesDir.resolve("importFromSameFolder.p8") val imported = fixturesDir.resolve("foo_bar.p8") + assumeReadableFile(filepath) + assumeReadableFile(imported) - assertTrue(filepath.isRegularFile(), "sanity check; should be regular file: $filepath") - assertTrue(imported.isRegularFile(), "sanity check; should be regular file: $imported") - - val compilationTarget = Cx16Target - val result = compileProgram( - filepath, - optimize = false, - writeAssembly = true, - slowCodegenWarnings = false, - compilationTarget.name, - libdirs = listOf(), - outputDir - ) - assertTrue(result.success, "compilation should succeed") + val platform = Cx16Target + val result = compileFixture(filepath.name, platform) val program = result.programAst val startSub = program.entrypoint() @@ -69,21 +54,11 @@ class TestCompilerOnImportsAndIncludes { fun testAsmIncludeFromSameFolder() { val filepath = fixturesDir.resolve("asmIncludeFromSameFolder.p8") val included = fixturesDir.resolve("foo_bar.asm") + assumeReadableFile(filepath) + assumeReadableFile(included) - assertTrue(filepath.isRegularFile(), "sanity check; should be regular file: $filepath") - assertTrue(included.isRegularFile(), "sanity check; should be regular file: $included") - - val compilationTarget = Cx16Target - val result = compileProgram( - filepath, - optimize = false, - writeAssembly = true, - slowCodegenWarnings = false, - compilationTarget.name, - libdirs = listOf(), - outputDir - ) - assertTrue(result.success, "compilation should succeed") + val platform = Cx16Target + val result = compileFixture(filepath.name, platform) val program = result.programAst val startSub = program.entrypoint() diff --git a/compiler/test/TestMemory.kt b/compiler/test/TestMemory.kt index d0e926aa6..4256398ab 100644 --- a/compiler/test/TestMemory.kt +++ b/compiler/test/TestMemory.kt @@ -1,8 +1,9 @@ package prog8tests -import org.junit.jupiter.api.Test -import prog8.ast.IBuiltinFunctions -import prog8.ast.IMemSizer +import org.junit.jupiter.api.* +import kotlin.test.* +import prog8tests.helpers.* + import prog8.ast.Module import prog8.ast.Program import prog8.ast.base.DataType @@ -12,29 +13,16 @@ import prog8.ast.base.VarDeclType import prog8.ast.expressions.* import prog8.ast.statements.* import prog8.compiler.target.C64Target -import java.nio.file.Path -import kotlin.test.assertFalse -import kotlin.test.assertTrue - +@TestInstance(TestInstance.Lifecycle.PER_CLASS) class TestMemory { - private class DummyFunctions: IBuiltinFunctions { - override val names: Set = emptySet() - override val purefunctionNames: Set = emptySet() - override fun constValue(name: String, args: List, position: Position, memsizer: IMemSizer): NumericLiteralValue? = null - override fun returnType(name: String, args: MutableList) = InferredTypes.InferredType.unknown() - } - - private class DummyMemsizer: IMemSizer { - override fun memorySize(dt: DataType): Int = 0 - } - + @Test fun testInValidRamC64_memory_addresses() { var memexpr = NumericLiteralValue.optimalInteger(0x0000, Position.DUMMY) var target = AssignTarget(null, null, DirectMemoryWrite(memexpr, Position.DUMMY), Position.DUMMY) - val program = Program("test", mutableListOf(), DummyFunctions(), DummyMemsizer()) + val program = Program("test", mutableListOf(), DummyFunctions, DummyMemsizer) assertTrue(C64Target.isInRegularRAM(target, program)) memexpr = NumericLiteralValue.optimalInteger(0x1000, Position.DUMMY) @@ -59,7 +47,7 @@ class TestMemory { var memexpr = NumericLiteralValue.optimalInteger(0xa000, Position.DUMMY) var target = AssignTarget(null, null, DirectMemoryWrite(memexpr, Position.DUMMY), Position.DUMMY) - val program = Program("test", mutableListOf(), DummyFunctions(), DummyMemsizer()) + val program = Program("test", mutableListOf(), DummyFunctions, DummyMemsizer) assertFalse(C64Target.isInRegularRAM(target, program)) memexpr = NumericLiteralValue.optimalInteger(0xafff, Position.DUMMY) @@ -78,7 +66,7 @@ class TestMemory { @Test fun testInValidRamC64_memory_identifiers() { var target = createTestProgramForMemoryRefViaVar(0x1000, VarDeclType.VAR) - val program = Program("test", mutableListOf(), DummyFunctions(), DummyMemsizer()) + val program = Program("test", mutableListOf(), DummyFunctions, DummyMemsizer) assertTrue(C64Target.isInRegularRAM(target, program)) target = createTestProgramForMemoryRefViaVar(0xd020, VarDeclType.VAR) @@ -107,7 +95,7 @@ class TestMemory { fun testInValidRamC64_memory_expression() { val memexpr = PrefixExpression("+", NumericLiteralValue.optimalInteger(0x1000, Position.DUMMY), Position.DUMMY) val target = AssignTarget(null, null, DirectMemoryWrite(memexpr, Position.DUMMY), Position.DUMMY) - val program = Program("test", mutableListOf(), DummyFunctions(), DummyMemsizer()) + val program = Program("test", mutableListOf(), DummyFunctions, DummyMemsizer) assertFalse(C64Target.isInRegularRAM(target, program)) } @@ -118,7 +106,7 @@ class TestMemory { val assignment = Assignment(target, NumericLiteralValue.optimalInteger(0, Position.DUMMY), Position.DUMMY) val subroutine = Subroutine("test", emptyList(), emptyList(), emptyList(), emptyList(), emptySet(), null, false, false, mutableListOf(decl, assignment), Position.DUMMY) val module = Module("test", mutableListOf(subroutine), Position.DUMMY, null) - val program = Program("test", mutableListOf(module), DummyFunctions(), DummyMemsizer()) + val program = Program("test", mutableListOf(module), DummyFunctions, DummyMemsizer) module.linkParents(ParentSentinel) assertTrue(C64Target.isInRegularRAM(target, program)) } @@ -131,7 +119,7 @@ class TestMemory { val assignment = Assignment(target, NumericLiteralValue.optimalInteger(0, Position.DUMMY), Position.DUMMY) val subroutine = Subroutine("test", emptyList(), emptyList(), emptyList(), emptyList(), emptySet(), null, false, false, mutableListOf(decl, assignment), Position.DUMMY) val module = Module("test", mutableListOf(subroutine), Position.DUMMY, null) - val program = Program("test", mutableListOf(module), DummyFunctions(), DummyMemsizer()) + val program = Program("test", mutableListOf(module), DummyFunctions, DummyMemsizer) module.linkParents(ParentSentinel) assertTrue(C64Target.isInRegularRAM(target, program)) } @@ -144,7 +132,7 @@ class TestMemory { val assignment = Assignment(target, NumericLiteralValue.optimalInteger(0, Position.DUMMY), Position.DUMMY) val subroutine = Subroutine("test", emptyList(), emptyList(), emptyList(), emptyList(), emptySet(), null, false, false, mutableListOf(decl, assignment), Position.DUMMY) val module = Module("test", mutableListOf(subroutine), Position.DUMMY, null) - val program = Program("test", mutableListOf(module), DummyFunctions(), DummyMemsizer()) + val program = Program("test", mutableListOf(module), DummyFunctions, DummyMemsizer) module.linkParents(ParentSentinel) assertFalse(C64Target.isInRegularRAM(target, program)) } @@ -157,7 +145,7 @@ class TestMemory { val assignment = Assignment(target, NumericLiteralValue.optimalInteger(0, Position.DUMMY), Position.DUMMY) val subroutine = Subroutine("test", emptyList(), emptyList(), emptyList(), emptyList(), emptySet(), null, false, false, mutableListOf(decl, assignment), Position.DUMMY) val module = Module("test", mutableListOf(subroutine), Position.DUMMY, null) - val program = Program("test", mutableListOf(module), DummyFunctions(), DummyMemsizer()) + val program = Program("test", mutableListOf(module), DummyFunctions, DummyMemsizer) module.linkParents(ParentSentinel) assertTrue(C64Target.isInRegularRAM(target, program)) } @@ -171,7 +159,7 @@ class TestMemory { val assignment = Assignment(target, NumericLiteralValue.optimalInteger(0, Position.DUMMY), Position.DUMMY) val subroutine = Subroutine("test", emptyList(), emptyList(), emptyList(), emptyList(), emptySet(), null, false, false, mutableListOf(decl, assignment), Position.DUMMY) val module = Module("test", mutableListOf(subroutine), Position.DUMMY, null) - val program = Program("test", mutableListOf(module), DummyFunctions(), DummyMemsizer()) + val program = Program("test", mutableListOf(module), DummyFunctions, DummyMemsizer) module.linkParents(ParentSentinel) assertTrue(C64Target.isInRegularRAM(target, program)) } @@ -185,7 +173,7 @@ class TestMemory { val assignment = Assignment(target, NumericLiteralValue.optimalInteger(0, Position.DUMMY), Position.DUMMY) val subroutine = Subroutine("test", emptyList(), emptyList(), emptyList(), emptyList(), emptySet(), null, false, false, mutableListOf(decl, assignment), Position.DUMMY) val module = Module("test", mutableListOf(subroutine), Position.DUMMY, null) - val program = Program("test", mutableListOf(module), DummyFunctions(), DummyMemsizer()) + val program = Program("test", mutableListOf(module), DummyFunctions, DummyMemsizer) module.linkParents(ParentSentinel) assertFalse(C64Target.isInRegularRAM(target, program)) } diff --git a/compiler/test/TestNumbers.kt b/compiler/test/TestNumbers.kt index 1de09e330..499db45d7 100644 --- a/compiler/test/TestNumbers.kt +++ b/compiler/test/TestNumbers.kt @@ -1,17 +1,16 @@ package prog8tests +import org.junit.jupiter.api.* +import kotlin.test.* import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.closeTo import org.hamcrest.Matchers.equalTo -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance + import prog8.ast.toHex import prog8.compiler.CompilerException import prog8.compiler.target.c64.C64MachineDefinition.FLOAT_MAX_NEGATIVE import prog8.compiler.target.c64.C64MachineDefinition.FLOAT_MAX_POSITIVE import prog8.compiler.target.c64.C64MachineDefinition.Mflpt5 -import kotlin.test.assertEquals -import kotlin.test.assertFailsWith @TestInstance(TestInstance.Lifecycle.PER_CLASS) class TestNumbers { diff --git a/compiler/test/TestNumericLiteralValue.kt b/compiler/test/TestNumericLiteralValue.kt index 00666de65..22d9ae03e 100644 --- a/compiler/test/TestNumericLiteralValue.kt +++ b/compiler/test/TestNumericLiteralValue.kt @@ -1,19 +1,14 @@ package prog8tests -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance +import org.junit.jupiter.api.* +import kotlin.test.* + import prog8.ast.base.DataType import prog8.ast.base.Position import prog8.ast.expressions.ArrayLiteralValue import prog8.ast.expressions.InferredTypes import prog8.ast.expressions.NumericLiteralValue import prog8.ast.expressions.StringLiteralValue -import kotlin.test.assertEquals -import kotlin.test.assertFalse -import kotlin.test.assertNotEquals -import kotlin.test.assertTrue - - @TestInstance(TestInstance.Lifecycle.PER_CLASS) class TestNumericLiteralValue { diff --git a/compiler/test/TestPetscii.kt b/compiler/test/TestPetscii.kt index c83657810..0fcc9a2dc 100644 --- a/compiler/test/TestPetscii.kt +++ b/compiler/test/TestPetscii.kt @@ -1,15 +1,15 @@ package prog8tests +import org.junit.jupiter.api.* +import kotlin.test.* import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.equalTo -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance + import prog8.ast.base.DataType import prog8.ast.base.Position import prog8.ast.expressions.NumericLiteralValue import prog8.ast.expressions.StringLiteralValue import prog8.compiler.target.cbm.Petscii -import kotlin.test.* @TestInstance(TestInstance.Lifecycle.PER_CLASS) diff --git a/compiler/test/ZeropageTests.kt b/compiler/test/ZeropageTests.kt index 8e2a3a6b7..4ece96e5e 100644 --- a/compiler/test/ZeropageTests.kt +++ b/compiler/test/ZeropageTests.kt @@ -1,17 +1,14 @@ package prog8tests -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance +import org.junit.jupiter.api.* +import kotlin.test.* + import prog8.ast.base.DataType import prog8.compiler.* import prog8.compiler.target.C64Target import prog8.compiler.target.Cx16Target import prog8.compiler.target.c64.C64MachineDefinition.C64Zeropage import prog8.compiler.target.cx16.CX16MachineDefinition.CX16Zeropage -import kotlin.test.assertEquals -import kotlin.test.assertFailsWith -import kotlin.test.assertFalse -import kotlin.test.assertTrue @TestInstance(TestInstance.Lifecycle.PER_CLASS) diff --git a/compilerAst/test/Helpers.kt b/compilerAst/test/Helpers.kt index 48748b43d..0ffc8a5a4 100644 --- a/compilerAst/test/Helpers.kt +++ b/compilerAst/test/Helpers.kt @@ -47,7 +47,6 @@ inline fun sanityCheckDirectories(workingDirName: String? = null) { } - val DummyEncoding = object : IStringEncoding { override fun encodeString(str: String, altEncoding: Boolean): List { TODO("Not yet implemented")