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:
@@ -8,28 +8,28 @@ val range1 = 3L until 1L
|
||||
|
||||
val element0 = (-1).toByte()
|
||||
val element1 = (-1).toShort()
|
||||
val element2 = (-1)
|
||||
val element3 = (-1).toLong()
|
||||
val element2 = -1
|
||||
val element3 = -1L
|
||||
val element4 = 0.toByte()
|
||||
val element5 = 0.toShort()
|
||||
val element6 = 0
|
||||
val element7 = 0.toLong()
|
||||
val element7 = 0L
|
||||
val element8 = 1.toByte()
|
||||
val element9 = 1.toShort()
|
||||
val element10 = 1
|
||||
val element11 = 1.toLong()
|
||||
val element11 = 1L
|
||||
val element12 = 2.toByte()
|
||||
val element13 = 2.toShort()
|
||||
val element14 = 2
|
||||
val element15 = 2.toLong()
|
||||
val element15 = 2L
|
||||
val element16 = 3.toByte()
|
||||
val element17 = 3.toShort()
|
||||
val element18 = 3
|
||||
val element19 = 3.toLong()
|
||||
val element19 = 3L
|
||||
val element20 = 4.toByte()
|
||||
val element21 = 4.toShort()
|
||||
val element22 = 4
|
||||
val element23 = 4.toLong()
|
||||
val element23 = 4L
|
||||
|
||||
fun box(): String {
|
||||
testR0xE0()
|
||||
@@ -111,10 +111,10 @@ fun testR0xE1() {
|
||||
|
||||
fun testR0xE2() {
|
||||
// with possible local optimizations
|
||||
if ((-1) in 1L until 3L != range0.contains((-1))) throw AssertionError()
|
||||
if ((-1) !in 1L until 3L != !range0.contains((-1))) throw AssertionError()
|
||||
if (!((-1) in 1L until 3L) != !range0.contains((-1))) throw AssertionError()
|
||||
if (!((-1) !in 1L until 3L) != range0.contains((-1))) throw AssertionError()
|
||||
if (-1 in 1L until 3L != range0.contains(-1)) throw AssertionError()
|
||||
if (-1 !in 1L until 3L != !range0.contains(-1)) throw AssertionError()
|
||||
if (!(-1 in 1L until 3L) != !range0.contains(-1)) throw AssertionError()
|
||||
if (!(-1 !in 1L until 3L) != range0.contains(-1)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element2 in 1L until 3L != range0.contains(element2)) throw AssertionError()
|
||||
if (element2 !in 1L until 3L != !range0.contains(element2)) throw AssertionError()
|
||||
@@ -124,10 +124,10 @@ fun testR0xE2() {
|
||||
|
||||
fun testR0xE3() {
|
||||
// with possible local optimizations
|
||||
if ((-1).toLong() in 1L until 3L != range0.contains((-1).toLong())) throw AssertionError()
|
||||
if ((-1).toLong() !in 1L until 3L != !range0.contains((-1).toLong())) throw AssertionError()
|
||||
if (!((-1).toLong() in 1L until 3L) != !range0.contains((-1).toLong())) throw AssertionError()
|
||||
if (!((-1).toLong() !in 1L until 3L) != range0.contains((-1).toLong())) throw AssertionError()
|
||||
if (-1L in 1L until 3L != range0.contains(-1L)) throw AssertionError()
|
||||
if (-1L !in 1L until 3L != !range0.contains(-1L)) throw AssertionError()
|
||||
if (!(-1L in 1L until 3L) != !range0.contains(-1L)) throw AssertionError()
|
||||
if (!(-1L !in 1L until 3L) != range0.contains(-1L)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element3 in 1L until 3L != range0.contains(element3)) throw AssertionError()
|
||||
if (element3 !in 1L until 3L != !range0.contains(element3)) throw AssertionError()
|
||||
@@ -176,10 +176,10 @@ fun testR0xE6() {
|
||||
|
||||
fun testR0xE7() {
|
||||
// with possible local optimizations
|
||||
if (0.toLong() in 1L until 3L != range0.contains(0.toLong())) throw AssertionError()
|
||||
if (0.toLong() !in 1L until 3L != !range0.contains(0.toLong())) throw AssertionError()
|
||||
if (!(0.toLong() in 1L until 3L) != !range0.contains(0.toLong())) throw AssertionError()
|
||||
if (!(0.toLong() !in 1L until 3L) != range0.contains(0.toLong())) throw AssertionError()
|
||||
if (0L in 1L until 3L != range0.contains(0L)) throw AssertionError()
|
||||
if (0L !in 1L until 3L != !range0.contains(0L)) throw AssertionError()
|
||||
if (!(0L in 1L until 3L) != !range0.contains(0L)) throw AssertionError()
|
||||
if (!(0L !in 1L until 3L) != range0.contains(0L)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element7 in 1L until 3L != range0.contains(element7)) throw AssertionError()
|
||||
if (element7 !in 1L until 3L != !range0.contains(element7)) throw AssertionError()
|
||||
@@ -228,10 +228,10 @@ fun testR0xE10() {
|
||||
|
||||
fun testR0xE11() {
|
||||
// with possible local optimizations
|
||||
if (1.toLong() in 1L until 3L != range0.contains(1.toLong())) throw AssertionError()
|
||||
if (1.toLong() !in 1L until 3L != !range0.contains(1.toLong())) throw AssertionError()
|
||||
if (!(1.toLong() in 1L until 3L) != !range0.contains(1.toLong())) throw AssertionError()
|
||||
if (!(1.toLong() !in 1L until 3L) != range0.contains(1.toLong())) throw AssertionError()
|
||||
if (1L in 1L until 3L != range0.contains(1L)) throw AssertionError()
|
||||
if (1L !in 1L until 3L != !range0.contains(1L)) throw AssertionError()
|
||||
if (!(1L in 1L until 3L) != !range0.contains(1L)) throw AssertionError()
|
||||
if (!(1L !in 1L until 3L) != range0.contains(1L)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element11 in 1L until 3L != range0.contains(element11)) throw AssertionError()
|
||||
if (element11 !in 1L until 3L != !range0.contains(element11)) throw AssertionError()
|
||||
@@ -280,10 +280,10 @@ fun testR0xE14() {
|
||||
|
||||
fun testR0xE15() {
|
||||
// with possible local optimizations
|
||||
if (2.toLong() in 1L until 3L != range0.contains(2.toLong())) throw AssertionError()
|
||||
if (2.toLong() !in 1L until 3L != !range0.contains(2.toLong())) throw AssertionError()
|
||||
if (!(2.toLong() in 1L until 3L) != !range0.contains(2.toLong())) throw AssertionError()
|
||||
if (!(2.toLong() !in 1L until 3L) != range0.contains(2.toLong())) throw AssertionError()
|
||||
if (2L in 1L until 3L != range0.contains(2L)) throw AssertionError()
|
||||
if (2L !in 1L until 3L != !range0.contains(2L)) throw AssertionError()
|
||||
if (!(2L in 1L until 3L) != !range0.contains(2L)) throw AssertionError()
|
||||
if (!(2L !in 1L until 3L) != range0.contains(2L)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element15 in 1L until 3L != range0.contains(element15)) throw AssertionError()
|
||||
if (element15 !in 1L until 3L != !range0.contains(element15)) throw AssertionError()
|
||||
@@ -332,10 +332,10 @@ fun testR0xE18() {
|
||||
|
||||
fun testR0xE19() {
|
||||
// with possible local optimizations
|
||||
if (3.toLong() in 1L until 3L != range0.contains(3.toLong())) throw AssertionError()
|
||||
if (3.toLong() !in 1L until 3L != !range0.contains(3.toLong())) throw AssertionError()
|
||||
if (!(3.toLong() in 1L until 3L) != !range0.contains(3.toLong())) throw AssertionError()
|
||||
if (!(3.toLong() !in 1L until 3L) != range0.contains(3.toLong())) throw AssertionError()
|
||||
if (3L in 1L until 3L != range0.contains(3L)) throw AssertionError()
|
||||
if (3L !in 1L until 3L != !range0.contains(3L)) throw AssertionError()
|
||||
if (!(3L in 1L until 3L) != !range0.contains(3L)) throw AssertionError()
|
||||
if (!(3L !in 1L until 3L) != range0.contains(3L)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element19 in 1L until 3L != range0.contains(element19)) throw AssertionError()
|
||||
if (element19 !in 1L until 3L != !range0.contains(element19)) throw AssertionError()
|
||||
@@ -384,10 +384,10 @@ fun testR0xE22() {
|
||||
|
||||
fun testR0xE23() {
|
||||
// with possible local optimizations
|
||||
if (4.toLong() in 1L until 3L != range0.contains(4.toLong())) throw AssertionError()
|
||||
if (4.toLong() !in 1L until 3L != !range0.contains(4.toLong())) throw AssertionError()
|
||||
if (!(4.toLong() in 1L until 3L) != !range0.contains(4.toLong())) throw AssertionError()
|
||||
if (!(4.toLong() !in 1L until 3L) != range0.contains(4.toLong())) throw AssertionError()
|
||||
if (4L in 1L until 3L != range0.contains(4L)) throw AssertionError()
|
||||
if (4L !in 1L until 3L != !range0.contains(4L)) throw AssertionError()
|
||||
if (!(4L in 1L until 3L) != !range0.contains(4L)) throw AssertionError()
|
||||
if (!(4L !in 1L until 3L) != range0.contains(4L)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element23 in 1L until 3L != range0.contains(element23)) throw AssertionError()
|
||||
if (element23 !in 1L until 3L != !range0.contains(element23)) throw AssertionError()
|
||||
@@ -423,10 +423,10 @@ fun testR1xE1() {
|
||||
|
||||
fun testR1xE2() {
|
||||
// with possible local optimizations
|
||||
if ((-1) in 3L until 1L != range1.contains((-1))) throw AssertionError()
|
||||
if ((-1) !in 3L until 1L != !range1.contains((-1))) throw AssertionError()
|
||||
if (!((-1) in 3L until 1L) != !range1.contains((-1))) throw AssertionError()
|
||||
if (!((-1) !in 3L until 1L) != range1.contains((-1))) throw AssertionError()
|
||||
if (-1 in 3L until 1L != range1.contains(-1)) throw AssertionError()
|
||||
if (-1 !in 3L until 1L != !range1.contains(-1)) throw AssertionError()
|
||||
if (!(-1 in 3L until 1L) != !range1.contains(-1)) throw AssertionError()
|
||||
if (!(-1 !in 3L until 1L) != range1.contains(-1)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element2 in 3L until 1L != range1.contains(element2)) throw AssertionError()
|
||||
if (element2 !in 3L until 1L != !range1.contains(element2)) throw AssertionError()
|
||||
@@ -436,10 +436,10 @@ fun testR1xE2() {
|
||||
|
||||
fun testR1xE3() {
|
||||
// with possible local optimizations
|
||||
if ((-1).toLong() in 3L until 1L != range1.contains((-1).toLong())) throw AssertionError()
|
||||
if ((-1).toLong() !in 3L until 1L != !range1.contains((-1).toLong())) throw AssertionError()
|
||||
if (!((-1).toLong() in 3L until 1L) != !range1.contains((-1).toLong())) throw AssertionError()
|
||||
if (!((-1).toLong() !in 3L until 1L) != range1.contains((-1).toLong())) throw AssertionError()
|
||||
if (-1L in 3L until 1L != range1.contains(-1L)) throw AssertionError()
|
||||
if (-1L !in 3L until 1L != !range1.contains(-1L)) throw AssertionError()
|
||||
if (!(-1L in 3L until 1L) != !range1.contains(-1L)) throw AssertionError()
|
||||
if (!(-1L !in 3L until 1L) != range1.contains(-1L)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element3 in 3L until 1L != range1.contains(element3)) throw AssertionError()
|
||||
if (element3 !in 3L until 1L != !range1.contains(element3)) throw AssertionError()
|
||||
@@ -488,10 +488,10 @@ fun testR1xE6() {
|
||||
|
||||
fun testR1xE7() {
|
||||
// with possible local optimizations
|
||||
if (0.toLong() in 3L until 1L != range1.contains(0.toLong())) throw AssertionError()
|
||||
if (0.toLong() !in 3L until 1L != !range1.contains(0.toLong())) throw AssertionError()
|
||||
if (!(0.toLong() in 3L until 1L) != !range1.contains(0.toLong())) throw AssertionError()
|
||||
if (!(0.toLong() !in 3L until 1L) != range1.contains(0.toLong())) throw AssertionError()
|
||||
if (0L in 3L until 1L != range1.contains(0L)) throw AssertionError()
|
||||
if (0L !in 3L until 1L != !range1.contains(0L)) throw AssertionError()
|
||||
if (!(0L in 3L until 1L) != !range1.contains(0L)) throw AssertionError()
|
||||
if (!(0L !in 3L until 1L) != range1.contains(0L)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element7 in 3L until 1L != range1.contains(element7)) throw AssertionError()
|
||||
if (element7 !in 3L until 1L != !range1.contains(element7)) throw AssertionError()
|
||||
@@ -540,10 +540,10 @@ fun testR1xE10() {
|
||||
|
||||
fun testR1xE11() {
|
||||
// with possible local optimizations
|
||||
if (1.toLong() in 3L until 1L != range1.contains(1.toLong())) throw AssertionError()
|
||||
if (1.toLong() !in 3L until 1L != !range1.contains(1.toLong())) throw AssertionError()
|
||||
if (!(1.toLong() in 3L until 1L) != !range1.contains(1.toLong())) throw AssertionError()
|
||||
if (!(1.toLong() !in 3L until 1L) != range1.contains(1.toLong())) throw AssertionError()
|
||||
if (1L in 3L until 1L != range1.contains(1L)) throw AssertionError()
|
||||
if (1L !in 3L until 1L != !range1.contains(1L)) throw AssertionError()
|
||||
if (!(1L in 3L until 1L) != !range1.contains(1L)) throw AssertionError()
|
||||
if (!(1L !in 3L until 1L) != range1.contains(1L)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element11 in 3L until 1L != range1.contains(element11)) throw AssertionError()
|
||||
if (element11 !in 3L until 1L != !range1.contains(element11)) throw AssertionError()
|
||||
@@ -592,10 +592,10 @@ fun testR1xE14() {
|
||||
|
||||
fun testR1xE15() {
|
||||
// with possible local optimizations
|
||||
if (2.toLong() in 3L until 1L != range1.contains(2.toLong())) throw AssertionError()
|
||||
if (2.toLong() !in 3L until 1L != !range1.contains(2.toLong())) throw AssertionError()
|
||||
if (!(2.toLong() in 3L until 1L) != !range1.contains(2.toLong())) throw AssertionError()
|
||||
if (!(2.toLong() !in 3L until 1L) != range1.contains(2.toLong())) throw AssertionError()
|
||||
if (2L in 3L until 1L != range1.contains(2L)) throw AssertionError()
|
||||
if (2L !in 3L until 1L != !range1.contains(2L)) throw AssertionError()
|
||||
if (!(2L in 3L until 1L) != !range1.contains(2L)) throw AssertionError()
|
||||
if (!(2L !in 3L until 1L) != range1.contains(2L)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element15 in 3L until 1L != range1.contains(element15)) throw AssertionError()
|
||||
if (element15 !in 3L until 1L != !range1.contains(element15)) throw AssertionError()
|
||||
@@ -644,10 +644,10 @@ fun testR1xE18() {
|
||||
|
||||
fun testR1xE19() {
|
||||
// with possible local optimizations
|
||||
if (3.toLong() in 3L until 1L != range1.contains(3.toLong())) throw AssertionError()
|
||||
if (3.toLong() !in 3L until 1L != !range1.contains(3.toLong())) throw AssertionError()
|
||||
if (!(3.toLong() in 3L until 1L) != !range1.contains(3.toLong())) throw AssertionError()
|
||||
if (!(3.toLong() !in 3L until 1L) != range1.contains(3.toLong())) throw AssertionError()
|
||||
if (3L in 3L until 1L != range1.contains(3L)) throw AssertionError()
|
||||
if (3L !in 3L until 1L != !range1.contains(3L)) throw AssertionError()
|
||||
if (!(3L in 3L until 1L) != !range1.contains(3L)) throw AssertionError()
|
||||
if (!(3L !in 3L until 1L) != range1.contains(3L)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element19 in 3L until 1L != range1.contains(element19)) throw AssertionError()
|
||||
if (element19 !in 3L until 1L != !range1.contains(element19)) throw AssertionError()
|
||||
@@ -696,10 +696,10 @@ fun testR1xE22() {
|
||||
|
||||
fun testR1xE23() {
|
||||
// with possible local optimizations
|
||||
if (4.toLong() in 3L until 1L != range1.contains(4.toLong())) throw AssertionError()
|
||||
if (4.toLong() !in 3L until 1L != !range1.contains(4.toLong())) throw AssertionError()
|
||||
if (!(4.toLong() in 3L until 1L) != !range1.contains(4.toLong())) throw AssertionError()
|
||||
if (!(4.toLong() !in 3L until 1L) != range1.contains(4.toLong())) throw AssertionError()
|
||||
if (4L in 3L until 1L != range1.contains(4L)) throw AssertionError()
|
||||
if (4L !in 3L until 1L != !range1.contains(4L)) throw AssertionError()
|
||||
if (!(4L in 3L until 1L) != !range1.contains(4L)) throw AssertionError()
|
||||
if (!(4L !in 3L until 1L) != range1.contains(4L)) throw AssertionError()
|
||||
// no local optimizations
|
||||
if (element23 in 3L until 1L != range1.contains(element23)) throw AssertionError()
|
||||
if (element23 !in 3L until 1L != !range1.contains(element23)) throw AssertionError()
|
||||
|
||||
Reference in New Issue
Block a user