Skip to content

Commit 59f783c

Browse files
committed
Disable tests related to wasm precition problems
1 parent 27e9291 commit 59f783c

File tree

1 file changed

+23
-6
lines changed
  • json-schema-validator-objects/src/commonTest/kotlin/io/github/optimumcode/json/schema/objects/wrapper

1 file changed

+23
-6
lines changed

json-schema-validator-objects/src/commonTest/kotlin/io/github/optimumcode/json/schema/objects/wrapper/WrappersTest.kt

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import io.kotest.core.Platform
1111
import io.kotest.core.platform
1212
import io.kotest.core.spec.style.FunSpec
1313
import io.kotest.core.test.Enabled
14+
import io.kotest.core.test.EnabledOrReasonIf
1415
import io.kotest.matchers.booleans.shouldBeFalse
1516
import io.kotest.matchers.booleans.shouldBeTrue
1617
import io.kotest.matchers.collections.shouldContainExactly
@@ -199,15 +200,31 @@ class WrappersTest : FunSpec() {
199200
}
200201
}
201202

202-
mapOf(
203-
42.2f to 42.2,
204-
42.5f to 42.5,
205-
42.5 to 42.5,
206-
).forEach { (originalNumber, convertedNumber) ->
203+
class DoubleConversionTestCase(
204+
val initial: Any,
205+
val expected: Double,
206+
)
207+
208+
mapOf<DoubleConversionTestCase, EnabledOrReasonIf>(
209+
DoubleConversionTestCase(
210+
42.2f,
211+
42.2,
212+
) to {
213+
if (platform == Platform.WasmJs) {
214+
Enabled.disabled("problems with precision on wasm platform")
215+
} else {
216+
Enabled.enabled
217+
}
218+
},
219+
DoubleConversionTestCase(42.5f, 42.5) to { Enabled.enabled },
220+
DoubleConversionTestCase(42.5, 42.5) to { Enabled.enabled },
221+
).forEach { (tc, condition) ->
222+
val originalNumber = tc.initial
223+
val convertedNumber = tc.expected
207224
val name =
208225
"floating number $originalNumber ${originalNumber.type()}" +
209226
"converted to $convertedNumber ${convertedNumber.type()}"
210-
test(name) {
227+
test(name).config(enabledOrReasonIf = condition) {
211228
wrapAsElement(originalNumber).shouldBeInstanceOf<PrimitiveElement> {
212229
it.doubleOrNull.shouldNotBeNull()
213230
.shouldBe(convertedNumber)

0 commit comments

Comments
 (0)