bump versions
- kotlinx js wrappers - kotest also fix kotest dependencies
This commit is contained in:
parent
93444bfe39
commit
ffe9bcb9a8
4 changed files with 228 additions and 5 deletions
|
|
@ -22,7 +22,8 @@ scrimage = "4.0.31"
|
||||||
kotlinx-serialization = "1.3.2"
|
kotlinx-serialization = "1.3.2"
|
||||||
kxs-yaml = "0.43.0"
|
kxs-yaml = "0.43.0"
|
||||||
|
|
||||||
kotlinJsWrappers = "0.0.1-pre.331-kotlin-1.6.20"
|
#kotlinJsWrappers = "0.0.1-pre.331-kotlin-1.6.20"
|
||||||
|
kotlinJsWrappers = "0.0.1-pre.334"
|
||||||
kotlinx-html = "0.7.5"
|
kotlinx-html = "0.7.5"
|
||||||
kotlinx-nodejs = "0.0.7"
|
kotlinx-nodejs = "0.0.7"
|
||||||
kotlinx-coroutines = "1.6.1"
|
kotlinx-coroutines = "1.6.1"
|
||||||
|
|
@ -32,7 +33,7 @@ ktor = "2.0.1"
|
||||||
|
|
||||||
## test ##
|
## test ##
|
||||||
junit = "5.8.2"
|
junit = "5.8.2"
|
||||||
kotest = "5.2.3"
|
kotest = "5.3.0"
|
||||||
|
|
||||||
## infra ##
|
## infra ##
|
||||||
factorio = "1.1.57"
|
factorio = "1.1.57"
|
||||||
|
|
@ -144,10 +145,10 @@ junit-launcher = { group = "org.junit.platform", name = "junit-platform-launcher
|
||||||
|
|
||||||
## kotest ##
|
## kotest ##
|
||||||
kotest-bom = { group = "io.kotest", name = "kotest-bom", version.ref = "kotest" }
|
kotest-bom = { group = "io.kotest", name = "kotest-bom", version.ref = "kotest" }
|
||||||
kotest-core = { group = "io.kotest", name = "kotest-assertions-core-jvm", version.ref = "kotest" }
|
kotest-core = { group = "io.kotest", name = "kotest-assertions-core", version.ref = "kotest" }
|
||||||
kotest-datatest = { group = "io.kotest", name = "kotest-framework-datatest", version.ref = "kotest" }
|
kotest-datatest = { group = "io.kotest", name = "kotest-framework-datatest", version.ref = "kotest" }
|
||||||
kotest-runner = { group = "io.kotest", name = "kotest-runner-junit5-jvm", version.ref = "kotest" }
|
kotest-runner = { group = "io.kotest", name = "kotest-runner-junit5", version.ref = "kotest" }
|
||||||
kotest-prop = { group = "io.kotest", name = "kotest-property-jvm", version.ref = "kotest" }
|
kotest-prop = { group = "io.kotest", name = "kotest-property", version.ref = "kotest" }
|
||||||
kotest-json = { group = "io.kotest", name = "kotest-assertions-json", version.ref = "kotest" }
|
kotest-json = { group = "io.kotest", name = "kotest-assertions-json", version.ref = "kotest" }
|
||||||
|
|
||||||
## http4k ##
|
## http4k ##
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
package dev.adamko.kafkatorio.schema.common
|
||||||
|
|
||||||
|
import io.kotest.assertions.asClue
|
||||||
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
import io.kotest.matchers.ints.shouldBeExactly
|
||||||
|
|
||||||
|
class MapChunkPositionBoundsTest : FunSpec({
|
||||||
|
|
||||||
|
context("create bounds") {
|
||||||
|
|
||||||
|
context("MapChunkPosition(0, 0)") {
|
||||||
|
|
||||||
|
context("chunk size 32") {
|
||||||
|
|
||||||
|
val chunkPos = MapChunkPosition(0, 0)
|
||||||
|
val bounds = MapChunkPositionBounds(chunkPos, ChunkSize.CHUNK_032)
|
||||||
|
|
||||||
|
test("leftTop should be 0,0") {
|
||||||
|
bounds.leftTop.asClue {
|
||||||
|
it.x shouldBeExactly 0
|
||||||
|
it.y shouldBeExactly 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test("rightBottom should be 31,31") {
|
||||||
|
bounds.rightBottom.asClue {
|
||||||
|
it.x shouldBeExactly 31
|
||||||
|
it.y shouldBeExactly 31
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
context("chunk size 256") {
|
||||||
|
|
||||||
|
val chunkPos = MapChunkPosition(0, 0)
|
||||||
|
val bounds = MapChunkPositionBounds(chunkPos, ChunkSize.CHUNK_256)
|
||||||
|
|
||||||
|
test("leftTop should be 0,0") {
|
||||||
|
bounds.leftTop.asClue {
|
||||||
|
it.x shouldBeExactly 0
|
||||||
|
it.y shouldBeExactly 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test("rightBottom should be 255,255") {
|
||||||
|
bounds.rightBottom.asClue {
|
||||||
|
it.x shouldBeExactly 255
|
||||||
|
it.y shouldBeExactly 255
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
context("MapChunkPosition(-10, -10)") {
|
||||||
|
|
||||||
|
context("chunk size 32") {
|
||||||
|
|
||||||
|
val chunkPos = MapChunkPosition(-10, -10)
|
||||||
|
val bounds = MapChunkPositionBounds(chunkPos, ChunkSize.CHUNK_032)
|
||||||
|
|
||||||
|
test("leftTop should be -320,-320") {
|
||||||
|
bounds.leftTop.asClue {
|
||||||
|
it.x shouldBeExactly -320
|
||||||
|
it.y shouldBeExactly -320
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test("rightBottom should be -289,-289") {
|
||||||
|
bounds.rightBottom.asClue {
|
||||||
|
it.x shouldBeExactly -289
|
||||||
|
it.y shouldBeExactly -289
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
context("chunk size 256") {
|
||||||
|
|
||||||
|
val chunkPos = MapChunkPosition(-10, -10)
|
||||||
|
val bounds = MapChunkPositionBounds(chunkPos, ChunkSize.CHUNK_256)
|
||||||
|
|
||||||
|
test("leftTop should be -2560") {
|
||||||
|
bounds.leftTop.asClue {
|
||||||
|
it.x shouldBeExactly -2560
|
||||||
|
it.y shouldBeExactly -2560
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test("rightBottom should be (-2560 + 255)") {
|
||||||
|
bounds.rightBottom.asClue {
|
||||||
|
it.x shouldBeExactly (-2560 + 255)
|
||||||
|
it.y shouldBeExactly (-2560 + 255)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
@ -0,0 +1,81 @@
|
||||||
|
package dev.adamko.kafkatorio.schema.common
|
||||||
|
|
||||||
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
import io.kotest.datatest.withData
|
||||||
|
import io.kotest.matchers.shouldBe
|
||||||
|
import io.kotest.property.Arb
|
||||||
|
import io.kotest.property.arbitrary.arbitrary
|
||||||
|
import io.kotest.property.arbitrary.int
|
||||||
|
import io.kotest.property.checkAll
|
||||||
|
|
||||||
|
class MapChunkPositionTest : FunSpec({
|
||||||
|
|
||||||
|
context("check MapChunkPosition.contains()") {
|
||||||
|
|
||||||
|
context("MapChunkPosition(0, 0)") {
|
||||||
|
|
||||||
|
val chunkPos = MapChunkPosition(0, 0)
|
||||||
|
|
||||||
|
test("should contain tiles from (0,0) to (31,31)") {
|
||||||
|
checkAll(mapTilePositionArb(0..31)) { tilePos ->
|
||||||
|
(tilePos in chunkPos) shouldBe true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test("should not contain tiles below (0,0)") {
|
||||||
|
checkAll(
|
||||||
|
mapTilePositionArb(-1000..-1)
|
||||||
|
) { tilePos ->
|
||||||
|
(tilePos in chunkPos) shouldBe false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test("should not contain tiles above (31,31)") {
|
||||||
|
checkAll(
|
||||||
|
mapTilePositionArb(32..100)
|
||||||
|
) { tilePos ->
|
||||||
|
(tilePos in chunkPos) shouldBe false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
context("MapChunkPosition(-10, -10)") {
|
||||||
|
|
||||||
|
val chunkPos = MapChunkPosition(-10, -10)
|
||||||
|
|
||||||
|
test("should contain tiles from (-320,-320) to (-289,-289)") {
|
||||||
|
checkAll(mapTilePositionArb(-320..-289)) { tilePos ->
|
||||||
|
(tilePos in chunkPos) shouldBe true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test("should not contain tiles below (-320,-320)") {
|
||||||
|
checkAll(
|
||||||
|
mapTilePositionArb(-400..-321)
|
||||||
|
) { tilePos ->
|
||||||
|
(tilePos in chunkPos) shouldBe false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test("should not contain tiles above (-289,-289)") {
|
||||||
|
checkAll(
|
||||||
|
mapTilePositionArb(-288..100)
|
||||||
|
) { tilePos ->
|
||||||
|
(tilePos in chunkPos) shouldBe false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}) {
|
||||||
|
companion object {
|
||||||
|
fun mapTilePositionArb(
|
||||||
|
range: IntRange = -1000..1000
|
||||||
|
) = arbitrary {
|
||||||
|
MapTilePosition(
|
||||||
|
Arb.int(range).bind(),
|
||||||
|
Arb.int(range).bind(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package dev.adamko.kafkatorio.schema.common
|
||||||
|
|
||||||
|
import dev.adamko.kafkatorio.schema.common.MapChunkPositionTest.Companion.mapTilePositionArb
|
||||||
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
import io.kotest.property.forAll
|
||||||
|
|
||||||
|
class MapTilePositionTest : FunSpec({
|
||||||
|
|
||||||
|
context("comparison") {
|
||||||
|
|
||||||
|
test("less than <") {
|
||||||
|
forAll(
|
||||||
|
mapTilePositionArb(),
|
||||||
|
mapTilePositionArb(1..100),
|
||||||
|
) { tilePos, delta ->
|
||||||
|
tilePos < (tilePos + delta)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test("less than or equal to <=") {
|
||||||
|
forAll(mapTilePositionArb()) { tilePos ->
|
||||||
|
tilePos <= (tilePos)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test("greater than or equal to >=") {
|
||||||
|
forAll(mapTilePositionArb()) { tilePos ->
|
||||||
|
tilePos >= (tilePos)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test("greater than >") {
|
||||||
|
forAll(
|
||||||
|
mapTilePositionArb(),
|
||||||
|
mapTilePositionArb(1..100),
|
||||||
|
) { tilePos, delta ->
|
||||||
|
tilePos > (tilePos - delta)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue