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:
Ilya Gorbunov
2016-11-04 05:01:08 +03:00
parent f5cc53c157
commit d91f3cba0b
5 changed files with 46 additions and 10 deletions
@@ -5,7 +5,10 @@
fun check(x: Long, left: Long, right: Long): 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
}