From 5012f8fb1480008a80da03d6e564aba3a6a499d4 Mon Sep 17 00:00:00 2001 From: Edwin Jakobs Date: Sat, 18 Nov 2023 22:36:35 +0100 Subject: [PATCH] Remove Spek add Kotest --- gradle/libs.versions.toml | 11 +- orx-camera/build.gradle.kts | 1 - orx-color/build.gradle.kts | 24 +--- .../kotlin/spaces}/TestMix.kt | 28 +++-- .../commonTest/kotlin/spaces/TestOKHSLa.kt | 1 - orx-gradient-descent/build.gradle.kts | 16 ++- .../src/commonTest/kotlin/TestDot.kt | 26 +++++ .../kotlin/TestGradient.kt | 16 ++- .../kotlin/TestMinimize.kt | 7 +- .../src/jvmTest/kotlin/TestDot.kt | 28 ----- .../src/jvmTest/kotlin/TestMinimizeModel.kt | 16 +-- orx-jvm/orx-olive/build.gradle.kts | 5 +- .../src/test/kotlin/TestLoadScript.kt | 12 +- .../src/test/kotlin/TestLoadScriptKSH.kt | 9 +- orx-jvm/orx-panel/build.gradle.kts | 3 - orx-noise/build.gradle.kts | 19 +-- .../kotlin/TestGradient.kt | 5 +- .../kotlin/TestMathUtils.kt | 5 +- .../kotlin/TestVectorShortcutFunctions.kt | 6 +- orx-parameters/build.gradle.kts | 9 +- .../src/jvmTest/kotlin/TestAnnotations.kt | 108 +++++++++--------- orx-property-watchers/build.gradle.kts | 1 - orx-shader-phrases/build.gradle.kts | 14 +-- .../src/jvmTest/kotlin/TestFunctionNameRx.kt | 19 +-- .../src/jvmTest/kotlin/TestShaderPhrase.kt | 9 +- .../jvmTest/kotlin/TestShaderPhraseBook.kt | 9 +- .../kotlin/TestShaderPhrasePreprocessing.kt | 17 ++- orx-shapes/build.gradle.kts | 19 +-- orx-shapes/src/jvmTest/kotlin/Assertions.kt | 7 +- .../src/jvmTest/kotlin/TestChamferCorners.kt | 49 ++++---- .../src/jvmTest/kotlin/TestRegularPolygon.kt | 24 ++-- .../src/jvmTest/kotlin/TestRegularStar.kt | 27 +++-- .../jvmTest/kotlin/TestRoundedRectangle.kt | 13 +-- orx-view-box/build.gradle.kts | 1 - 34 files changed, 255 insertions(+), 309 deletions(-) rename orx-color/src/{jvmTest/kotlin => commonTest/kotlin/spaces}/TestMix.kt (52%) create mode 100644 orx-gradient-descent/src/commonTest/kotlin/TestDot.kt rename orx-gradient-descent/src/{jvmTest => commonTest}/kotlin/TestGradient.kt (73%) rename orx-gradient-descent/src/{jvmTest => commonTest}/kotlin/TestMinimize.kt (62%) delete mode 100644 orx-gradient-descent/src/jvmTest/kotlin/TestDot.kt rename orx-noise/src/{jvmTest => commonTest}/kotlin/TestGradient.kt (84%) rename orx-noise/src/{jvmTest => commonTest}/kotlin/TestMathUtils.kt (62%) rename orx-noise/src/{jvmTest => commonTest}/kotlin/TestVectorShortcutFunctions.kt (94%) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5fd1553f..1621cbda 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,10 +7,10 @@ openrndr = { require = "[0.4.2, 0.5.0)" } kotlinxCoroutines = "1.7.3" kotlinLogging = "3.0.0" kotlinxSerialization = "1.6.1" +kotest = "5.8.0" dokka = "1.7.10" nebulaRelease = "18.0.4" gradleNexusPublish = "2.0.0-rc-1" -spek = "2.0.19" boofcv = "1.0.0" kluent = "1.73" junitJupiter = "5.9.2" @@ -43,6 +43,11 @@ kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-p kotlin-serialization-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-serialization", version.ref = "kotlin" } dokka-gradle-plugin = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "dokka" } +kotest-assertions = { group = "io.kotest", name = "kotest-assertions-core", version.ref = "kotest" } +kotest-runner = { group = "io.kotest", name = "kotest-runner-junit5", version.ref = "kotest" } +kotest-framework-engine = { group = "io.kotest", name = "kotest-framework-engine", version.ref = "kotest" } + + openrndr-application = { group = "org.openrndr", name = "openrndr-application", version.ref = "openrndr" } openrndr-extensions = { group = "org.openrndr", name = "openrndr-extensions", version.ref = "openrndr" } openrndr-math = { group = "org.openrndr", name = "openrndr-math", version.ref = "openrndr" } @@ -73,8 +78,6 @@ antlr-runtime = { group = "org.antlr", name = "antlr4-runtime", version.ref = "a jupiter-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junitJupiter" } jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junitJupiter" } -spek-dsl = { group = "org.spekframework.spek2", name = "spek-dsl-jvm", version.ref = "spek" } -spek-junit5 = { group = "org.spekframework.spek2", name = "spek-runner-junit5", version.ref = "spek" } kluent = { group = "org.amshove.kluent", name = "kluent", version.ref = "kluent" } slf4j-simple = { group = "org.slf4j", name = "slf4j-simple", version.ref = "slf4j" } @@ -82,6 +85,8 @@ slf4j-simple = { group = "org.slf4j", name = "slf4j-simple", version.ref = "slf4 kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } nebula-release = { id = "nebula.release", version.ref = "nebulaRelease" } gradle-nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "gradleNexusPublish" } +kotest-multiplatform = { id = "io.kotest.multiplatform", version.ref = "kotest"} + [bundles] jupiter = ["jupiter-api", "jupiter-engine"] diff --git a/orx-camera/build.gradle.kts b/orx-camera/build.gradle.kts index bd0df9ec..72ddd363 100644 --- a/orx-camera/build.gradle.kts +++ b/orx-camera/build.gradle.kts @@ -6,7 +6,6 @@ kotlin { jvm { testRuns["test"].executionTask { useJUnitPlatform { - includeEngines("spek2") } } } diff --git a/orx-color/build.gradle.kts b/orx-color/build.gradle.kts index 67beca54..abcb2eb9 100644 --- a/orx-color/build.gradle.kts +++ b/orx-color/build.gradle.kts @@ -5,19 +5,11 @@ plugins { // version was used. If openrndr were an included build, we probably wouldn't need to do this. // https://github.com/gradle/gradle/issues/20084 id(libs.plugins.kotlin.serialization.get().pluginId) + alias(libs.plugins.kotest.multiplatform) } kotlin { - jvm { - testRuns["test"].executionTask { - useJUnitPlatform { - includeEngines("spek2") - } - } - } - sourceSets { - @Suppress("UNUSED_VARIABLE") val commonMain by getting { dependencies { implementation(project(":orx-parameters")) @@ -30,24 +22,14 @@ kotlin { } } - @Suppress("UNUSED_VARIABLE") val commonTest by getting { dependencies { implementation(libs.kotlin.serialization.json) + implementation(libs.kotest.assertions) + implementation(libs.kotest.framework.engine) } } - @Suppress("UNUSED_VARIABLE") - val jvmTest by getting { - dependencies { - implementation(libs.kluent) - implementation(libs.spek.dsl) - runtimeOnly(libs.spek.junit5) - runtimeOnly(libs.kotlin.reflect) - } - } - - @Suppress("UNUSED_VARIABLE") val jvmDemo by getting { dependencies { implementation(project(":orx-camera")) diff --git a/orx-color/src/jvmTest/kotlin/TestMix.kt b/orx-color/src/commonTest/kotlin/spaces/TestMix.kt similarity index 52% rename from orx-color/src/jvmTest/kotlin/TestMix.kt rename to orx-color/src/commonTest/kotlin/spaces/TestMix.kt index 41d96747..dafb287a 100644 --- a/orx-color/src/jvmTest/kotlin/TestMix.kt +++ b/orx-color/src/commonTest/kotlin/spaces/TestMix.kt @@ -1,21 +1,25 @@ -import org.amshove.kluent.`should be equal to` +package spaces + +import io.kotest.core.spec.style.DescribeSpec import org.openrndr.color.ColorRGBa import org.openrndr.color.Linearity import org.openrndr.extra.color.palettes.rangeTo -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe -object TestMix : Spek({ +import kotlin.test.assertEquals +import kotlin.test.assertSame + +class TestMix : DescribeSpec({ describe("two srgb colors") { val a = ColorRGBa.BLUE val b = ColorRGBa.RED - a.linearity `should be equal to` Linearity.SRGB + assertEquals(Linearity.SRGB, a.linearity) + it("should mix properly") { - a.mix(b, 0.0) `should be equal to` a - a.mix(b, 1.0) `should be equal to` b + assertSame(a, a.mix(b, 0.0)) + assertSame(b, a.mix(b, 1.0)) } } @@ -24,8 +28,8 @@ object TestMix : Spek({ val b = ColorRGBa.RED.toLinear() it("should mix properly") { - a.mix(b, 0.0) `should be equal to` a - a.mix(b, 1.0) `should be equal to` b + assertSame(a, a.mix(b, 0.0)) + assertSame(b, a.mix(b, 1.0)) } } @@ -34,9 +38,9 @@ object TestMix : Spek({ val b = ColorRGBa.RED val blend = a..b blend 2 - blend.size `should be equal to` 2 - blend[0] `should be equal to` a - blend[1] `should be equal to` b + assertEquals(2, blend.size) + assertEquals(a, blend[0]) + assertEquals(b, blend[1]) } }) \ No newline at end of file diff --git a/orx-color/src/commonTest/kotlin/spaces/TestOKHSLa.kt b/orx-color/src/commonTest/kotlin/spaces/TestOKHSLa.kt index 65f7914b..80bfda14 100644 --- a/orx-color/src/commonTest/kotlin/spaces/TestOKHSLa.kt +++ b/orx-color/src/commonTest/kotlin/spaces/TestOKHSLa.kt @@ -2,7 +2,6 @@ package spaces import org.openrndr.color.ColorRGBa import org.openrndr.extra.color.spaces.toOKHSLa -import org.openrndr.extra.color.spaces.toOKHSVa import kotlin.test.Test import kotlin.test.assertTrue diff --git a/orx-gradient-descent/build.gradle.kts b/orx-gradient-descent/build.gradle.kts index 7cb2609a..dc1f648f 100644 --- a/orx-gradient-descent/build.gradle.kts +++ b/orx-gradient-descent/build.gradle.kts @@ -1,17 +1,17 @@ plugins { org.openrndr.extra.convention.`kotlin-multiplatform` + alias(libs.plugins.kotest.multiplatform) } kotlin { jvm { testRuns["test"].executionTask { useJUnitPlatform { - includeEngines("spek2") + } } } sourceSets { - @Suppress("UNUSED_VARIABLE") val commonMain by getting { dependencies { implementation(project(":orx-parameters")) @@ -23,13 +23,17 @@ kotlin { } } + val commonTest by getting { + dependencies { + implementation(libs.kotest.assertions) + implementation(libs.kotest.framework.engine) + } + } - @Suppress("UNUSED_VARIABLE") val jvmTest by getting { dependencies { - implementation(libs.kluent) - implementation(libs.spek.dsl) - runtimeOnly(libs.spek.junit5) + implementation(libs.kotest.assertions) + implementation(libs.kotest.framework.engine) runtimeOnly(libs.kotlin.reflect) } } diff --git a/orx-gradient-descent/src/commonTest/kotlin/TestDot.kt b/orx-gradient-descent/src/commonTest/kotlin/TestDot.kt new file mode 100644 index 00000000..c8ab4cba --- /dev/null +++ b/orx-gradient-descent/src/commonTest/kotlin/TestDot.kt @@ -0,0 +1,26 @@ +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.equals.shouldBeEqual +import org.openrndr.extra.gradientdescent.dot + + +class TestDot : DescribeSpec({ + describe("some vectors") { + val a = doubleArrayOf(10.0) + val b = doubleArrayOf(4.0) + dot(a, b).shouldBeEqual(40.0) + } + + describe("a matrix and a vector") { + val a = arrayOf(doubleArrayOf(10.0)) + val b = doubleArrayOf(1.0) + val d = dot(a, b) + d[0].shouldBeEqual(10.0) + } + + describe("another matrix and a vector") { + val a = arrayOf(doubleArrayOf(1.0)) + val b = doubleArrayOf(19.99999999995339) + val d = dot(a, b) + d[0].shouldBeEqual(19.99999999995339) + } +}) \ No newline at end of file diff --git a/orx-gradient-descent/src/jvmTest/kotlin/TestGradient.kt b/orx-gradient-descent/src/commonTest/kotlin/TestGradient.kt similarity index 73% rename from orx-gradient-descent/src/jvmTest/kotlin/TestGradient.kt rename to orx-gradient-descent/src/commonTest/kotlin/TestGradient.kt index bf731ad6..91a9ea10 100644 --- a/orx-gradient-descent/src/jvmTest/kotlin/TestGradient.kt +++ b/orx-gradient-descent/src/commonTest/kotlin/TestGradient.kt @@ -1,18 +1,16 @@ -import org.amshove.kluent.`should be equal to` -import org.amshove.kluent.`should equal` +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.equals.shouldBeEqual import org.openrndr.extra.gradientdescent.gradient -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe -object TestGradient : Spek({ +class TestGradient : DescribeSpec({ describe("a simple 1d function") { fun parabola(x: DoubleArray): Double { return x[0] * x[0] } it("its gradient at x=0 is 0.0") { val g0 = gradient(doubleArrayOf(0.0), ::parabola) - g0.size `should equal` 1 - g0[0] `should be equal to` 0.0 + g0.size.shouldBeEqual(1) + g0[0].shouldBeEqual(0.0) } it("its gradient at x=1 is ~2.0") { val g1 = gradient(doubleArrayOf(1.0), ::parabola) @@ -29,8 +27,8 @@ object TestGradient : Spek({ it("its gradient at x=0 is 0.0") { val g0 = gradient(doubleArrayOf(0.0, 0.0), ::parabola) - g0.size `should equal` 2 - g0[0] `should be equal to` 0.0 + g0.size.shouldBeEqual(2) + g0[0].shouldBeEqual(0.0) } it("its gradient at x=1 is ~2.0") { diff --git a/orx-gradient-descent/src/jvmTest/kotlin/TestMinimize.kt b/orx-gradient-descent/src/commonTest/kotlin/TestMinimize.kt similarity index 62% rename from orx-gradient-descent/src/jvmTest/kotlin/TestMinimize.kt rename to orx-gradient-descent/src/commonTest/kotlin/TestMinimize.kt index d11bb79e..03de5c7d 100644 --- a/orx-gradient-descent/src/jvmTest/kotlin/TestMinimize.kt +++ b/orx-gradient-descent/src/commonTest/kotlin/TestMinimize.kt @@ -1,11 +1,10 @@ +import io.kotest.core.spec.style.DescribeSpec import org.openrndr.extra.gradientdescent.minimize -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe -object TestMinimize : Spek({ +class TestMinimize : DescribeSpec({ describe("a simple 1d function") { fun parabola(x: DoubleArray): Double { - return (x[0]+1) * (x[0]+1) + return (x[0] + 1) * (x[0] + 1) } it("it can be minimized") { val result = minimize(doubleArrayOf(10.0), f = ::parabola) diff --git a/orx-gradient-descent/src/jvmTest/kotlin/TestDot.kt b/orx-gradient-descent/src/jvmTest/kotlin/TestDot.kt deleted file mode 100644 index c0364507..00000000 --- a/orx-gradient-descent/src/jvmTest/kotlin/TestDot.kt +++ /dev/null @@ -1,28 +0,0 @@ -package org.openrndr.extra.gradientdescent -import org.amshove.kluent.`should be equal to` -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe - -object TestDot : Spek({ - describe("some vectors") { - val a = doubleArrayOf(10.0) - val b = doubleArrayOf(4.0) - - dot(a,b) `should be equal to` 40.0 - - } - describe("a matrix and a vector") { - val a = arrayOf(doubleArrayOf(10.0)) - val b = doubleArrayOf(1.0) - val d = dot(a,b) - d[0] `should be equal to` 10.0 - } - - describe("a matrix and a vector") { - val a = arrayOf(doubleArrayOf(1.0)) - val b = doubleArrayOf(19.99999999995339) - val d = dot(a,b) - d[0] `should be equal to` 19.99999999995339 - } - -}) \ No newline at end of file diff --git a/orx-gradient-descent/src/jvmTest/kotlin/TestMinimizeModel.kt b/orx-gradient-descent/src/jvmTest/kotlin/TestMinimizeModel.kt index 47a885fc..255e3b4b 100644 --- a/orx-gradient-descent/src/jvmTest/kotlin/TestMinimizeModel.kt +++ b/orx-gradient-descent/src/jvmTest/kotlin/TestMinimizeModel.kt @@ -1,10 +1,10 @@ -import org.amshove.kluent.shouldBeNear +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.doubles.plusOrMinus +import io.kotest.matchers.shouldBe import org.openrndr.extra.gradientdescent.minimizeModel import org.openrndr.math.Vector2 -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe -object TestMinimizeModel : Spek({ +class TestMinimizeModel : DescribeSpec({ describe("a model") { val m = object { var x = 0.0 @@ -14,8 +14,8 @@ object TestMinimizeModel : Spek({ minimizeModel(m) { m-> (m.x - 4.0) * (m.x - 4.0) + (m.y - 3.0) * (m.y - 3.0) } - m.x.shouldBeNear(4.0, 0.01) - m.y.shouldBeNear(3.0, 0.01) + m.x.shouldBe(4.0.plusOrMinus(0.01)) + m.y.shouldBe(3.0.plusOrMinus(0.01)) } } @@ -27,8 +27,8 @@ object TestMinimizeModel : Spek({ minimizeModel(m) { m-> (m.position.x - 4.0) * (m.position.x - 4.0) + (m.position.y - 3.0) * (m.position.y - 3.0) } - m.position.x.shouldBeNear(4.0, 0.01) - m.position.y.shouldBeNear(3.0, 0.01) + m.position.x.shouldBe(4.0.plusOrMinus(0.01)) + m.position.y.shouldBe(3.0.plusOrMinus(0.01)) } } }) \ No newline at end of file diff --git a/orx-jvm/orx-olive/build.gradle.kts b/orx-jvm/orx-olive/build.gradle.kts index c2cede04..427aeed9 100644 --- a/orx-jvm/orx-olive/build.gradle.kts +++ b/orx-jvm/orx-olive/build.gradle.kts @@ -10,7 +10,6 @@ tasks.withType { tasks.test { useJUnitPlatform { - includeEngines("spek2") } } @@ -25,7 +24,7 @@ dependencies { implementation(libs.kotlin.scriptingJSR223) implementation(libs.kotlin.coroutines) testImplementation(libs.kluent) - testImplementation(libs.spek.dsl) - testRuntimeOnly(libs.spek.junit5) + testImplementation(libs.kotest.runner) + testImplementation(libs.kotest.assertions) testRuntimeOnly(libs.kotlin.reflect) } \ No newline at end of file diff --git a/orx-jvm/orx-olive/src/test/kotlin/TestLoadScript.kt b/orx-jvm/orx-olive/src/test/kotlin/TestLoadScript.kt index 26f7631d..abff20c6 100644 --- a/orx-jvm/orx-olive/src/test/kotlin/TestLoadScript.kt +++ b/orx-jvm/orx-olive/src/test/kotlin/TestLoadScript.kt @@ -1,18 +1,16 @@ -import org.amshove.kluent.`should be equal to` +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.equals.shouldBeEqual import org.openrndr.extra.olive.ScriptObjectLoader -import org.openrndr.extra.olive.loadFromScript -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe -object TestLoadScript : Spek({ +class TestLoadScript : DescribeSpec({ describe("some script") { - val loader = ScriptObjectLoader() + val loader = ScriptObjectLoader() val number = loader.load("5") it("should evaluate properly") { - number `should be equal to` 5 + number shouldBeEqual 5 } } }) \ No newline at end of file diff --git a/orx-jvm/orx-olive/src/test/kotlin/TestLoadScriptKSH.kt b/orx-jvm/orx-olive/src/test/kotlin/TestLoadScriptKSH.kt index 2cd41c52..e539f925 100644 --- a/orx-jvm/orx-olive/src/test/kotlin/TestLoadScriptKSH.kt +++ b/orx-jvm/orx-olive/src/test/kotlin/TestLoadScriptKSH.kt @@ -1,15 +1,14 @@ -import org.amshove.kluent.`should be equal to` +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.equals.shouldBeEqual import org.openrndr.extra.olive.loadFromScriptContentsKSH -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe -object TestLoadScriptKSH : Spek({ +class TestLoadScriptKSH : DescribeSpec({ describe("some script") { val number = loadFromScriptContentsKSH("5") it("should evaluate properly") { - number `should be equal to` 5 + number shouldBeEqual 5 } } }) \ No newline at end of file diff --git a/orx-jvm/orx-panel/build.gradle.kts b/orx-jvm/orx-panel/build.gradle.kts index 8ce35c80..145f0cf5 100644 --- a/orx-jvm/orx-panel/build.gradle.kts +++ b/orx-jvm/orx-panel/build.gradle.kts @@ -10,7 +10,6 @@ tasks.withType { tasks.test { useJUnitPlatform { - includeEngines("spek2") } } @@ -20,8 +19,6 @@ dependencies { implementation(libs.openrndr.math) implementation(libs.kotlin.coroutines) implementation(libs.kotlin.reflect) - testImplementation(libs.spek.dsl) - testRuntimeOnly(libs.spek.junit5) testRuntimeOnly(libs.kotlin.reflect) demoImplementation(libs.openrndr.dialogs) demoImplementation(libs.gson) diff --git a/orx-noise/build.gradle.kts b/orx-noise/build.gradle.kts index 464e02f5..bc62b6fc 100644 --- a/orx-noise/build.gradle.kts +++ b/orx-noise/build.gradle.kts @@ -1,5 +1,6 @@ plugins { org.openrndr.extra.convention.`kotlin-multiplatform` + alias(libs.plugins.kotest.multiplatform) } val embedShaders = tasks.register("embedShaders") { @@ -11,17 +12,8 @@ val embedShaders = tasks.register("embedShaders") { }.get() kotlin { - jvm { - testRuns["test"].executionTask { - useJUnitPlatform { - includeEngines("spek2") - } - } - } - kotlin.sourceSets.getByName("commonMain").kotlin.srcDir(embedShaders.outputDir) sourceSets { - @Suppress("UNUSED_VARIABLE") val commonMain by getting { dependencies { implementation(libs.openrndr.math) @@ -33,16 +25,13 @@ kotlin { } } - @Suppress("UNUSED_VARIABLE") - val jvmTest by getting { + val commonTest by getting { dependencies { - implementation(libs.spek.dsl) - runtimeOnly(libs.spek.junit5) - runtimeOnly(libs.kotlin.reflect) + implementation(libs.kotest.assertions) + implementation(libs.kotest.framework.engine) } } - @Suppress("UNUSED_VARIABLE") val jvmDemo by getting { dependencies { implementation(project(":orx-hash-grid")) diff --git a/orx-noise/src/jvmTest/kotlin/TestGradient.kt b/orx-noise/src/commonTest/kotlin/TestGradient.kt similarity index 84% rename from orx-noise/src/jvmTest/kotlin/TestGradient.kt rename to orx-noise/src/commonTest/kotlin/TestGradient.kt index eb177410..105419dd 100644 --- a/orx-noise/src/jvmTest/kotlin/TestGradient.kt +++ b/orx-noise/src/commonTest/kotlin/TestGradient.kt @@ -1,9 +1,8 @@ +import io.kotest.core.spec.style.DescribeSpec import org.openrndr.extra.noise.* -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe import kotlin.test.assertEquals -object TestGradient : Spek({ +class TestGradient : DescribeSpec({ describe("Noise") { it("has a gradient") { gradient1D(::perlinLinear, 100, 0.1) diff --git a/orx-noise/src/jvmTest/kotlin/TestMathUtils.kt b/orx-noise/src/commonTest/kotlin/TestMathUtils.kt similarity index 62% rename from orx-noise/src/jvmTest/kotlin/TestMathUtils.kt rename to orx-noise/src/commonTest/kotlin/TestMathUtils.kt index d98c8761..125a1d5c 100644 --- a/orx-noise/src/jvmTest/kotlin/TestMathUtils.kt +++ b/orx-noise/src/commonTest/kotlin/TestMathUtils.kt @@ -1,9 +1,8 @@ +import io.kotest.core.spec.style.DescribeSpec import org.openrndr.extra.noise.fastFloor -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe import kotlin.test.assertEquals -object TestMathUtils : Spek({ +class TestMathUtils : DescribeSpec({ describe("Fast floor") { it("it is corrrect for 0.0") { assertEquals(0, 0.0.fastFloor()) diff --git a/orx-noise/src/jvmTest/kotlin/TestVectorShortcutFunctions.kt b/orx-noise/src/commonTest/kotlin/TestVectorShortcutFunctions.kt similarity index 94% rename from orx-noise/src/jvmTest/kotlin/TestVectorShortcutFunctions.kt rename to orx-noise/src/commonTest/kotlin/TestVectorShortcutFunctions.kt index e119f827..e06199f4 100644 --- a/orx-noise/src/jvmTest/kotlin/TestVectorShortcutFunctions.kt +++ b/orx-noise/src/commonTest/kotlin/TestVectorShortcutFunctions.kt @@ -1,11 +1,11 @@ +import io.kotest.core.spec.style.DescribeSpec import org.openrndr.extra.noise.Random import org.openrndr.extra.noise.perlinQuintic import org.openrndr.math.Vector4 -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe + import kotlin.test.assertEquals -object TestVectorShortcutFunctions : Spek({ +class TestVectorShortcutFunctions : DescribeSpec({ val v = Vector4(1.13, 2.74, 3.59, 4.83) diff --git a/orx-parameters/build.gradle.kts b/orx-parameters/build.gradle.kts index f939e50f..42f9a7a1 100644 --- a/orx-parameters/build.gradle.kts +++ b/orx-parameters/build.gradle.kts @@ -1,5 +1,6 @@ plugins { org.openrndr.extra.convention.`kotlin-multiplatform` + alias(libs.plugins.kotest.multiplatform) } kotlin { @@ -10,6 +11,7 @@ kotlin { implementation(libs.openrndr.application) implementation(libs.openrndr.math) implementation(libs.kotlin.reflect) + } } @@ -17,11 +19,10 @@ kotlin { @Suppress("UNUSED_VARIABLE") val jvmTest by getting { dependencies { - implementation(libs.kluent) - implementation(libs.spek.dsl) - runtimeOnly(libs.spek.junit5) + implementation(libs.kotest.assertions) + implementation(libs.kotest.framework.engine) + implementation(libs.kotlin.serialization.json) runtimeOnly(libs.kotlin.reflect) - } } } diff --git a/orx-parameters/src/jvmTest/kotlin/TestAnnotations.kt b/orx-parameters/src/jvmTest/kotlin/TestAnnotations.kt index b51d1f8a..2c8bc7b6 100644 --- a/orx-parameters/src/jvmTest/kotlin/TestAnnotations.kt +++ b/orx-parameters/src/jvmTest/kotlin/TestAnnotations.kt @@ -1,12 +1,16 @@ -import org.amshove.kluent.* -import org.junit.jupiter.api.Assertions.assertEquals +import io.kotest.assertions.throwables.shouldThrowUnit +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.collections.shouldBeIn +import io.kotest.matchers.doubles.plusOrMinus +import io.kotest.matchers.equals.shouldBeEqual +import io.kotest.matchers.nulls.shouldBeNull +import io.kotest.matchers.shouldBe import org.openrndr.color.ColorRGBa import org.openrndr.extra.parameters.* import org.openrndr.math.Vector2 import org.openrndr.math.Vector3 import org.openrndr.math.Vector4 -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe +import kotlin.test.assertEquals val a = object { @DoubleParameter("a double scalar", 0.0, 1.0, order = 0) @@ -52,81 +56,83 @@ val a = object { } -object TestAnnotations : Spek({ +class TestAnnotations : DescribeSpec({ describe("an annotated object") { it("has listable parameters") { val list = a.listParameters() - list.size `should be equal to` 13 + list.size shouldBeEqual 13 - list[0].property?.name `should be equal to` "d" - list[0].parameterType `should be equal to` ParameterType.Double - list[0].label `should be equal to` "a double scalar" + list[0].property?.name shouldBe "d" + list[0].parameterType shouldBeEqual ParameterType.Double + list[0].label shouldBeEqual "a double scalar" list[0].doubleRange?.let { - it.start shouldBeInRange 0.0..0.0001 - it.endInclusive shouldBeInRange 0.999..1.001 + it.start.shouldBe(0.0.plusOrMinus(0.001)) + it.endInclusive.shouldBe(1.0.plusOrMinus(0.001)) } - list[0].precision `should be equal to` 3 + list[0].precision?.shouldBeEqual(3) - list[1].property?.name `should be equal to` "i" - list[1].parameterType `should be equal to` ParameterType.Int - list[1].label `should be equal to` "an integer scalar" + list[1].property?.name?.shouldBeEqual("i") + list[1].parameterType shouldBeEqual ParameterType.Int + list[1].label shouldBeEqual "an integer scalar" list[1].intRange?.let { - it.first `should be equal to` 1 - it.last `should be equal to` 100 + it.first shouldBeEqual 1 + it.last shouldBeEqual 100 } - list[2].property?.name `should be equal to` "b" - list[2].parameterType `should be equal to` ParameterType.Boolean - list[2].label `should be equal to` "a boolean parameter" - list[2].precision `should be equal to` null + list[2].property?.name?.shouldBeEqual("b") + list[2].parameterType shouldBeEqual ParameterType.Boolean + list[2].label shouldBeEqual "a boolean parameter" + list[2].precision?.shouldBeNull() - list[3].parameterType `should be equal to` ParameterType.Action - list[3].property `should be equal to` null - list[3].label `should be equal to` "an action parameter" + list[3].parameterType shouldBeEqual ParameterType.Action + list[3].property?.shouldBeNull() + list[3].label shouldBeEqual "an action parameter" /* test if we can call the annotated function, this is performed by raising an expected exception in the function in the annotated function. */ - invoking { + shouldThrowUnit { + try { list[3].function?.call(a) } catch (e: java.lang.reflect.InvocationTargetException) { /* this unpacks the exception that is wrapped in the ITExc */ - throw(e.targetException) + throw (e.targetException) } - } `should throw` IllegalStateException::class withMessage "this is to test if this function can be called" + } - list[4].parameterType `should be equal to` ParameterType.Text - list[4].property?.name `should be equal to` "t" - list[4].label `should be equal to` "a text parameter" - list[5].parameterType `should be equal to` ParameterType.Color - list[5].property?.name `should be equal to` "c" - list[5].label `should be equal to` "a color parameter" + list[4].parameterType shouldBeEqual ParameterType.Text + list[4].property?.name?.shouldBeEqual("t") + list[4].label shouldBeEqual "a text parameter" - list[6].parameterType `should be equal to` ParameterType.XY - list[6].property?.name `should be equal to` "xy" - list[6].label `should be equal to` "an XY parameter" + list[5].parameterType shouldBeEqual ParameterType.Color + list[5].property?.name?.shouldBeEqual("c") + list[5].label shouldBeEqual "a color parameter" - list[7].parameterType `should be equal to` ParameterType.DoubleList - list[7].property?.name `should be equal to` "dl" - list[7].label `should be equal to` "a double list parameter" + list[6].parameterType shouldBeEqual ParameterType.XY + list[6].property?.name?.shouldBeEqual("xy") + list[6].label shouldBeEqual "an XY parameter" - list[8].parameterType `should be equal to` ParameterType.Vector2 - list[8].property?.name `should be equal to` "v2" - list[8].label `should be equal to` "a vector 2 parameter" + list[7].parameterType shouldBeEqual ParameterType.DoubleList + list[7].property?.name?.shouldBeEqual("dl") + list[7].label shouldBeEqual "a double list parameter" - list[9].parameterType `should be equal to` ParameterType.Vector3 - list[9].property?.name `should be equal to` "v3" - list[9].label `should be equal to` "a vector 3 parameter" + list[8].parameterType shouldBeEqual ParameterType.Vector2 + list[8].property?.name?.shouldBeEqual("v2") + list[8].label shouldBeEqual "a vector 2 parameter" - list[10].parameterType `should be equal to` ParameterType.Vector4 - list[10].property?.name `should be equal to` "v4" - list[10].label `should be equal to` "a vector 4 parameter" + list[9].parameterType shouldBeEqual ParameterType.Vector3 + list[9].property?.name?.shouldBeEqual("v3") + list[9].label shouldBeEqual "a vector 3 parameter" - list[11].parameterType `should be equal to` ParameterType.Option - list[11].property?.name `should be equal to` "o" - list[11].label `should be equal to` "an option parameter" + list[10].parameterType shouldBeEqual ParameterType.Vector4 + list[10].property?.name?.shouldBeEqual("v4") + list[10].label shouldBeEqual "a vector 4 parameter" + + list[11].parameterType shouldBeEqual ParameterType.Option + list[11].property?.name?.shouldBeEqual("o") + list[11].label shouldBeEqual "an option parameter" assertEquals(list[12].parameterType, ParameterType.Path) assertEquals(list[12].property?.name, "p") diff --git a/orx-property-watchers/build.gradle.kts b/orx-property-watchers/build.gradle.kts index bb865a55..ebbb178f 100644 --- a/orx-property-watchers/build.gradle.kts +++ b/orx-property-watchers/build.gradle.kts @@ -6,7 +6,6 @@ kotlin { jvm { testRuns["test"].executionTask { useJUnitPlatform { - includeEngines("spek2") } } } diff --git a/orx-shader-phrases/build.gradle.kts b/orx-shader-phrases/build.gradle.kts index cbb3dea3..a1d2706c 100644 --- a/orx-shader-phrases/build.gradle.kts +++ b/orx-shader-phrases/build.gradle.kts @@ -1,5 +1,6 @@ plugins { org.openrndr.extra.convention.`kotlin-multiplatform` + alias(libs.plugins.kotest.multiplatform) } val embedShaders = tasks.register("embedShaders") { @@ -9,16 +10,8 @@ val embedShaders = tasks.register("embedShaders") { }.get() kotlin { - jvm { - testRuns["test"].executionTask { - useJUnitPlatform { - includeEngines("spek2") - } - } - } kotlin.sourceSets.getByName("commonMain").kotlin.srcDir(embedShaders.outputDir) sourceSets { - @Suppress("UNUSED_VARIABLE") val commonMain by getting { dependencies { implementation(libs.openrndr.application) @@ -31,10 +24,9 @@ kotlin { val jvmTest by getting { dependencies { runtimeOnly(libs.slf4j.simple) - implementation(libs.kluent) - implementation(libs.spek.dsl) - runtimeOnly(libs.spek.junit5) runtimeOnly(libs.kotlin.reflect) + implementation(libs.kotest.assertions) + implementation(libs.kotest.framework.engine) } } } diff --git a/orx-shader-phrases/src/jvmTest/kotlin/TestFunctionNameRx.kt b/orx-shader-phrases/src/jvmTest/kotlin/TestFunctionNameRx.kt index 00ec5104..e3d260a4 100644 --- a/orx-shader-phrases/src/jvmTest/kotlin/TestFunctionNameRx.kt +++ b/orx-shader-phrases/src/jvmTest/kotlin/TestFunctionNameRx.kt @@ -1,12 +1,13 @@ -import org.amshove.kluent.`should be equal to` -import org.amshove.kluent.internal.assertFails +import io.kotest.assertions.shouldFail +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.assertions.throwables.shouldThrowAny +import io.kotest.assertions.throwables.shouldThrowUnit +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.equals.shouldBeEqual import org.openrndr.extra.shaderphrases.ShaderPhraseRegistry.getGLSLFunctionName -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe -object TestFunctionNameRx : Spek({ +class TestFunctionNameRx : DescribeSpec({ describe("A function name") { - mapOf( "ivec4 aaa() {" to "aaa", "ivec3 bbb() {" to "bbb", @@ -31,8 +32,8 @@ object TestFunctionNameRx : Spek({ """.trimMargin() to "white" ).forEach { (goodGLSL, expectedFuncName) -> it("can be extracted from valid GLSL") { - getGLSLFunctionName(goodGLSL) `should be equal to` - expectedFuncName + getGLSLFunctionName(goodGLSL).shouldBeEqual( + expectedFuncName) } } } @@ -43,7 +44,7 @@ object TestFunctionNameRx : Spek({ "float rnd {", ).forEach { badGLSL -> it("is not extracted if GLSL function not declared") { - assertFails { + shouldThrowUnit { val funcName = getGLSLFunctionName(badGLSL) } } diff --git a/orx-shader-phrases/src/jvmTest/kotlin/TestShaderPhrase.kt b/orx-shader-phrases/src/jvmTest/kotlin/TestShaderPhrase.kt index d8bb56e7..fa3d8cfb 100644 --- a/orx-shader-phrases/src/jvmTest/kotlin/TestShaderPhrase.kt +++ b/orx-shader-phrases/src/jvmTest/kotlin/TestShaderPhrase.kt @@ -1,10 +1,9 @@ -import org.amshove.kluent.`should be` +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.equals.shouldBeEqual import org.openrndr.extra.shaderphrases.ShaderPhrase import org.openrndr.extra.shaderphrases.ShaderPhraseRegistry -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe -object TestShaderPhrase : Spek({ +class TestShaderPhrase : DescribeSpec({ describe("A shader phrase") { val phrase = ShaderPhrase( """ @@ -16,7 +15,7 @@ object TestShaderPhrase : Spek({ phrase.register() } it("can be found") { - ShaderPhraseRegistry.findPhrase("test_phrase") `should be` phrase + ShaderPhraseRegistry.findPhrase("test_phrase")?.shouldBeEqual(phrase) } } }) diff --git a/orx-shader-phrases/src/jvmTest/kotlin/TestShaderPhraseBook.kt b/orx-shader-phrases/src/jvmTest/kotlin/TestShaderPhraseBook.kt index 8949bc47..bbd88aab 100644 --- a/orx-shader-phrases/src/jvmTest/kotlin/TestShaderPhraseBook.kt +++ b/orx-shader-phrases/src/jvmTest/kotlin/TestShaderPhraseBook.kt @@ -1,11 +1,10 @@ -import org.amshove.kluent.`should be` +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.equals.shouldBeEqual import org.openrndr.extra.shaderphrases.ShaderPhrase import org.openrndr.extra.shaderphrases.ShaderPhraseBook import org.openrndr.extra.shaderphrases.ShaderPhraseRegistry -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe -class TestShaderPhraseBook : Spek({ +class TestShaderPhraseBook : DescribeSpec({ describe("A shader phrase book") { val book = object : ShaderPhraseBook("testBook") { val phrase = ShaderPhrase( @@ -21,7 +20,7 @@ class TestShaderPhraseBook : Spek({ it("can be found") { ShaderPhraseRegistry.findPhrase( "testBook.test_phrase" - ) `should be` book.phrase + )!!.shouldBeEqual(book.phrase) } } }) \ No newline at end of file diff --git a/orx-shader-phrases/src/jvmTest/kotlin/TestShaderPhrasePreprocessing.kt b/orx-shader-phrases/src/jvmTest/kotlin/TestShaderPhrasePreprocessing.kt index 28f0465b..8dea1be1 100644 --- a/orx-shader-phrases/src/jvmTest/kotlin/TestShaderPhrasePreprocessing.kt +++ b/orx-shader-phrases/src/jvmTest/kotlin/TestShaderPhrasePreprocessing.kt @@ -1,12 +1,11 @@ -import org.amshove.kluent.`should contain` -import org.amshove.kluent.`should not contain` +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.string.shouldContain +import io.kotest.matchers.string.shouldNotContain import org.openrndr.extra.shaderphrases.ShaderPhrase import org.openrndr.extra.shaderphrases.ShaderPhraseBook import org.openrndr.extra.shaderphrases.preprocessShader -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe -class TestShaderPhrasePreprocessing : Spek({ +class TestShaderPhrasePreprocessing : DescribeSpec({ describe("the glsl code") { val book = object : ShaderPhraseBook("testBook") { val phrase1 = ShaderPhrase("vec3 phrase1() { }") @@ -24,19 +23,19 @@ class TestShaderPhrasePreprocessing : Spek({ val glslProcessed = preprocessShader(glsl) it("should not contain phrase1 before preprocessing") { - glsl `should not contain` book.phrase1.phrase + glsl.shouldNotContain(book.phrase1.phrase) } it("should not contain phrase2 before preprocessing") { - glsl `should not contain` book.phrase2.phrase + glsl.shouldNotContain(book.phrase2.phrase) } it("should contain phrase1 after preprocessing") { - glslProcessed `should contain` book.phrase1.phrase + glslProcessed.shouldContain(book.phrase1.phrase) } it("should contain phrase2 after preprocessing") { - glslProcessed `should contain` book.phrase2.phrase + glslProcessed.shouldContain(book.phrase2.phrase) } } }) \ No newline at end of file diff --git a/orx-shapes/build.gradle.kts b/orx-shapes/build.gradle.kts index cdbeb29d..77d0aef0 100644 --- a/orx-shapes/build.gradle.kts +++ b/orx-shapes/build.gradle.kts @@ -1,18 +1,10 @@ plugins { org.openrndr.extra.convention.`kotlin-multiplatform` + alias(libs.plugins.kotest.multiplatform) } kotlin { - jvm { - testRuns["test"].executionTask { - useJUnitPlatform { - includeEngines("spek2") - } - } - } - sourceSets { - @Suppress("UNUSED_VARIABLE") val commonMain by getting { dependencies { implementation(project(":orx-parameters")) @@ -25,24 +17,21 @@ kotlin { } } - @Suppress("UNUSED_VARIABLE") val jvmMain by getting { dependencies { implementation(project(":orx-triangulation")) } } - @Suppress("UNUSED_VARIABLE") val jvmTest by getting { dependencies { - implementation(libs.kluent) - implementation(libs.spek.dsl) - runtimeOnly(libs.spek.junit5) + implementation(libs.kotest.assertions) + implementation(libs.kotest.framework.engine) + implementation(libs.kotlin.serialization.json) runtimeOnly(libs.kotlin.reflect) } } - @Suppress("UNUSED_VARIABLE") val jvmDemo by getting { dependencies { implementation(project(":orx-camera")) diff --git a/orx-shapes/src/jvmTest/kotlin/Assertions.kt b/orx-shapes/src/jvmTest/kotlin/Assertions.kt index aa246dd1..dafa6225 100644 --- a/orx-shapes/src/jvmTest/kotlin/Assertions.kt +++ b/orx-shapes/src/jvmTest/kotlin/Assertions.kt @@ -1,7 +1,8 @@ -import org.amshove.kluent.shouldBeInRange +import io.kotest.matchers.doubles.plusOrMinus +import io.kotest.matchers.shouldBe import org.openrndr.math.Vector2 infix fun Vector2.`should be near`(other: Vector2) { - x shouldBeInRange (other.x - 0.00001..other.x + 0.00001) - y shouldBeInRange (other.y - 0.00001..other.y + 0.00001) + x shouldBe other.x.plusOrMinus(1E-5) + y shouldBe other.y.plusOrMinus(1E-5) } diff --git a/orx-shapes/src/jvmTest/kotlin/TestChamferCorners.kt b/orx-shapes/src/jvmTest/kotlin/TestChamferCorners.kt index c13f48c0..63c66768 100644 --- a/orx-shapes/src/jvmTest/kotlin/TestChamferCorners.kt +++ b/orx-shapes/src/jvmTest/kotlin/TestChamferCorners.kt @@ -1,13 +1,12 @@ -import org.amshove.kluent.`should be equal to` +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.equals.shouldBeEqual import org.openrndr.extra.shapes.operators.bevelCorners import org.openrndr.extra.shapes.operators.roundCorners import org.openrndr.extra.shapes.regularPolygon import org.openrndr.shape.Circle import org.openrndr.shape.contour -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe -object TestChamferCorners : Spek({ +class TestChamferCorners : DescribeSpec({ describe("a single segment linear contour") { val c = contour { @@ -17,10 +16,10 @@ object TestChamferCorners : Spek({ it("should be similar to a chamfered version") { val cc = c.bevelCorners(10.0) - cc.segments.size `should be equal to` 1 + cc.segments.size shouldBeEqual 1 cc.position(0.0) `should be near` c.position(0.0) cc.position(1.0) `should be near` c.position(1.0) - cc.closed `should be equal to` c.closed + cc.closed shouldBeEqual c.closed } } @@ -32,7 +31,7 @@ object TestChamferCorners : Spek({ it("should be similar to a chamfered version") { val cc = c.bevelCorners(10.0) - cc.segments.size `should be equal to` 1 + cc.segments.size shouldBeEqual 1 cc.position(0.0) `should be near` c.position(0.0) cc.position(0.5) `should be near` c.position(0.5) cc.position(1.0) `should be near` c.position(1.0) @@ -44,12 +43,12 @@ object TestChamferCorners : Spek({ it("should be similar to a chamfered version") { val cc = c.bevelCorners(10.0) - cc.segments.size `should be equal to` c.segments.size + cc.segments.size shouldBeEqual c.segments.size cc.position(0.0) `should be near` c.position(0.0) cc.position(0.5) `should be near` c.position(0.5) cc.position(1.0) `should be near` c.position(1.0) - cc.closed `should be equal to` c.closed - c.winding `should be equal to` cc.winding + cc.closed shouldBeEqual c.closed + c.winding shouldBeEqual cc.winding } } @@ -61,10 +60,10 @@ object TestChamferCorners : Spek({ } it("should chamfer correctly") { val cc = c.bevelCorners(10.0) - cc.segments.size `should be equal to` 3 + cc.segments.size shouldBeEqual 3 cc.position(0.0) `should be near` c.position(0.0) cc.position(1.0) `should be near` c.position(1.0) - cc.closed `should be equal to` c.closed + cc.closed shouldBeEqual c.closed } } @@ -76,10 +75,10 @@ object TestChamferCorners : Spek({ } it("should be identical to the chamfered version") { val cc = c.bevelCorners(10.0) - cc.segments.size `should be equal to` c.segments.size + cc.segments.size shouldBeEqual c.segments.size cc.position(0.0) `should be near` c.position(0.0) cc.position(1.0) `should be near` c.position(1.0) - cc.closed `should be equal to` c.closed + cc.closed shouldBeEqual c.closed } } @@ -92,14 +91,14 @@ object TestChamferCorners : Spek({ } it("should be identical to the chamfered version") { val cc = c.bevelCorners(10.0) - cc.segments.size `should be equal to` c.segments.size + cc.segments.size shouldBeEqual c.segments.size cc.position(0.0) `should be near` c.position(0.0) cc.position(1.0) `should be near` c.position(1.0) - cc.closed `should be equal to` c.closed + cc.closed shouldBeEqual c.closed } } - describe("a two segment curve-linear contour") { + describe("another two segment curve-linear contour") { val c = contour { moveTo(0.0, 0.0) curveTo(80.0, 120.0, 50.0, 50.0) @@ -108,29 +107,29 @@ object TestChamferCorners : Spek({ } it("should be identical to the chamfered version") { val cc = c.bevelCorners(10.0) - cc.segments.size `should be equal to` c.segments.size + cc.segments.size shouldBeEqual c.segments.size cc.position(0.0) `should be near` c.position(0.0) cc.position(1.0) `should be near` c.position(1.0) - cc.closed `should be equal to` c.closed + cc.closed shouldBeEqual c.closed } } describe("a triangle") { val c = regularPolygon(3, radius = 100.0) - c.closed `should be equal to` true + c.closed shouldBeEqual true val cc = c.roundCorners(1.0) - c.winding `should be equal to` cc.winding + c.winding shouldBeEqual cc.winding - c.closed `should be equal to` cc.closed + c.closed shouldBeEqual cc.closed val ccc = cc.roundCorners(1.0) - ccc.closed `should be equal to` cc.closed + ccc.closed shouldBeEqual cc.closed - cc.segments.size `should be equal to` 6 + cc.segments.size shouldBeEqual 6 // cc.segments.forEach { // println(it) @@ -141,7 +140,7 @@ object TestChamferCorners : Spek({ // println(it) // } it("should have 6 sides") { - ccc.segments.size `should be equal to` cc.segments.size + ccc.segments.size shouldBeEqual cc.segments.size } it("should start at the right position") { ccc.position(0.0) `should be near` cc.position(0.0) diff --git a/orx-shapes/src/jvmTest/kotlin/TestRegularPolygon.kt b/orx-shapes/src/jvmTest/kotlin/TestRegularPolygon.kt index 24ca290f..c88ce713 100644 --- a/orx-shapes/src/jvmTest/kotlin/TestRegularPolygon.kt +++ b/orx-shapes/src/jvmTest/kotlin/TestRegularPolygon.kt @@ -1,23 +1,21 @@ -import org.amshove.kluent.`should be equal to` +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.booleans.shouldBeTrue +import io.kotest.matchers.equals.shouldBeEqual import org.openrndr.extra.shapes.regularPolygon import org.openrndr.extra.shapes.regularPolygonBeveled import org.openrndr.extra.shapes.regularPolygonRounded import org.openrndr.shape.Winding -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe - -object TestRegularPolygon : Spek({ - +class TestRegularPolygon : DescribeSpec({ describe("a regular polygon with 3 sides") { val rp = regularPolygon(3) it("is closed") { - rp.closed `should be equal to` true + rp.closed.shouldBeTrue() } it("has clockwise winding") { - rp.winding `should be equal to` Winding.CLOCKWISE + rp.winding.shouldBeEqual(Winding.CLOCKWISE) } } @@ -25,11 +23,11 @@ object TestRegularPolygon : Spek({ val rp = regularPolygonRounded(3) it("is closed") { - rp.closed `should be equal to` true + rp.closed.shouldBeTrue() } it("has clockwise winding") { - rp.winding `should be equal to` Winding.CLOCKWISE + rp.winding.shouldBeEqual(Winding.CLOCKWISE) } } @@ -37,13 +35,11 @@ object TestRegularPolygon : Spek({ val rp = regularPolygonBeveled(3) it("is closed") { - rp.closed `should be equal to` true + rp.closed.shouldBeTrue() } it("has clockwise winding") { - rp.winding `should be equal to` Winding.CLOCKWISE + rp.winding.shouldBeEqual(Winding.CLOCKWISE) } } - - }) \ No newline at end of file diff --git a/orx-shapes/src/jvmTest/kotlin/TestRegularStar.kt b/orx-shapes/src/jvmTest/kotlin/TestRegularStar.kt index 2a462d98..b278e688 100644 --- a/orx-shapes/src/jvmTest/kotlin/TestRegularStar.kt +++ b/orx-shapes/src/jvmTest/kotlin/TestRegularStar.kt @@ -1,22 +1,22 @@ -import org.amshove.kluent.`should be equal to` +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.booleans.shouldBeTrue +import io.kotest.matchers.equals.shouldBeEqual import org.openrndr.extra.shapes.regularPolygonBeveled import org.openrndr.extra.shapes.regularPolygonRounded import org.openrndr.extra.shapes.regularStar import org.openrndr.extra.shapes.regularStarRounded import org.openrndr.shape.Winding -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe -object TestRegularStar : Spek({ - describe("a regular star with 5 points") { +class TestRegularStar : DescribeSpec({ + describe("the regular star with 5 points") { val rs = regularStar(5, 10.0, 20.0) - it("is closed") { - rs.closed `should be equal to` true + it("should be closed") { + rs.closed.shouldBeTrue() } - it("has clockwise winding") { - rs.winding `should be equal to` Winding.CLOCKWISE + it("should have clockwise winding") { + rs.winding.shouldBeEqual(Winding.CLOCKWISE) } } @@ -24,11 +24,11 @@ object TestRegularStar : Spek({ val rs = regularStarRounded(5, 10.0, 20.0, 0.2, 0.2) it("is closed") { - rs.closed `should be equal to` true + rs.closed.shouldBeTrue() } it("has clockwise winding") { - rs.winding `should be equal to` Winding.CLOCKWISE + rs.winding.shouldBeEqual(Winding.CLOCKWISE) } } @@ -36,12 +36,11 @@ object TestRegularStar : Spek({ val rs = regularPolygonBeveled(5, 0.5) it("is closed") { - rs.closed `should be equal to` true + rs.closed.shouldBeTrue() } it("has clockwise winding") { - rs.winding `should be equal to` Winding.CLOCKWISE + rs.winding.shouldBeEqual(Winding.CLOCKWISE) } } - }) \ No newline at end of file diff --git a/orx-shapes/src/jvmTest/kotlin/TestRoundedRectangle.kt b/orx-shapes/src/jvmTest/kotlin/TestRoundedRectangle.kt index 4c7c5ab3..86d71079 100644 --- a/orx-shapes/src/jvmTest/kotlin/TestRoundedRectangle.kt +++ b/orx-shapes/src/jvmTest/kotlin/TestRoundedRectangle.kt @@ -1,20 +1,19 @@ -import org.amshove.kluent.`should be equal to` +import io.kotest.core.spec.style.DescribeSpec +import io.kotest.matchers.booleans.shouldBeTrue +import io.kotest.matchers.equals.shouldBeEqual import org.openrndr.extra.shapes.* import org.openrndr.shape.Winding -import org.spekframework.spek2.Spek -import org.spekframework.spek2.style.specification.describe -object TestRoundedRectangle : Spek({ +class TestRoundedRectangle : DescribeSpec({ describe("a rounded square") { val rs = RoundedRectangle(100.0, 100.0, 200.0, 200.0, 20.0).contour it("is closed") { - rs.closed `should be equal to` true + rs.closed.shouldBeTrue() } it("has clockwise winding") { - rs.winding `should be equal to` Winding.CLOCKWISE + rs.winding.shouldBeEqual(Winding.CLOCKWISE) } } - }) \ No newline at end of file diff --git a/orx-view-box/build.gradle.kts b/orx-view-box/build.gradle.kts index 516945ec..251655aa 100644 --- a/orx-view-box/build.gradle.kts +++ b/orx-view-box/build.gradle.kts @@ -6,7 +6,6 @@ kotlin { jvm { testRuns["test"].executionTask { useJUnitPlatform { - includeEngines("spek2") } } }