[orx-noise] Move DescribeSpec based tests to jvmTest

This commit is contained in:
Edwin Jakobs
2023-11-30 12:42:53 +01:00
parent 61acf877b3
commit e2a27ebf3d
4 changed files with 1 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
import io.kotest.core.spec.style.DescribeSpec
import org.openrndr.extra.noise.*
import kotlin.test.assertEquals
class TestGradient : DescribeSpec({
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

@@ -0,0 +1,11 @@
import io.kotest.core.spec.style.DescribeSpec
import org.openrndr.extra.noise.fastFloor
import kotlin.test.assertEquals
class TestMathUtils : DescribeSpec({
describe("Fast floor") {
it("it is corrrect for 0.0") {
assertEquals(0, 0.0.fastFloor())
}
}
})

View File

@@ -0,0 +1,93 @@
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 kotlin.test.assertEquals
class TestVectorShortcutFunctions : DescribeSpec({
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))
}
}
})