Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump deps #563

Merged
merged 8 commits into from
Nov 28, 2023
11 changes: 5 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
arrow = "1.2.1"
arrowGradle = "0.12.0-rc.6"
exposed = "0.44.1"
kotlin = "1.9.10"
kotlinx-json = "1.6.0"
kotlin = "1.9.20"
kotlinx-json = "1.6.1"
kotlinx-datetime = "0.4.1"
ktor = "2.3.6"
spotless = "6.22.0"
Expand All @@ -12,8 +12,8 @@ kotest = "5.8.0"
kotest-testcontainers = "2.0.2"
kotest-arrow = "1.4.0"
klogging = "5.1.0"
uuid = "0.0.21"
postgresql = "42.6.0"
uuid = "0.0.22"
postgresql = "42.7.0"
testcontainers = "1.19.1"
hikari = "5.0.1"
dokka = "1.9.10"
Expand All @@ -27,7 +27,7 @@ pdfbox = "3.0.0"
mysql = "8.0.33"
semverGradle = "0.5.0-rc.5"
openai-client-version = "3.5.1"
jackson = "2.15.3"
jackson = "2.16.0"
jsonschema = "4.32.0"
jakarta = "3.0.2"
suspend-transform = "0.5.1"
Expand Down Expand Up @@ -83,7 +83,6 @@ kotest-framework = { module = "io.kotest:kotest-framework-engine", version.ref =
kotest-property = { module = "io.kotest:kotest-property", version.ref = "kotest" }
kotest-junit5 = { module = "io.kotest:kotest-runner-junit5", version.ref = "kotest" }
kotest-testcontainers = { module = "io.kotest.extensions:kotest-extensions-testcontainers", version.ref = "kotest-testcontainers" }
kotest-assertions-arrow = { module = "io.kotest.extensions:kotest-assertions-arrow", version.ref = "kotest-arrow" }
ktor-serialization-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" }
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" }
Expand Down
3 changes: 0 additions & 3 deletions tokenizer/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.kotest.multiplatform)
alias(libs.plugins.spotless)
alias(libs.plugins.arrow.gradle.publish)
alias(libs.plugins.semver.gradle)
Expand Down Expand Up @@ -41,12 +40,10 @@ kotlin {
dependencies {
implementation(kotlin("test"))
implementation(libs.kotest.property)
implementation(libs.kotest.framework)
implementation(libs.kotest.assertions)
implementation("com.goncalossilva:resources:0.3.2")
}
}
val jvmTest by getting { dependencies { implementation(libs.kotest.junit5) } }
js {
nodejs { testTask { useMocha { timeout = "10000" } } }
browser { testTask { useMocha { timeout = "10000" } } }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
package com.xebia.functional.tokenizer

import io.kotest.assertions.throwables.shouldThrow
import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.shouldBe
import io.kotest.matchers.shouldNotBe
import kotlin.test.Test

class ImmutableByteArrayTest : StringSpec({
"can be used as key in map" {
class ImmutableByteArrayTest {
@Test
fun canBeUsedAsKeyInMap() {
val key1 = ImmutableByteArray.from("1, 2, 3")
val key2 = ImmutableByteArray.from("1, 2, 3")

key1 shouldBe key2
key1.hashCode() shouldBe key2.hashCode()
}

"cannot be mutated when using ByteArray constructor" {

@Test
fun cannotBeMutatedWhenUsingByteArrayConstructor() {
val bytes = byteArrayOf(1, 2, 3)
val byteArray = ImmutableByteArray.from(bytes)

Expand All @@ -24,7 +27,8 @@ class ImmutableByteArrayTest : StringSpec({
byteArray shouldBe ImmutableByteArray.from(byteArrayOf(1, 2, 3))
}

"cannot be mutated when using rawArray" {
@Test
fun cannotBeMutatedWhenUsingRawArray() {
val byteArray = ImmutableByteArray.from("1, 2, 3")
val bytes = byteArray.rawArray

Expand All @@ -34,35 +38,40 @@ class ImmutableByteArrayTest : StringSpec({
byteArray shouldBe ImmutableByteArray.from("1, 2, 3")
}

"getLength is correct" {
@Test
fun getLengthIsCorrect() {
val byteArray = ImmutableByteArray.from("1, 2, 3")

byteArray.size shouldBe 7
}

"getBytesBetween returns correct slice of array" {
@Test
fun getBytesBetweenReturnsCorrectSliceOfArray() {
val byteArray = ImmutableByteArray.from(byteArrayOf(1, 2, 3, 4, 5, 6))

byteArray.getBytesBetween(3, 6) shouldBe ImmutableByteArray.from(byteArrayOf(4, 5, 6))
}

"getBytesBetween throws when inclusive startIndex is out of bounds" {
@Test
fun getBytesBetweenThrowsWhenInclusiveStartIndexIsOutOfBounds() {
val byteArray = ImmutableByteArray.from(byteArrayOf(1, 2, 3, 4, 5, 6))

shouldThrow<IndexOutOfBoundsException> { byteArray.getBytesBetween(-1, 6) }
shouldThrow<IndexOutOfBoundsException> { byteArray.getBytesBetween(9, 10) }
}

"getBytesBetween throws when exclusive endIndex is out of bounds" {
@Test
fun getBytesBetweenThrowsWhenExclusiveEndIndexIsOutOfBounds() {
val byteArray = ImmutableByteArray.from(byteArrayOf(1, 2, 3, 4, 5, 6))

shouldThrow<IndexOutOfBoundsException> { byteArray.getBytesBetween(0, 7) }
shouldThrow<IndexOutOfBoundsException> { byteArray.getBytesBetween(0, -1) }
}

"getBytesBetween throws when startIndex is greater than endIndex" {
@Test
fun getBytesBetweenThrowsWhenStartIndexIsGreaterThanEndIndex() {
val byteArray = ImmutableByteArray.from(byteArrayOf(1, 2, 3, 4, 5, 6))

shouldThrow<IllegalArgumentException> { byteArray.getBytesBetween(3, 2) }
}
})
}
Loading