[BE test] Extract and mute cases which don't work on JS from eqNullableDoubles.kt and eqNullableDoubles.kt

This commit is contained in:
Zalim Bashorov
2020-01-21 21:14:56 +03:00
parent 79fa3c2c30
commit f92376fbbd
10 changed files with 118 additions and 27 deletions
@@ -1,7 +1,5 @@
// !LANGUAGE: +ProperIeee754Comparisons
// IGNORE_BACKEND: JS
// IGNORE_BACKEND_FIR: JVM_IR
// ^ if (eq_double_any(0.0, 0)) throw AssertionError("eq_double_any(0.0, 0)")
fun eq_double_doubleN(a: Double, b: Double?) = a == b
@@ -22,10 +20,8 @@ fun box(): String {
if (eq_double_doubleN(0.0, null)) throw AssertionError("eq_double_doubleN(0.0, null)")
if (!eq_double_any(0.0, 0.0)) throw AssertionError("!eq_double_any(0.0, 0.0)")
if (eq_double_any(0.0, -0.0)) throw AssertionError("eq_double_any(0.0, -0.0)")
if (eq_double_any(0.0, 0)) throw AssertionError("eq_double_any(0.0, 0)")
if (!eq_double_anyN(0.0, 0.0)) throw AssertionError("!eq_double_anyN(0.0, 0.0)")
if (eq_double_anyN(0.0, -0.0)) throw AssertionError("eq_double_anyN(0.0, -0.0)")
if (eq_double_anyN(0.0, 0)) throw AssertionError("eq_double_anyN(0.0, 0)")
if (eq_double_anyN(0.0, null)) throw AssertionError("eq_double_anyN(0.0, null)")
if (eq_doubleN_double(null, 0.0)) throw AssertionError("eq_doubleN_double(null, 0.0)")
@@ -33,10 +29,8 @@ fun box(): String {
if (eq_doubleN_doubleN(0.0, null)) throw AssertionError("eq_doubleN_doubleN(0.0, null)")
if (!eq_doubleN_any(0.0, 0.0)) throw AssertionError("!eq_doubleN_any(0.0, 0.0)")
if (eq_doubleN_any(0.0, -0.0)) throw AssertionError("eq_doubleN_any(0.0, -0.0)")
if (eq_doubleN_any(0.0, 0)) throw AssertionError("eq_doubleN_any(0.0, 0)")
if (!eq_doubleN_anyN(0.0, 0.0)) throw AssertionError("!eq_doubleN_anyN(0.0, 0.0)")
if (eq_doubleN_anyN(0.0, -0.0)) throw AssertionError("eq_doubleN_anyN(0.0, -0.0)")
if (eq_doubleN_anyN(0.0, 0)) throw AssertionError("eq_doubleN_anyN(0.0, 0)")
if (eq_doubleN_anyN(0.0, null)) throw AssertionError("eq_doubleN_anyN(0.0, null)")
return "OK"
@@ -0,0 +1,21 @@
// !LANGUAGE: +ProperIeee754Comparisons
// It doesn't work on JS due to how numbers are represented, but it could be changed in the future.
// IGNORE_BACKEND: JS
// IGNORE_BACKEND: JS_IR
fun eq_double_any(a: Double, b: Any) = a == b
fun eq_double_anyN(a: Double, b: Any?) = a == b
fun eq_doubleN_any(a: Double?, b: Any) = a == b
fun eq_doubleN_anyN(a: Double?, b: Any?) = a == b
fun box(): String {
if (eq_double_any(0.0, 0)) throw AssertionError("eq_double_any(0.0, 0)")
if (eq_double_anyN(0.0, 0)) throw AssertionError("eq_double_anyN(0.0, 0)")
if (eq_doubleN_any(0.0, 0)) throw AssertionError("eq_doubleN_any(0.0, 0)")
if (eq_doubleN_anyN(0.0, 0)) throw AssertionError("eq_doubleN_anyN(0.0, 0)")
return "OK"
}
@@ -0,0 +1,22 @@
// !LANGUAGE: +ProperIeee754Comparisons
// It doesn't work on JS due to how numbers are represented, but it could be changed in the future.
// IGNORE_BACKEND: JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND_FIR: JVM_IR
fun <A: Double, B: Any> eq_double_any(a: A, b: B) = a == b
fun <A: Double, B: Any?> eq_double_anyN(a: A, b: B) = a == b
fun <A: Double?, B: Any> eq_doubleN_any(a: A, b: B) = a == b
fun <A: Double?, B: Any?> eq_doubleN_anyN(a: A, b: B) = a == b
fun box(): String {
if (eq_double_any(0.0, 0)) throw AssertionError("eq_double_any(0.0, 0)")
if (eq_double_anyN(0.0, 0)) throw AssertionError("eq_double_anyN(0.0, 0)")
if (eq_doubleN_any(0.0, 0)) throw AssertionError("eq_doubleN_any(0.0, 0)")
if (eq_doubleN_anyN(0.0, 0)) throw AssertionError("eq_doubleN_anyN(0.0, 0)")
return "OK"
}
@@ -1,7 +1,5 @@
// !LANGUAGE: +ProperIeee754Comparisons
// IGNORE_BACKEND: JS
// IGNORE_BACKEND_FIR: JVM_IR
// ^ if (eq_double_any(0.0, 0)) throw AssertionError("eq_double_any(0.0, 0)")
fun <A: Double, B: Double?> eq_double_doubleN(a: A, b: B) = a == b
@@ -22,10 +20,8 @@ fun box(): String {
if (eq_double_doubleN(0.0, null)) throw AssertionError("eq_double_doubleN(0.0, null)")
if (!eq_double_any(0.0, 0.0)) throw AssertionError("!eq_double_any(0.0, 0.0)")
if (eq_double_any(0.0, -0.0)) throw AssertionError("eq_double_any(0.0, -0.0)")
if (eq_double_any(0.0, 0)) throw AssertionError("eq_double_any(0.0, 0)")
if (!eq_double_anyN(0.0, 0.0)) throw AssertionError("!eq_double_anyN(0.0, 0.0)")
if (eq_double_anyN(0.0, -0.0)) throw AssertionError("eq_double_anyN(0.0, -0.0)")
if (eq_double_anyN(0.0, 0)) throw AssertionError("eq_double_anyN(0.0, 0)")
if (eq_double_anyN(0.0, null)) throw AssertionError("eq_double_anyN(0.0, null)")
if (eq_doubleN_double(null, 0.0)) throw AssertionError("eq_doubleN_double(null, 0.0)")
@@ -33,10 +29,8 @@ fun box(): String {
if (eq_doubleN_doubleN(0.0, null)) throw AssertionError("eq_doubleN_doubleN(0.0, null)")
if (!eq_doubleN_any(0.0, 0.0)) throw AssertionError("!eq_doubleN_any(0.0, 0.0)")
if (eq_doubleN_any(0.0, -0.0)) throw AssertionError("eq_doubleN_any(0.0, -0.0)")
if (eq_doubleN_any(0.0, 0)) throw AssertionError("eq_doubleN_any(0.0, 0)")
if (!eq_doubleN_anyN(0.0, 0.0)) throw AssertionError("!eq_doubleN_anyN(0.0, 0.0)")
if (eq_doubleN_anyN(0.0, -0.0)) throw AssertionError("eq_doubleN_anyN(0.0, -0.0)")
if (eq_doubleN_anyN(0.0, 0)) throw AssertionError("eq_doubleN_anyN(0.0, 0)")
if (eq_doubleN_anyN(0.0, null)) throw AssertionError("eq_doubleN_anyN(0.0, null)")
return "OK"