Remove Spek add Kotest
This commit is contained in:
@@ -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"))
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user