Remove Spek add Kotest

This commit is contained in:
Edwin Jakobs
2023-11-18 22:36:35 +01:00
parent 2d3ae83729
commit 5012f8fb14
34 changed files with 255 additions and 309 deletions

View File

@@ -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"))

View File

@@ -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])
}
})

View File

@@ -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