reversed() behavior changed for progressions. Stepped progression behavior changes: 'end' property is now deprecated, use 'last' instead.
This commit is contained in:
+5
-25
@@ -8,7 +8,7 @@ fun box(): String {
|
||||
list1.add(i)
|
||||
if (list1.size() > 23) break
|
||||
}
|
||||
if (list1 != listOf<Int>(3, 5, 7)) {
|
||||
if (list1 != listOf<Int>(4, 6, 8)) {
|
||||
return "Wrong elements for (8 downTo 3 step 2).reversed(): $list1"
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ fun box(): String {
|
||||
list2.add(i)
|
||||
if (list2.size() > 23) break
|
||||
}
|
||||
if (list2 != listOf<Int>(3, 5, 7)) {
|
||||
if (list2 != listOf<Int>(4, 6, 8)) {
|
||||
return "Wrong elements for (8.toByte() downTo 3.toByte() step 2).reversed(): $list2"
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ fun box(): String {
|
||||
list3.add(i)
|
||||
if (list3.size() > 23) break
|
||||
}
|
||||
if (list3 != listOf<Int>(3, 5, 7)) {
|
||||
if (list3 != listOf<Int>(4, 6, 8)) {
|
||||
return "Wrong elements for (8.toShort() downTo 3.toShort() step 2).reversed(): $list3"
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ fun box(): String {
|
||||
list4.add(i)
|
||||
if (list4.size() > 23) break
|
||||
}
|
||||
if (list4 != listOf<Long>(3, 5, 7)) {
|
||||
if (list4 != listOf<Long>(4, 6, 8)) {
|
||||
return "Wrong elements for (8.toLong() downTo 3.toLong() step 2.toLong()).reversed(): $list4"
|
||||
}
|
||||
|
||||
@@ -48,29 +48,9 @@ fun box(): String {
|
||||
list5.add(i)
|
||||
if (list5.size() > 23) break
|
||||
}
|
||||
if (list5 != listOf<Char>('a', 'c')) {
|
||||
if (list5 != listOf<Char>('b', 'd')) {
|
||||
return "Wrong elements for ('d' downTo 'a' step 2).reversed(): $list5"
|
||||
}
|
||||
|
||||
val list6 = ArrayList<Double>()
|
||||
val range6 = (5.8 downTo 4.0 step 0.5).reversed()
|
||||
for (i in range6) {
|
||||
list6.add(i)
|
||||
if (list6.size() > 23) break
|
||||
}
|
||||
if (list6 != listOf<Double>(4.0, 4.5, 5.0, 5.5)) {
|
||||
return "Wrong elements for (5.8 downTo 4.0 step 0.5).reversed(): $list6"
|
||||
}
|
||||
|
||||
val list7 = ArrayList<Float>()
|
||||
val range7 = (5.8.toFloat() downTo 4.0.toFloat() step 0.5.toFloat()).reversed()
|
||||
for (i in range7) {
|
||||
list7.add(i)
|
||||
if (list7.size() > 23) break
|
||||
}
|
||||
if (list7 != listOf<Float>(4.0.toFloat(), 4.5.toFloat(), 5.0.toFloat(), 5.5.toFloat())) {
|
||||
return "Wrong elements for (5.8.toFloat() downTo 4.0.toFloat() step 0.5.toFloat()).reversed(): $list7"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user