Add more tests for 'contains' in ranges #KT-52933
- ranges produced by 'rangeUntil' operator - ranges of unsigned values - more elements in ranges produced by `downTo`
This commit is contained in:
@@ -0,0 +1,191 @@
|
||||
// Auto-generated by GenerateInRangeExpressionTestData. Do not edit!
|
||||
// WITH_STDLIB
|
||||
// DONT_TARGET_EXACT_BACKEND: JVM
|
||||
// !LANGUAGE: +RangeUntilOperator
|
||||
@file:OptIn(ExperimentalStdlibApi::class)
|
||||
|
||||
|
||||
|
||||
val range0 = 1.0F..<3.0F
|
||||
val range1 = 3.0F..<1.0F
|
||||
|
||||
val element0 = -1F
|
||||
val element1 = 0F
|
||||
val element2 = 1F
|
||||
val element3 = 2F
|
||||
val element4 = 3F
|
||||
val element5 = 4F
|
||||
|
||||
fun box(): String {
|
||||
testR0xE0()
|
||||
testR0xE1()
|
||||
testR0xE2()
|
||||
testR0xE3()
|
||||
testR0xE4()
|
||||
testR0xE5()
|
||||
testR1xE0()
|
||||
testR1xE1()
|
||||
testR1xE2()
|
||||
testR1xE3()
|
||||
testR1xE4()
|
||||
testR1xE5()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
fun testR0xE0() {
|
||||
// with possible local optimizations
|
||||
if (-1F in 1.0F..<3.0F != range0.contains(-1F)) throw AssertionError()
|
||||
if (-1F !in 1.0F..<3.0F != !range0.contains(-1F)) throw AssertionError()
|
||||
if (!(-1F in 1.0F..<3.0F) != !range0.contains(-1F)) throw AssertionError()
|
||||
if (!(-1F !in 1.0F..<3.0F) != range0.contains(-1F)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element0 in 1.0F..<3.0F != range0.contains(element0)) throw AssertionError()
|
||||
if (element0 !in 1.0F..<3.0F != !range0.contains(element0)) throw AssertionError()
|
||||
if (!(element0 in 1.0F..<3.0F) != !range0.contains(element0)) throw AssertionError()
|
||||
if (!(element0 !in 1.0F..<3.0F) != range0.contains(element0)) throw AssertionError()
|
||||
}
|
||||
|
||||
fun testR0xE1() {
|
||||
// with possible local optimizations
|
||||
if (0F in 1.0F..<3.0F != range0.contains(0F)) throw AssertionError()
|
||||
if (0F !in 1.0F..<3.0F != !range0.contains(0F)) throw AssertionError()
|
||||
if (!(0F in 1.0F..<3.0F) != !range0.contains(0F)) throw AssertionError()
|
||||
if (!(0F !in 1.0F..<3.0F) != range0.contains(0F)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element1 in 1.0F..<3.0F != range0.contains(element1)) throw AssertionError()
|
||||
if (element1 !in 1.0F..<3.0F != !range0.contains(element1)) throw AssertionError()
|
||||
if (!(element1 in 1.0F..<3.0F) != !range0.contains(element1)) throw AssertionError()
|
||||
if (!(element1 !in 1.0F..<3.0F) != range0.contains(element1)) throw AssertionError()
|
||||
}
|
||||
|
||||
fun testR0xE2() {
|
||||
// with possible local optimizations
|
||||
if (1F in 1.0F..<3.0F != range0.contains(1F)) throw AssertionError()
|
||||
if (1F !in 1.0F..<3.0F != !range0.contains(1F)) throw AssertionError()
|
||||
if (!(1F in 1.0F..<3.0F) != !range0.contains(1F)) throw AssertionError()
|
||||
if (!(1F !in 1.0F..<3.0F) != range0.contains(1F)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element2 in 1.0F..<3.0F != range0.contains(element2)) throw AssertionError()
|
||||
if (element2 !in 1.0F..<3.0F != !range0.contains(element2)) throw AssertionError()
|
||||
if (!(element2 in 1.0F..<3.0F) != !range0.contains(element2)) throw AssertionError()
|
||||
if (!(element2 !in 1.0F..<3.0F) != range0.contains(element2)) throw AssertionError()
|
||||
}
|
||||
|
||||
fun testR0xE3() {
|
||||
// with possible local optimizations
|
||||
if (2F in 1.0F..<3.0F != range0.contains(2F)) throw AssertionError()
|
||||
if (2F !in 1.0F..<3.0F != !range0.contains(2F)) throw AssertionError()
|
||||
if (!(2F in 1.0F..<3.0F) != !range0.contains(2F)) throw AssertionError()
|
||||
if (!(2F !in 1.0F..<3.0F) != range0.contains(2F)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element3 in 1.0F..<3.0F != range0.contains(element3)) throw AssertionError()
|
||||
if (element3 !in 1.0F..<3.0F != !range0.contains(element3)) throw AssertionError()
|
||||
if (!(element3 in 1.0F..<3.0F) != !range0.contains(element3)) throw AssertionError()
|
||||
if (!(element3 !in 1.0F..<3.0F) != range0.contains(element3)) throw AssertionError()
|
||||
}
|
||||
|
||||
fun testR0xE4() {
|
||||
// with possible local optimizations
|
||||
if (3F in 1.0F..<3.0F != range0.contains(3F)) throw AssertionError()
|
||||
if (3F !in 1.0F..<3.0F != !range0.contains(3F)) throw AssertionError()
|
||||
if (!(3F in 1.0F..<3.0F) != !range0.contains(3F)) throw AssertionError()
|
||||
if (!(3F !in 1.0F..<3.0F) != range0.contains(3F)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element4 in 1.0F..<3.0F != range0.contains(element4)) throw AssertionError()
|
||||
if (element4 !in 1.0F..<3.0F != !range0.contains(element4)) throw AssertionError()
|
||||
if (!(element4 in 1.0F..<3.0F) != !range0.contains(element4)) throw AssertionError()
|
||||
if (!(element4 !in 1.0F..<3.0F) != range0.contains(element4)) throw AssertionError()
|
||||
}
|
||||
|
||||
fun testR0xE5() {
|
||||
// with possible local optimizations
|
||||
if (4F in 1.0F..<3.0F != range0.contains(4F)) throw AssertionError()
|
||||
if (4F !in 1.0F..<3.0F != !range0.contains(4F)) throw AssertionError()
|
||||
if (!(4F in 1.0F..<3.0F) != !range0.contains(4F)) throw AssertionError()
|
||||
if (!(4F !in 1.0F..<3.0F) != range0.contains(4F)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element5 in 1.0F..<3.0F != range0.contains(element5)) throw AssertionError()
|
||||
if (element5 !in 1.0F..<3.0F != !range0.contains(element5)) throw AssertionError()
|
||||
if (!(element5 in 1.0F..<3.0F) != !range0.contains(element5)) throw AssertionError()
|
||||
if (!(element5 !in 1.0F..<3.0F) != range0.contains(element5)) throw AssertionError()
|
||||
}
|
||||
|
||||
fun testR1xE0() {
|
||||
// with possible local optimizations
|
||||
if (-1F in 3.0F..<1.0F != range1.contains(-1F)) throw AssertionError()
|
||||
if (-1F !in 3.0F..<1.0F != !range1.contains(-1F)) throw AssertionError()
|
||||
if (!(-1F in 3.0F..<1.0F) != !range1.contains(-1F)) throw AssertionError()
|
||||
if (!(-1F !in 3.0F..<1.0F) != range1.contains(-1F)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element0 in 3.0F..<1.0F != range1.contains(element0)) throw AssertionError()
|
||||
if (element0 !in 3.0F..<1.0F != !range1.contains(element0)) throw AssertionError()
|
||||
if (!(element0 in 3.0F..<1.0F) != !range1.contains(element0)) throw AssertionError()
|
||||
if (!(element0 !in 3.0F..<1.0F) != range1.contains(element0)) throw AssertionError()
|
||||
}
|
||||
|
||||
fun testR1xE1() {
|
||||
// with possible local optimizations
|
||||
if (0F in 3.0F..<1.0F != range1.contains(0F)) throw AssertionError()
|
||||
if (0F !in 3.0F..<1.0F != !range1.contains(0F)) throw AssertionError()
|
||||
if (!(0F in 3.0F..<1.0F) != !range1.contains(0F)) throw AssertionError()
|
||||
if (!(0F !in 3.0F..<1.0F) != range1.contains(0F)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element1 in 3.0F..<1.0F != range1.contains(element1)) throw AssertionError()
|
||||
if (element1 !in 3.0F..<1.0F != !range1.contains(element1)) throw AssertionError()
|
||||
if (!(element1 in 3.0F..<1.0F) != !range1.contains(element1)) throw AssertionError()
|
||||
if (!(element1 !in 3.0F..<1.0F) != range1.contains(element1)) throw AssertionError()
|
||||
}
|
||||
|
||||
fun testR1xE2() {
|
||||
// with possible local optimizations
|
||||
if (1F in 3.0F..<1.0F != range1.contains(1F)) throw AssertionError()
|
||||
if (1F !in 3.0F..<1.0F != !range1.contains(1F)) throw AssertionError()
|
||||
if (!(1F in 3.0F..<1.0F) != !range1.contains(1F)) throw AssertionError()
|
||||
if (!(1F !in 3.0F..<1.0F) != range1.contains(1F)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element2 in 3.0F..<1.0F != range1.contains(element2)) throw AssertionError()
|
||||
if (element2 !in 3.0F..<1.0F != !range1.contains(element2)) throw AssertionError()
|
||||
if (!(element2 in 3.0F..<1.0F) != !range1.contains(element2)) throw AssertionError()
|
||||
if (!(element2 !in 3.0F..<1.0F) != range1.contains(element2)) throw AssertionError()
|
||||
}
|
||||
|
||||
fun testR1xE3() {
|
||||
// with possible local optimizations
|
||||
if (2F in 3.0F..<1.0F != range1.contains(2F)) throw AssertionError()
|
||||
if (2F !in 3.0F..<1.0F != !range1.contains(2F)) throw AssertionError()
|
||||
if (!(2F in 3.0F..<1.0F) != !range1.contains(2F)) throw AssertionError()
|
||||
if (!(2F !in 3.0F..<1.0F) != range1.contains(2F)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element3 in 3.0F..<1.0F != range1.contains(element3)) throw AssertionError()
|
||||
if (element3 !in 3.0F..<1.0F != !range1.contains(element3)) throw AssertionError()
|
||||
if (!(element3 in 3.0F..<1.0F) != !range1.contains(element3)) throw AssertionError()
|
||||
if (!(element3 !in 3.0F..<1.0F) != range1.contains(element3)) throw AssertionError()
|
||||
}
|
||||
|
||||
fun testR1xE4() {
|
||||
// with possible local optimizations
|
||||
if (3F in 3.0F..<1.0F != range1.contains(3F)) throw AssertionError()
|
||||
if (3F !in 3.0F..<1.0F != !range1.contains(3F)) throw AssertionError()
|
||||
if (!(3F in 3.0F..<1.0F) != !range1.contains(3F)) throw AssertionError()
|
||||
if (!(3F !in 3.0F..<1.0F) != range1.contains(3F)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element4 in 3.0F..<1.0F != range1.contains(element4)) throw AssertionError()
|
||||
if (element4 !in 3.0F..<1.0F != !range1.contains(element4)) throw AssertionError()
|
||||
if (!(element4 in 3.0F..<1.0F) != !range1.contains(element4)) throw AssertionError()
|
||||
if (!(element4 !in 3.0F..<1.0F) != range1.contains(element4)) throw AssertionError()
|
||||
}
|
||||
|
||||
fun testR1xE5() {
|
||||
// with possible local optimizations
|
||||
if (4F in 3.0F..<1.0F != range1.contains(4F)) throw AssertionError()
|
||||
if (4F !in 3.0F..<1.0F != !range1.contains(4F)) throw AssertionError()
|
||||
if (!(4F in 3.0F..<1.0F) != !range1.contains(4F)) throw AssertionError()
|
||||
if (!(4F !in 3.0F..<1.0F) != range1.contains(4F)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element5 in 3.0F..<1.0F != range1.contains(element5)) throw AssertionError()
|
||||
if (element5 !in 3.0F..<1.0F != !range1.contains(element5)) throw AssertionError()
|
||||
if (!(element5 in 3.0F..<1.0F) != !range1.contains(element5)) throw AssertionError()
|
||||
if (!(element5 !in 3.0F..<1.0F) != range1.contains(element5)) throw AssertionError()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user