Add additional invariant to check in Range.contains optimization tests.
Change expectations for double and float ranges according to #KT-4481 #KT-5044 #KT-4481 Custom 'rangeTo' might be unoptimized, but still 'in' should not diverge from 'contains'.
This commit is contained in:
@@ -5,7 +5,10 @@
|
||||
|
||||
fun check(x: Int, left: Int, right: Int): Boolean {
|
||||
val result = x in left..right
|
||||
assert(result == checkUnoptimized(x, left..right))
|
||||
val manual = x >= left && x <= right
|
||||
val range = left..right
|
||||
assert(result == manual) { "Failed: optimized === manual for $range" }
|
||||
assert(result == checkUnoptimized(x, range)) { "Failed: optimized === unoptimized for $range" }
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user