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

@@ -1,33 +0,0 @@
import org.openrndr.extra.noise.*
import org.spekframework.spek2.Spek
import org.spekframework.spek2.style.specification.describe
import kotlin.test.assertEquals
object TestGradient : Spek({
describe("Noise") {
it("has a gradient") {
gradient1D(::perlinLinear, 100, 0.1)
}
}
describe("FBM noise func") {
it("has a gradient") {
val func = fbmFunc1D(::perlinLinear)
gradient1D(func, 100, 0.1)
}
}
describe("Billow noise func") {
it("has a gradient") {
val func = billowFunc1D(::perlinLinear)
gradient1D(func, 100, 0.1)
}
}
describe("Rigid noise func") {
it("has a gradient") {
val func = rigidFunc1D(::perlinLinear)
gradient1D(func, 100, 0.1)
}
}
})

View File

@@ -1,12 +0,0 @@
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({
describe("Fast floor") {
it("it is corrrect for 0.0") {
assertEquals(0, 0.0.fastFloor())
}
}
})

View File

@@ -1,93 +0,0 @@
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({
val v = Vector4(1.13, 2.74, 3.59, 4.83)
describe("perlin with Vector2") {
it("produces expected result") {
assertEquals(Random.perlin(v.x, v.y, Random.Noise.QUINTIC),
Random.perlin(v.xy, Random.Noise.QUINTIC))
}
}
describe("perlin with Vector3") {
it("produces expected result") {
assertEquals(Random.perlin(v.x, v.y, v.z, Random.Noise.QUINTIC),
Random.perlin(v.xyz, Random.Noise.QUINTIC))
}
}
// ---
describe("value with Vector2") {
it("produces expected result") {
assertEquals(Random.value(v.x, v.y, Random.Noise.QUINTIC),
Random.value(v.xy, Random.Noise.QUINTIC))
}
}
describe("value with Vector3") {
it("produces expected result") {
assertEquals(Random.value(v.x, v.y, v.z, Random.Noise.QUINTIC),
Random.value(v.xyz, Random.Noise.QUINTIC))
}
}
// ---
describe("simplex with Vector2") {
it("produces expected result") {
assertEquals(Random.simplex(v.x, v.y), Random.simplex(v.xy))
}
}
describe("simplex with Vector3") {
it("produces expected result") {
assertEquals(Random.simplex(v.x, v.y, v.z), Random.simplex(v.xyz))
}
}
describe("simplex with Vector4") {
it("produces expected result") {
assertEquals(Random.simplex(v.x, v.y, v.z, v.w),
Random.simplex(v))
}
}
// ---
describe("fbm with Vector2") {
it("produces expected result") {
assertEquals(Random.fbm(v.x, v.y, ::perlinQuintic),
Random.fbm(v.xy, ::perlinQuintic))
}
}
describe("fbm with Vector3") {
it("produces expected result") {
assertEquals(Random.fbm(v.x, v.y, v.z, ::perlinQuintic),
Random.fbm(v.xyz, ::perlinQuintic))
}
}
// ---
describe("cubic with Vector2") {
it("produces expected result") {
assertEquals(Random.cubic(v.x, v.y), Random.cubic(v.xy))
}
}
describe("cubic with Vector3") {
it("produces expected result") {
assertEquals(Random.cubic(v.x, v.y, v.z), Random.cubic(v.xyz))
}
}
})