Skip to content

Commit

Permalink
Fix unexpected "Out of heap space grow heap" error after migration to…
Browse files Browse the repository at this point in the history
… Scala Native 0.5.5
  • Loading branch information
plokhotnyuk committed Aug 19, 2024
1 parent 92eae3e commit 16ab14c
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2417,7 +2417,7 @@ class JsonReaderSpec extends AnyWordSpec with Matchers with ScalaCheckPropertyCh
forAll(arbitrary[Byte], genWhitespaces, minSuccessful(10000))(check)
}
"parse keys and strigified values with leading zeros" in {
forAll(arbitrary[Byte].map(x => f"$x%05d"), genWhitespaces, minSuccessful(1000))(check2)
forAll(arbitrary[Byte].map(x => f"$x%05d"), genWhitespaces, minSuccessful(100))(check2)
}
"throw parsing exception on valid number values with '.', 'e', 'E' chars" in {
checkError("123.0", "illegal number, offset: 0x00000003", "illegal number, offset: 0x00000004")
Expand Down Expand Up @@ -2481,7 +2481,7 @@ class JsonReaderSpec extends AnyWordSpec with Matchers with ScalaCheckPropertyCh
forAll(arbitrary[Short], genWhitespaces, minSuccessful(10000))(check)
}
"parse keys and strigified values with leading zeros" in {
forAll(arbitrary[Short].map(x => f"$x%07d"), genWhitespaces, minSuccessful(1000))(check2)
forAll(arbitrary[Short].map(x => f"$x%07d"), genWhitespaces, minSuccessful(100))(check2)
}
"throw parsing exception on valid number values with '.', 'e', 'E' chars" in {
checkError("12345.0", "illegal number, offset: 0x00000005", "illegal number, offset: 0x00000006")
Expand Down Expand Up @@ -2545,7 +2545,7 @@ class JsonReaderSpec extends AnyWordSpec with Matchers with ScalaCheckPropertyCh
forAll(arbitrary[Int], genWhitespaces, minSuccessful(10000))(check)
}
"parse keys and strigified values with leading zeros" in {
forAll(arbitrary[Int].map(x => f"$x%011d"), genWhitespaces, minSuccessful(1000))(check2)
forAll(arbitrary[Int].map(x => f"$x%011d"), genWhitespaces, minSuccessful(100))(check2)
}
"throw parsing exception on valid number values with '.', 'e', 'E' chars" in {
checkError("123456789.0", "illegal number, offset: 0x00000009", "illegal number, offset: 0x0000000a")
Expand Down Expand Up @@ -2613,7 +2613,7 @@ class JsonReaderSpec extends AnyWordSpec with Matchers with ScalaCheckPropertyCh
forAll(arbitrary[Long], genWhitespaces, minSuccessful(10000))(check)
}
"parse keys and strigified values with leading zeros" in {
forAll(arbitrary[Long].map(x => f"$x%021d"), genWhitespaces, minSuccessful(1000))(check2)
forAll(arbitrary[Long].map(x => f"$x%021d"), genWhitespaces, minSuccessful(100))(check2)
}
"throw parsing exception on valid number values with '.', 'e', 'E' chars" in {
checkError("1234567890123456789.0", "illegal number, offset: 0x00000013", "illegal number, offset: 0x00000014")
Expand Down Expand Up @@ -2747,7 +2747,7 @@ class JsonReaderSpec extends AnyWordSpec with Matchers with ScalaCheckPropertyCh
}
}
"parse keys and strigified values with leading zeros in mantissas and exponents" in {
forAll(arbitrary[Float], choose(1, 7), genWhitespaces, minSuccessful(1000)) { (x, z, ws) =>
forAll(arbitrary[Float], choose(1, 7), genWhitespaces, minSuccessful(100)) { (x, z, ws) =>
check2({
val s = x.toString
if (x < 0) s.replace("-", "-" + zeros(z))
Expand All @@ -2765,7 +2765,7 @@ class JsonReaderSpec extends AnyWordSpec with Matchers with ScalaCheckPropertyCh
}
}
"parse denormalized numbers with long mantissa and compensating exponent" in {
forAll(genWhitespaces) { ws =>
forAll(genWhitespaces, minSuccessful(10)) { ws =>
check("1" + millionZeros + "e-1000000", 1.0f, ws)
check("0." + millionZeros + "1e1000000", 0.1f, ws)
}
Expand Down Expand Up @@ -2885,7 +2885,7 @@ class JsonReaderSpec extends AnyWordSpec with Matchers with ScalaCheckPropertyCh
}
}
"parse keys and strigified values with leading zeros in mantissas and exponents" in {
forAll(arbitrary[Double], choose(1, 7), genWhitespaces, minSuccessful(1000)) { (x, z, ws) =>
forAll(arbitrary[Double], choose(1, 7), genWhitespaces, minSuccessful(100)) { (x, z, ws) =>
check2({
val s = x.toString
if (x < 0) s.replace("-", "-" + zeros(z))
Expand All @@ -2903,7 +2903,7 @@ class JsonReaderSpec extends AnyWordSpec with Matchers with ScalaCheckPropertyCh
}
}
"parse denormalized numbers with long mantissa and compensating exponent" in {
forAll(genWhitespaces) { ws =>
forAll(genWhitespaces, minSuccessful(10)) { ws =>
check("1" + millionZeros + "e-1000000", 1.0, ws)
check("0." + millionZeros + "1e1000000", 0.1, ws)
}
Expand Down Expand Up @@ -2978,14 +2978,14 @@ class JsonReaderSpec extends AnyWordSpec with Matchers with ScalaCheckPropertyCh
forAll(genBigInt, genWhitespaces, minSuccessful(10000))(check)
}
"parse keys and strigified values with leading zeros" in {
forAll(genBigInt, choose(1, 7), genWhitespaces, minSuccessful(1000))((x, z, ws) => check2({
forAll(genBigInt, choose(1, 7), genWhitespaces, minSuccessful(100))((x, z, ws) => check2({
val s = x.toString
if (x < 0) s.replace("-", "-" + zeros(z))
else zeros(z) + s
}, ws))
}
"parse big number values without overflow up to limits" in {
forAll(genWhitespaces) { ws =>
forAll(genWhitespaces, minSuccessful(10)) { ws =>
check(BigInt(bigNumber), ws)
check(BigInt(s"-$bigNumber"), ws)
}
Expand Down Expand Up @@ -3090,7 +3090,7 @@ class JsonReaderSpec extends AnyWordSpec with Matchers with ScalaCheckPropertyCh
}
}
"parse big number values without overflow up to limits" in {
forAll(genWhitespaces) { ws =>
forAll(genWhitespaces, minSuccessful(10)) { ws =>
check(fill('9', 300), bigDecimalMathContext, bigDecimalScaleLimit, bigDecimalDigitsLimit, ws)
check("12345e67", bigDecimalMathContext, bigDecimalScaleLimit, bigDecimalDigitsLimit, ws)
check("-12345e67", bigDecimalMathContext, bigDecimalScaleLimit, bigDecimalDigitsLimit, ws)
Expand All @@ -3102,7 +3102,7 @@ class JsonReaderSpec extends AnyWordSpec with Matchers with ScalaCheckPropertyCh
}
}
"parse small number values without underflow up to limits" in {
forAll(genWhitespaces) { ws =>
forAll(genWhitespaces, minSuccessful(10)) { ws =>
check(s"0.${zeros(100)}1234567890123456789012345678901234",
bigDecimalMathContext, bigDecimalScaleLimit, bigDecimalDigitsLimit, ws)
check("12345e-67", bigDecimalMathContext, bigDecimalScaleLimit, bigDecimalDigitsLimit, ws)
Expand All @@ -3115,7 +3115,7 @@ class JsonReaderSpec extends AnyWordSpec with Matchers with ScalaCheckPropertyCh
}
}
"parse keys and strigified values with leading zeros in mantissas and exponents" in {
forAll(genBigDecimal, choose(1, 7), genWhitespaces, minSuccessful(1000)) { (x, z, ws) =>
forAll(genBigDecimal, choose(1, 7), genWhitespaces, minSuccessful(100)) { (x, z, ws) =>
check2({
val s = x.toString
if (x < 0) s.replace("-", "-" + zeros(z))
Expand Down Expand Up @@ -3144,7 +3144,7 @@ class JsonReaderSpec extends AnyWordSpec with Matchers with ScalaCheckPropertyCh
"value exceeds limit for number of digits, offset: 0x00000134")
}
"throw number format exception for too big scale" in {
forAll(genWhitespaces) { ws =>
forAll(genWhitespaces, minSuccessful(10)) { ws =>
check(s"1e${bigDecimalScaleLimit - 1}", bigDecimalMathContext, bigDecimalScaleLimit, bigDecimalDigitsLimit, ws)
check(s"1e-${bigDecimalScaleLimit - 1}", bigDecimalMathContext, bigDecimalScaleLimit, bigDecimalDigitsLimit, ws)
check(s"${fill('1', 50)}e${bigDecimalScaleLimit - 17}",
Expand Down

0 comments on commit 16ab14c

Please sign in to comment.