mirror of
https://github.com/irmen/prog8.git
synced 2024-12-22 03:29:41 +00:00
improve data driven unit tests to use kotest withData()
This commit is contained in:
parent
c5b7edad82
commit
edc5a5a94f
23
.idea/libraries/io_kotest_framework_datatest.xml
generated
Normal file
23
.idea/libraries/io_kotest_framework_datatest.xml
generated
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="io.kotest.framework.datatest" type="repository">
|
||||||
|
<properties maven-id="io.kotest:kotest-framework-datatest:5.9.1" />
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-datatest/5.9.1/kotest-framework-datatest-5.9.1.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-datatest-jvm/5.9.1/kotest-framework-datatest-jvm-5.9.1.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.23/kotlin-stdlib-1.9.23.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.8.0/kotlinx-coroutines-core-jvm-1.8.0.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-common-jvm/5.9.1/kotest-common-jvm-5.9.1.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.9.23/kotlin-reflect-1.9.23.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-api-jvm/5.9.1/kotest-framework-api-jvm-5.9.1.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-shared-jvm/5.9.1/kotest-assertions-shared-jvm-5.9.1.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-api-jvm/5.9.1/kotest-assertions-api-jvm-5.9.1.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-jdk8/1.8.0/kotlinx-coroutines-jdk8-1.8.0.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/io/github/java-diff-utils/java-diff-utils/4.12/java-diff-utils-4.12.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-test-jvm/1.8.0/kotlinx-coroutines-test-jvm-1.8.0.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</component>
|
@ -28,6 +28,7 @@ dependencies {
|
|||||||
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:2.0.0"
|
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:2.0.0"
|
||||||
|
|
||||||
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.9.1'
|
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.9.1'
|
||||||
|
testImplementation 'io.kotest:kotest-framework-datatest:5.9.1'
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
|
||||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
}
|
}
|
||||||
|
@ -14,5 +14,6 @@
|
|||||||
<orderEntry type="library" name="michael.bull.kotlin.result.jvm" level="project" />
|
<orderEntry type="library" name="michael.bull.kotlin.result.jvm" level="project" />
|
||||||
<orderEntry type="library" name="io.kotest.assertions.core.jvm" level="project" />
|
<orderEntry type="library" name="io.kotest.assertions.core.jvm" level="project" />
|
||||||
<orderEntry type="library" name="io.kotest.runner.junit5.jvm" level="project" />
|
<orderEntry type="library" name="io.kotest.runner.junit5.jvm" level="project" />
|
||||||
|
<orderEntry type="library" name="io.kotest.framework.datatest" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -31,6 +31,7 @@ dependencies {
|
|||||||
|
|
||||||
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.9.1'
|
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.9.1'
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
|
||||||
|
testImplementation 'io.kotest:kotest-framework-datatest:5.9.1'
|
||||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
<orderEntry type="module" module-name="intermediate" />
|
<orderEntry type="module" module-name="intermediate" />
|
||||||
<orderEntry type="library" name="io.kotest.assertions.core.jvm" level="project" />
|
<orderEntry type="library" name="io.kotest.assertions.core.jvm" level="project" />
|
||||||
<orderEntry type="library" name="io.kotest.runner.junit5.jvm" level="project" />
|
<orderEntry type="library" name="io.kotest.runner.junit5.jvm" level="project" />
|
||||||
|
<orderEntry type="library" name="io.kotest.framework.datatest" level="project" />
|
||||||
<orderEntry type="library" name="michael.bull.kotlin.result.jvm" level="project" />
|
<orderEntry type="library" name="michael.bull.kotlin.result.jvm" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import com.github.michaelbull.result.getErrorOrElse
|
import com.github.michaelbull.result.getErrorOrElse
|
||||||
import com.github.michaelbull.result.getOrElse
|
import com.github.michaelbull.result.getOrElse
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.core.config.AbstractProjectConfig
|
import io.kotest.core.config.AbstractProjectConfig
|
||||||
import io.kotest.core.spec.SpecExecutionOrder
|
import io.kotest.core.spec.SpecExecutionOrder
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.assertions.withClue
|
import io.kotest.assertions.withClue
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.assertions.fail
|
import io.kotest.assertions.fail
|
||||||
import io.kotest.assertions.withClue
|
import io.kotest.assertions.withClue
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
import io.kotest.datatest.withData
|
||||||
import io.kotest.matchers.shouldNotBe
|
import io.kotest.matchers.shouldNotBe
|
||||||
import prog8.code.core.ICompilationTarget
|
import prog8.code.core.ICompilationTarget
|
||||||
import prog8.code.target.*
|
import prog8.code.target.*
|
||||||
@ -11,7 +12,6 @@ import prog8tests.helpers.*
|
|||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import kotlin.io.path.absolute
|
import kotlin.io.path.absolute
|
||||||
import kotlin.io.path.exists
|
import kotlin.io.path.exists
|
||||||
import kotlin.io.path.readText
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,14 +89,15 @@ class TestCompilerOnExamplesC64: FunSpec({
|
|||||||
listOf(false, true)
|
listOf(false, true)
|
||||||
)
|
)
|
||||||
|
|
||||||
onlyC64.forEach {
|
|
||||||
val (source, optimize) = it
|
|
||||||
val target = C64Target()
|
val target = C64Target()
|
||||||
val (displayName, filepath) = prepareTestFiles(source, optimize, target)
|
withData(
|
||||||
test(displayName) {
|
nameFn = { it.second.first },
|
||||||
|
onlyC64.map { it to prepareTestFiles(it.first, it.second, target) }
|
||||||
|
) { (params, prep) ->
|
||||||
|
val filepath = prep.second
|
||||||
|
val optimize = params.second
|
||||||
compileTheThing(filepath, optimize, target) shouldNotBe null
|
compileTheThing(filepath, optimize, target) shouldNotBe null
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
class TestCompilerOnExamplesCx16: FunSpec({
|
class TestCompilerOnExamplesCx16: FunSpec({
|
||||||
@ -145,14 +146,15 @@ class TestCompilerOnExamplesCx16: FunSpec({
|
|||||||
listOf(false, true)
|
listOf(false, true)
|
||||||
)
|
)
|
||||||
|
|
||||||
onlyCx16.forEach {
|
|
||||||
val (source, optimize) = it
|
|
||||||
val target = Cx16Target()
|
val target = Cx16Target()
|
||||||
val (displayName, filepath) = prepareTestFiles(source, optimize, target)
|
withData(
|
||||||
test(displayName) {
|
nameFn = { it.second.first },
|
||||||
|
onlyCx16.map { it to prepareTestFiles(it.first, it.second, target) }
|
||||||
|
) { (params, prep) ->
|
||||||
|
val filepath = prep.second
|
||||||
|
val optimize = params.second
|
||||||
compileTheThing(filepath, optimize, target) shouldNotBe null
|
compileTheThing(filepath, optimize, target) shouldNotBe null
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
class TestCompilerOnExamplesBothC64andCx16: FunSpec({
|
class TestCompilerOnExamplesBothC64andCx16: FunSpec({
|
||||||
@ -181,40 +183,39 @@ class TestCompilerOnExamplesBothC64andCx16: FunSpec({
|
|||||||
"tehtriz",
|
"tehtriz",
|
||||||
"textelite",
|
"textelite",
|
||||||
),
|
),
|
||||||
listOf(false, true)
|
listOf(false, true),
|
||||||
|
listOf(C64Target(), Cx16Target())
|
||||||
)
|
)
|
||||||
|
|
||||||
bothCx16AndC64.forEach {
|
withData(
|
||||||
val (source, optimize) = it
|
nameFn = { it.third.first },
|
||||||
val c64target = C64Target()
|
bothCx16AndC64.map { Triple(it.second, it.third, prepareTestFiles(it.first, it.second, it.third)) }
|
||||||
val cx16target = Cx16Target()
|
) { params ->
|
||||||
val (displayNameC64, filepathC64) = prepareTestFiles(source, optimize, c64target)
|
val filepath = params.third.second
|
||||||
val (displayNameCx16, filepathCx16) = prepareTestFiles(source, optimize, cx16target)
|
val optimize = params.first
|
||||||
test(displayNameC64) {
|
compileTheThing(filepath, optimize, params.second) shouldNotBe null
|
||||||
compileTheThing(filepathC64, optimize, c64target) shouldNotBe null
|
|
||||||
}
|
|
||||||
test(displayNameCx16) {
|
|
||||||
compileTheThing(filepathCx16, optimize, cx16target) shouldNotBe null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
class TestCompilerOnExamplesVirtual: FunSpec({
|
class TestCompilerOnExamplesVirtual: FunSpec({
|
||||||
|
|
||||||
val onlyVirtual = listOf(
|
val onlyVirtual = cartesianProduct(
|
||||||
|
listOf(
|
||||||
"bouncegfx",
|
"bouncegfx",
|
||||||
"bsieve",
|
"bsieve",
|
||||||
"pixelshader",
|
"pixelshader",
|
||||||
"sincos"
|
"sincos"
|
||||||
|
),
|
||||||
|
listOf(false, true)
|
||||||
)
|
)
|
||||||
|
|
||||||
onlyVirtual.forEach {
|
|
||||||
val target = VMTarget()
|
val target = VMTarget()
|
||||||
val (displayName, filepath) = prepareTestFiles(it, false, target)
|
withData(
|
||||||
test(displayName) {
|
nameFn = { it.second.first },
|
||||||
val src = filepath.readText()
|
onlyVirtual.map { it to prepareTestFiles(it.first, it.second, target) }
|
||||||
compileText(target, false, src, writeAssembly = true) shouldNotBe null
|
) { (params, prep) ->
|
||||||
compileText(target, true, src, writeAssembly = true) shouldNotBe null
|
val filepath = prep.second
|
||||||
}
|
val optimize = params.second
|
||||||
|
compileTheThing(filepath, optimize, target) shouldNotBe null
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.assertions.withClue
|
import io.kotest.assertions.withClue
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.assertions.withClue
|
import io.kotest.assertions.withClue
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
import io.kotest.datatest.withData
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
import io.kotest.matchers.shouldNotBe
|
import io.kotest.matchers.shouldNotBe
|
||||||
import io.kotest.matchers.string.shouldContain
|
import io.kotest.matchers.string.shouldContain
|
||||||
@ -93,25 +94,25 @@ class TestCompilerOnRanges: FunSpec({
|
|||||||
}
|
}
|
||||||
|
|
||||||
context("floatArrayInitializerWithRange") {
|
context("floatArrayInitializerWithRange") {
|
||||||
val combos = cartesianProduct(
|
withData(
|
||||||
|
nameFn = {
|
||||||
|
when (it.first) {
|
||||||
|
"" -> "no"
|
||||||
|
"42" -> "correct"
|
||||||
|
else -> "wrong"
|
||||||
|
} + " array size given" +
|
||||||
|
", " + (if (it.second == "") "without" else "with") + " %option enable_floats" +
|
||||||
|
", ${it.third.name}, optimize: ${it.fourth}"
|
||||||
|
},
|
||||||
|
cartesianProduct(
|
||||||
listOf("", "42", "41"), // sizeInDecl
|
listOf("", "42", "41"), // sizeInDecl
|
||||||
listOf("%import floats", ""), // optEnableFloats
|
listOf("%import floats", ""), // optEnableFloats
|
||||||
listOf(Cx16Target(), C64Target()), // platform
|
listOf(Cx16Target(), C64Target()), // platform
|
||||||
listOf(false, true) // optimize
|
listOf(false, true) // optimize
|
||||||
)
|
)
|
||||||
|
) { seq ->
|
||||||
|
val (sizeInDecl, optEnableFloats, platform, optimize) = seq
|
||||||
|
|
||||||
combos.forEach {
|
|
||||||
val (sizeInDecl, optEnableFloats, platform, optimize) = it
|
|
||||||
val displayName =
|
|
||||||
when (sizeInDecl) {
|
|
||||||
"" -> "no"
|
|
||||||
"42" -> "correct"
|
|
||||||
else -> "wrong"
|
|
||||||
} + " array size given" +
|
|
||||||
", " + (if (optEnableFloats == "") "without" else "with") + " %option enable_floats" +
|
|
||||||
", ${platform.name}, optimize: $optimize"
|
|
||||||
|
|
||||||
test(displayName) {
|
|
||||||
val result = compileText(platform, optimize, """
|
val result = compileText(platform, optimize, """
|
||||||
$optEnableFloats
|
$optEnableFloats
|
||||||
main {
|
main {
|
||||||
@ -125,8 +126,6 @@ class TestCompilerOnRanges: FunSpec({
|
|||||||
result shouldNotBe null
|
result shouldNotBe null
|
||||||
else
|
else
|
||||||
result shouldBe null
|
result shouldBe null
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
import io.kotest.matchers.shouldNotBe
|
import io.kotest.matchers.shouldNotBe
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import com.github.michaelbull.result.expectError
|
import com.github.michaelbull.result.expectError
|
||||||
import com.github.michaelbull.result.getOrThrow
|
import com.github.michaelbull.result.getOrThrow
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.assertions.withClue
|
import io.kotest.assertions.withClue
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
import prog8.code.target.VMTarget
|
import prog8.code.target.VMTarget
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.assertions.throwables.shouldThrow
|
import io.kotest.assertions.throwables.shouldThrow
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.assertions.throwables.shouldThrow
|
import io.kotest.assertions.throwables.shouldThrow
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.assertions.throwables.shouldThrow
|
import io.kotest.assertions.throwables.shouldThrow
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.assertions.withClue
|
import io.kotest.assertions.withClue
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.assertions.throwables.shouldThrow
|
import io.kotest.assertions.throwables.shouldThrow
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.assertions.withClue
|
import io.kotest.assertions.withClue
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import com.github.michaelbull.result.Ok
|
import com.github.michaelbull.result.Ok
|
||||||
import com.github.michaelbull.result.expectError
|
import com.github.michaelbull.result.expectError
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.assertions.withClue
|
import io.kotest.assertions.withClue
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.assertions.fail
|
import io.kotest.assertions.fail
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
import io.kotest.matchers.ints.shouldBeGreaterThan
|
import io.kotest.matchers.ints.shouldBeGreaterThan
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import com.github.michaelbull.result.expectError
|
import com.github.michaelbull.result.expectError
|
||||||
import com.github.michaelbull.result.getOrElse
|
import com.github.michaelbull.result.getOrElse
|
||||||
|
@ -29,38 +29,3 @@ fun <T, U, V, W> cartesianProduct(
|
|||||||
yield(Product(a, b, c, d))
|
yield(Product(a, b, c, d))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <A, B, R> mapCombinations(dim1: Iterable<A>, dim2: Iterable<B>, combine2: (A, B) -> R) =
|
|
||||||
sequence {
|
|
||||||
for (a in dim1)
|
|
||||||
for (b in dim2)
|
|
||||||
yield(combine2(a, b))
|
|
||||||
}.toList()
|
|
||||||
|
|
||||||
fun <A, B, C, R> mapCombinations(
|
|
||||||
dim1: Iterable<A>,
|
|
||||||
dim2: Iterable<B>,
|
|
||||||
dim3: Iterable<C>,
|
|
||||||
combine3: (A, B, C) -> R
|
|
||||||
) =
|
|
||||||
sequence {
|
|
||||||
for (a in dim1)
|
|
||||||
for (b in dim2)
|
|
||||||
for (c in dim3)
|
|
||||||
yield(combine3(a, b, c))
|
|
||||||
}.toList()
|
|
||||||
|
|
||||||
fun <A, B, C, D, R> mapCombinations(
|
|
||||||
dim1: Iterable<A>,
|
|
||||||
dim2: Iterable<B>,
|
|
||||||
dim3: Iterable<C>,
|
|
||||||
dim4: Iterable<D>,
|
|
||||||
combine4: (A, B, C, D) -> R
|
|
||||||
) =
|
|
||||||
sequence {
|
|
||||||
for (a in dim1)
|
|
||||||
for (b in dim2)
|
|
||||||
for (c in dim3)
|
|
||||||
for (d in dim4)
|
|
||||||
yield(combine4(a, b, c, d))
|
|
||||||
}.toList()
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package prog8tests
|
package prog8tests.compiler
|
||||||
|
|
||||||
import io.kotest.assertions.throwables.shouldThrow
|
import io.kotest.assertions.throwables.shouldThrow
|
||||||
import io.kotest.assertions.withClue
|
import io.kotest.assertions.withClue
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
TODO
|
TODO
|
||||||
====
|
====
|
||||||
|
|
||||||
convert example tests that loop over arrays, to data driven withData()
|
|
||||||
move those tests to a new separated module in the project so they're not always ran as part of compiler:test
|
|
||||||
|
|
||||||
|
|
||||||
Improve register load order in subroutine call args assignments:
|
Improve register load order in subroutine call args assignments:
|
||||||
in certain situations, the "wrong" order of evaluation of function call arguments is done which results
|
in certain situations, the "wrong" order of evaluation of function call arguments is done which results
|
||||||
in overwriting registers that already got their value, which requires a lot of stack juggling (especially on plain 6502 cpu!)
|
in overwriting registers that already got their value, which requires a lot of stack juggling (especially on plain 6502 cpu!)
|
||||||
|
@ -26,6 +26,7 @@ dependencies {
|
|||||||
implementation project(':codeCore')
|
implementation project(':codeCore')
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||||
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.9.1'
|
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.9.1'
|
||||||
|
testImplementation 'io.kotest:kotest-framework-datatest:5.9.1'
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
|
||||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
}
|
}
|
||||||
|
@ -13,5 +13,6 @@
|
|||||||
<orderEntry type="module" module-name="codeCore" />
|
<orderEntry type="module" module-name="codeCore" />
|
||||||
<orderEntry type="library" name="io.kotest.assertions.core.jvm" level="project" />
|
<orderEntry type="library" name="io.kotest.assertions.core.jvm" level="project" />
|
||||||
<orderEntry type="library" name="io.kotest.runner.junit5.jvm" level="project" />
|
<orderEntry type="library" name="io.kotest.runner.junit5.jvm" level="project" />
|
||||||
|
<orderEntry type="library" name="io.kotest.framework.datatest" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -28,6 +28,7 @@ dependencies {
|
|||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||||
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:2.0.0"
|
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:2.0.0"
|
||||||
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.9.1'
|
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.9.1'
|
||||||
|
testImplementation 'io.kotest:kotest-framework-datatest:5.9.1'
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
|
||||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||||
<orderEntry type="library" name="io.kotest.assertions.core.jvm" level="project" />
|
<orderEntry type="library" name="io.kotest.assertions.core.jvm" level="project" />
|
||||||
<orderEntry type="library" name="io.kotest.runner.junit5.jvm" level="project" />
|
<orderEntry type="library" name="io.kotest.runner.junit5.jvm" level="project" />
|
||||||
<orderEntry type="module" module-name="codeCore" />
|
<orderEntry type="library" name="io.kotest.framework.datatest" level="project" />
|
||||||
<orderEntry type="module" module-name="intermediate" />
|
<orderEntry type="module" module-name="intermediate" />
|
||||||
|
<orderEntry type="module" module-name="codeCore" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
Loading…
Reference in New Issue
Block a user