[Native][test] Exclude FP parsing tests that require exceptions on WASM
This commit is contained in:
@@ -6,6 +6,8 @@
|
|||||||
package runtime.text.parse0
|
package runtime.text.parse0
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
import kotlin.native.OsFamily
|
||||||
|
import kotlin.native.Platform
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun runTest() {
|
fun runTest() {
|
||||||
@@ -51,31 +53,33 @@ fun checkDouble() {
|
|||||||
assertTrue("NaN".toDouble().isNaN(), "NaN is expected for parsing NaN")
|
assertTrue("NaN".toDouble().isNaN(), "NaN is expected for parsing NaN")
|
||||||
assertTrue("-NaN".toDouble().isNaN(), "NaN is expected for parsing -NaN")
|
assertTrue("-NaN".toDouble().isNaN(), "NaN is expected for parsing -NaN")
|
||||||
|
|
||||||
assertFailsWith<NumberFormatException> {
|
if (Platform.osFamily != OsFamily.WASM) {
|
||||||
"+-5.0".toDouble()
|
assertFailsWith<NumberFormatException> {
|
||||||
}
|
"+-5.0".toDouble()
|
||||||
assertFailsWith<NumberFormatException> {
|
}
|
||||||
"d".toDouble()
|
assertFailsWith<NumberFormatException> {
|
||||||
}
|
"d".toDouble()
|
||||||
assertFailsWith<NumberFormatException> {
|
}
|
||||||
"5.5.3e123d".toDouble()
|
assertFailsWith<NumberFormatException> {
|
||||||
}
|
"5.5.3e123d".toDouble()
|
||||||
|
}
|
||||||
|
|
||||||
// regression of incorrect processing of long lines - such values returned Infinity
|
// regression of incorrect processing of long lines - such values returned Infinity
|
||||||
assertFailsWith<NumberFormatException> {
|
assertFailsWith<NumberFormatException> {
|
||||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".toDouble()
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".toDouble()
|
||||||
}
|
}
|
||||||
assertFailsWith<NumberFormatException> {
|
assertFailsWith<NumberFormatException> {
|
||||||
"+-my free text with different letters $3213#. e ".toDouble()
|
"+-my free text with different letters $3213#. e ".toDouble()
|
||||||
}
|
}
|
||||||
assertFailsWith<NumberFormatException> {
|
assertFailsWith<NumberFormatException> {
|
||||||
"eeeeeEEEEEeeeeeee".toDouble()
|
"eeeeeEEEEEeeeeeee".toDouble()
|
||||||
}
|
}
|
||||||
assertFailsWith<NumberFormatException> {
|
assertFailsWith<NumberFormatException> {
|
||||||
"InfinityN".toDouble()
|
"InfinityN".toDouble()
|
||||||
}
|
}
|
||||||
assertFailsWith<NumberFormatException> {
|
assertFailsWith<NumberFormatException> {
|
||||||
"NaNPICEZy".toDouble()
|
"NaNPICEZy".toDouble()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,37 +107,39 @@ fun checkFloat() {
|
|||||||
assertTrue("NaN".toFloat().isNaN(), "NaN is expected for parsing NaN")
|
assertTrue("NaN".toFloat().isNaN(), "NaN is expected for parsing NaN")
|
||||||
assertTrue("-NaN".toFloat().isNaN(), "NaN is expected for parsing -NaN")
|
assertTrue("-NaN".toFloat().isNaN(), "NaN is expected for parsing -NaN")
|
||||||
|
|
||||||
assertFailsWith<NumberFormatException> {
|
if (Platform.osFamily != OsFamily.WASM) {
|
||||||
"+-5.0f".toFloat()
|
assertFailsWith<NumberFormatException> {
|
||||||
}
|
"+-5.0f".toFloat()
|
||||||
assertFailsWith<NumberFormatException> {
|
}
|
||||||
"f".toFloat()
|
assertFailsWith<NumberFormatException> {
|
||||||
}
|
"f".toFloat()
|
||||||
assertFailsWith<NumberFormatException> {
|
}
|
||||||
"5.5.3e123f".toFloat()
|
assertFailsWith<NumberFormatException> {
|
||||||
}
|
"5.5.3e123f".toFloat()
|
||||||
|
}
|
||||||
|
|
||||||
// regression of incorrect processing of long lines - such values returned Infinity
|
// regression of incorrect processing of long lines - such values returned Infinity
|
||||||
assertFailsWith<NumberFormatException> {
|
assertFailsWith<NumberFormatException> {
|
||||||
// should be more than 38 symbols
|
// should be more than 38 symbols
|
||||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".toFloat()
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".toFloat()
|
||||||
}
|
}
|
||||||
assertFailsWith<NumberFormatException> {
|
assertFailsWith<NumberFormatException> {
|
||||||
// should be more than 38 symbols
|
// should be more than 38 symbols
|
||||||
"this string is not a numb3r, am I right?????????????".toFloat()
|
"this string is not a numb3r, am I right?????????????".toFloat()
|
||||||
}
|
}
|
||||||
assertFailsWith<NumberFormatException> {
|
assertFailsWith<NumberFormatException> {
|
||||||
// should be more than 38 symbols
|
// should be more than 38 symbols
|
||||||
"+-my free text with different letters $3213#. e ".toFloat()
|
"+-my free text with different letters $3213#. e ".toFloat()
|
||||||
}
|
}
|
||||||
assertFailsWith<NumberFormatException> {
|
assertFailsWith<NumberFormatException> {
|
||||||
// should be more than 38 symbols
|
// should be more than 38 symbols
|
||||||
"eeeeeEEEEEeeeeeee".toFloat()
|
"eeeeeEEEEEeeeeeee".toFloat()
|
||||||
}
|
}
|
||||||
assertFailsWith<NumberFormatException> {
|
assertFailsWith<NumberFormatException> {
|
||||||
"InfinityN".toFloat()
|
"InfinityN".toFloat()
|
||||||
}
|
}
|
||||||
assertFailsWith<NumberFormatException> {
|
assertFailsWith<NumberFormatException> {
|
||||||
"NaNPICEZy".toFloat()
|
"NaNPICEZy".toFloat()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user