Skip to content

Commit b881a26

Browse files
skarpovdevdevcrocod
authored andcommitted
fixup! Introduce Kotlin integration tests
1 parent bae5f68 commit b881a26

File tree

1 file changed

+7
-1
lines changed
  • kotlin-sdk-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/kotlin

1 file changed

+7
-1
lines changed

kotlin-sdk-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/kotlin/ToolIntegrationTest.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import kotlinx.serialization.json.buildJsonObject
1818
import kotlinx.serialization.json.put
1919
import org.junit.jupiter.api.Test
2020
import org.junit.jupiter.api.assertThrows
21+
import java.text.DecimalFormat
22+
import java.text.DecimalFormatSymbols
23+
import java.util.Locale
2124
import kotlin.test.assertEquals
2225
import kotlin.test.assertNotNull
2326
import kotlin.test.assertTrue
@@ -161,7 +164,10 @@ class ToolIntegrationTest : KotlinTestBase() {
161164
else -> 0.0
162165
}
163166

164-
val formattedResult = "%.${precision}f".format(result)
167+
val pattern = if (precision > 0) "0." + "0".repeat(precision) else "0"
168+
val symbols = DecimalFormatSymbols(Locale.US).apply { decimalSeparator = ',' }
169+
val df = DecimalFormat(pattern, symbols).apply { isGroupingUsed = false }
170+
val formattedResult = df.format(result)
165171

166172
val textContent = if (showSteps) {
167173
"Operation: $operation\nA: $a\nB: $b\nResult: $formattedResult\nTags: ${

0 commit comments

Comments
 (0)