Simplify long constants in range iteration tests

This commit is contained in:
Ilya Gorbunov
2018-08-02 23:53:35 +03:00
parent bb1ce52267
commit 1b1713a849
37 changed files with 107 additions and 107 deletions
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = 5.toLong() downTo 10.toLong()
val range4 = 5L downTo 10L
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>()) {
return "Wrong elements for 5.toLong() downTo 10.toLong(): $list4"
return "Wrong elements for 5L downTo 10L: $list4"
}
val list5 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = 10.toLong()..-5.toLong()
val range4 = 10L..-5L
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>()) {
return "Wrong elements for 10.toLong()..-5.toLong(): $list4"
return "Wrong elements for 10L..-5L: $list4"
}
val list5 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = 8.toLong() downTo 3.toLong() step 2.toLong()
val range4 = 8L downTo 3L step 2L
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(8, 6, 4)) {
return "Wrong elements for 8.toLong() downTo 3.toLong() step 2.toLong(): $list4"
return "Wrong elements for 8L downTo 3L step 2L: $list4"
}
val list5 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = 3.toLong()..8.toLong() step 2.toLong()
val range4 = 3L..8L step 2L
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(3, 5, 7)) {
return "Wrong elements for 3.toLong()..8.toLong() step 2.toLong(): $list4"
return "Wrong elements for 3L..8L step 2L: $list4"
}
val list5 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = 5.toLong() downTo 5.toLong()
val range4 = 5L downTo 5L
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(5.toLong())) {
return "Wrong elements for 5.toLong() downTo 5.toLong(): $list4"
if (list4 != listOf<Long>(5L)) {
return "Wrong elements for 5L downTo 5L: $list4"
}
val list5 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = 5.toLong()..5.toLong()
val range4 = 5L..5L
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(5.toLong())) {
return "Wrong elements for 5.toLong()..5.toLong(): $list4"
if (list4 != listOf<Long>(5L)) {
return "Wrong elements for 5L..5L: $list4"
}
val list5 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = 1.toLong() until 5.toLong()
val range4 = 1L until 5L
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(1, 2, 3, 4)) {
return "Wrong elements for 1.toLong() until 5.toLong(): $list4"
return "Wrong elements for 1L until 5L: $list4"
}
val list5 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = (5.toLong() downTo 3.toLong()).reversed()
val range4 = (5L downTo 3L).reversed()
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(3, 4, 5)) {
return "Wrong elements for (5.toLong() downTo 3.toLong()).reversed(): $list4"
return "Wrong elements for (5L downTo 3L).reversed(): $list4"
}
val list5 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = (3.toLong() downTo 5.toLong()).reversed()
val range4 = (3L downTo 5L).reversed()
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>()) {
return "Wrong elements for (3.toLong() downTo 5.toLong()).reversed(): $list4"
return "Wrong elements for (3L downTo 5L).reversed(): $list4"
}
val list5 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = (5.toLong()..3.toLong()).reversed()
val range4 = (5L..3L).reversed()
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>()) {
return "Wrong elements for (5.toLong()..3.toLong()).reversed(): $list4"
return "Wrong elements for (5L..3L).reversed(): $list4"
}
val list5 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = (8.toLong() downTo 3.toLong() step 2.toLong()).reversed()
val range4 = (8L downTo 3L step 2L).reversed()
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(4, 6, 8)) {
return "Wrong elements for (8.toLong() downTo 3.toLong() step 2.toLong()).reversed(): $list4"
return "Wrong elements for (8L downTo 3L step 2L).reversed(): $list4"
}
val list5 = ArrayList<Char>()
@@ -28,13 +28,13 @@ fun box(): String {
}
val list3 = ArrayList<Long>()
val range3 = (3.toLong()..5.toLong()).reversed()
val range3 = (3L..5L).reversed()
for (i in range3) {
list3.add(i)
if (list3.size > 23) break
}
if (list3 != listOf<Long>(5, 4, 3)) {
return "Wrong elements for (3.toLong()..5.toLong()).reversed(): $list3"
return "Wrong elements for (3L..5L).reversed(): $list3"
}
val list4 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = (3.toLong()..9.toLong() step 2.toLong()).reversed()
val range4 = (3L..9L step 2L).reversed()
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(9, 7, 5, 3)) {
return "Wrong elements for (3.toLong()..9.toLong() step 2.toLong()).reversed(): $list4"
return "Wrong elements for (3L..9L step 2L).reversed(): $list4"
}
val list5 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = 9.toLong() downTo 3.toLong()
val range4 = 9L downTo 3L
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(9, 8, 7, 6, 5, 4, 3)) {
return "Wrong elements for 9.toLong() downTo 3.toLong(): $list4"
return "Wrong elements for 9L downTo 3L: $list4"
}
val list5 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = 3.toLong()..9.toLong()
val range4 = 3L..9L
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(3, 4, 5, 6, 7, 8, 9)) {
return "Wrong elements for 3.toLong()..9.toLong(): $list4"
return "Wrong elements for 3L..9L: $list4"
}
val list5 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = (1.toLong() + 2.toLong())..(10.toLong() - 1.toLong())
val range4 = (1L + 2L)..(10L - 1L)
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(3, 4, 5, 6, 7, 8, 9)) {
return "Wrong elements for (1.toLong() + 2.toLong())..(10.toLong() - 1.toLong()): $list4"
return "Wrong elements for (1L + 2L)..(10L - 1L): $list4"
}
val list5 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = 9.toLong() downTo 3.toLong() step 2.toLong()
val range4 = 9L downTo 3L step 2L
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(9, 7, 5, 3)) {
return "Wrong elements for 9.toLong() downTo 3.toLong() step 2.toLong(): $list4"
return "Wrong elements for 9L downTo 3L step 2L: $list4"
}
val list5 = ArrayList<Char>()
@@ -38,13 +38,13 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
val range4 = 3.toLong()..9.toLong() step 2.toLong()
val range4 = 3L..9L step 2L
for (i in range4) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(3, 5, 7, 9)) {
return "Wrong elements for 3.toLong()..9.toLong() step 2.toLong(): $list4"
return "Wrong elements for 3L..9L step 2L: $list4"
}
val list5 = ArrayList<Char>()
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in 5.toLong() downTo 10.toLong()) {
for (i in 5L downTo 10L) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>()) {
return "Wrong elements for 5.toLong() downTo 10.toLong(): $list4"
return "Wrong elements for 5L downTo 10L: $list4"
}
val list5 = ArrayList<Char>()
+2 -2
View File
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in 10.toLong()..-5.toLong()) {
for (i in 10L..-5L) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>()) {
return "Wrong elements for 10.toLong()..-5.toLong(): $list4"
return "Wrong elements for 10L..-5L: $list4"
}
val list5 = ArrayList<Char>()
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in 8.toLong() downTo 3.toLong() step 2.toLong()) {
for (i in 8L downTo 3L step 2L) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(8, 6, 4)) {
return "Wrong elements for 8.toLong() downTo 3.toLong() step 2.toLong(): $list4"
return "Wrong elements for 8L downTo 3L step 2L: $list4"
}
val list5 = ArrayList<Char>()
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in 3.toLong()..8.toLong() step 2.toLong()) {
for (i in 3L..8L step 2L) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(3, 5, 7)) {
return "Wrong elements for 3.toLong()..8.toLong() step 2.toLong(): $list4"
return "Wrong elements for 3L..8L step 2L: $list4"
}
val list5 = ArrayList<Char>()
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in 5.toLong() downTo 5.toLong()) {
for (i in 5L downTo 5L) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(5.toLong())) {
return "Wrong elements for 5.toLong() downTo 5.toLong(): $list4"
if (list4 != listOf<Long>(5L)) {
return "Wrong elements for 5L downTo 5L: $list4"
}
val list5 = ArrayList<Char>()
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in 5.toLong()..5.toLong()) {
for (i in 5L..5L) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(5.toLong())) {
return "Wrong elements for 5.toLong()..5.toLong(): $list4"
if (list4 != listOf<Long>(5L)) {
return "Wrong elements for 5L..5L: $list4"
}
val list5 = ArrayList<Char>()
+2 -2
View File
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in 1.toLong() until 5.toLong()) {
for (i in 1L until 5L) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(1, 2, 3, 4)) {
return "Wrong elements for 1.toLong() until 5.toLong(): $list4"
return "Wrong elements for 1L until 5L: $list4"
}
val list5 = ArrayList<Char>()
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in (5.toLong() downTo 3.toLong()).reversed()) {
for (i in (5L downTo 3L).reversed()) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(3, 4, 5)) {
return "Wrong elements for (5.toLong() downTo 3.toLong()).reversed(): $list4"
return "Wrong elements for (5L downTo 3L).reversed(): $list4"
}
val list5 = ArrayList<Char>()
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in (3.toLong() downTo 5.toLong()).reversed()) {
for (i in (3L downTo 5L).reversed()) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>()) {
return "Wrong elements for (3.toLong() downTo 5.toLong()).reversed(): $list4"
return "Wrong elements for (3L downTo 5L).reversed(): $list4"
}
val list5 = ArrayList<Char>()
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in (5.toLong()..3.toLong()).reversed()) {
for (i in (5L..3L).reversed()) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>()) {
return "Wrong elements for (5.toLong()..3.toLong()).reversed(): $list4"
return "Wrong elements for (5L..3L).reversed(): $list4"
}
val list5 = ArrayList<Char>()
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in (8.toLong() downTo 3.toLong() step 2.toLong()).reversed()) {
for (i in (8L downTo 3L step 2L).reversed()) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(4, 6, 8)) {
return "Wrong elements for (8.toLong() downTo 3.toLong() step 2.toLong()).reversed(): $list4"
return "Wrong elements for (8L downTo 3L step 2L).reversed(): $list4"
}
val list5 = ArrayList<Char>()
@@ -26,12 +26,12 @@ fun box(): String {
}
val list3 = ArrayList<Long>()
for (i in (3.toLong()..5.toLong()).reversed()) {
for (i in (3L..5L).reversed()) {
list3.add(i)
if (list3.size > 23) break
}
if (list3 != listOf<Long>(5, 4, 3)) {
return "Wrong elements for (3.toLong()..5.toLong()).reversed(): $list3"
return "Wrong elements for (3L..5L).reversed(): $list3"
}
val list4 = ArrayList<Char>()
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in (3.toLong()..9.toLong() step 2.toLong()).reversed()) {
for (i in (3L..9L step 2L).reversed()) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(9, 7, 5, 3)) {
return "Wrong elements for (3.toLong()..9.toLong() step 2.toLong()).reversed(): $list4"
return "Wrong elements for (3L..9L step 2L).reversed(): $list4"
}
val list5 = ArrayList<Char>()
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in 9.toLong() downTo 3.toLong()) {
for (i in 9L downTo 3L) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(9, 8, 7, 6, 5, 4, 3)) {
return "Wrong elements for 9.toLong() downTo 3.toLong(): $list4"
return "Wrong elements for 9L downTo 3L: $list4"
}
val list5 = ArrayList<Char>()
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in 3.toLong()..9.toLong()) {
for (i in 3L..9L) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(3, 4, 5, 6, 7, 8, 9)) {
return "Wrong elements for 3.toLong()..9.toLong(): $list4"
return "Wrong elements for 3L..9L: $list4"
}
val list5 = ArrayList<Char>()
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in (1.toLong() + 2.toLong())..(10.toLong() - 1.toLong())) {
for (i in (1L + 2L)..(10L - 1L)) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(3, 4, 5, 6, 7, 8, 9)) {
return "Wrong elements for (1.toLong() + 2.toLong())..(10.toLong() - 1.toLong()): $list4"
return "Wrong elements for (1L + 2L)..(10L - 1L): $list4"
}
val list5 = ArrayList<Char>()
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in 9.toLong() downTo 3.toLong() step 2.toLong()) {
for (i in 9L downTo 3L step 2L) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(9, 7, 5, 3)) {
return "Wrong elements for 9.toLong() downTo 3.toLong() step 2.toLong(): $list4"
return "Wrong elements for 9L downTo 3L step 2L: $list4"
}
val list5 = ArrayList<Char>()
@@ -35,12 +35,12 @@ fun box(): String {
}
val list4 = ArrayList<Long>()
for (i in 3.toLong()..9.toLong() step 2.toLong()) {
for (i in 3L..9L step 2L) {
list4.add(i)
if (list4.size > 23) break
}
if (list4 != listOf<Long>(3, 5, 7, 9)) {
return "Wrong elements for 3.toLong()..9.toLong() step 2.toLong(): $list4"
return "Wrong elements for 3L..9L step 2L: $list4"
}
val list5 = ArrayList<Char>()
@@ -88,7 +88,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
@Test fun emptyConstant() {
doTest(IntRange.EMPTY, 1, 0, 1, listOf())
doTest(LongRange.EMPTY, 1.toLong(), 0.toLong(), 1.toLong(), listOf())
doTest(LongRange.EMPTY, 1L, 0L, 1L, listOf())
doTest(CharRange.EMPTY, 1.toChar(), 0.toChar(), 1, listOf())
@@ -100,7 +100,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(10..5, 10, 5, 1, listOf())
doTest(10.toByte()..(-5).toByte(), 10, (-5), 1, listOf())
doTest(10.toShort()..(-5).toShort(), 10, (-5), 1, listOf())
doTest(10.toLong()..-5.toLong(), 10.toLong(), -5.toLong(), 1.toLong(), listOf())
doTest(10L..-5L, 10L, -5L, 1L, listOf())
doTest('z'..'a', 'z', 'a', 1, listOf())
@@ -114,7 +114,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(5..5, 5, 5, 1, listOf(5))
doTest(5.toByte()..5.toByte(), 5, 5, 1, listOf(5))
doTest(5.toShort()..5.toShort(), 5, 5, 1, listOf(5))
doTest(5.toLong()..5.toLong(), 5.toLong(), 5.toLong(), 1.toLong(), listOf(5.toLong()))
doTest(5L..5L, 5L, 5L, 1L, listOf(5L))
doTest('k'..'k', 'k', 'k', 1, listOf('k'))
@@ -128,7 +128,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(3..9, 3, 9, 1, listOf(3, 4, 5, 6, 7, 8, 9))
doTest(3.toByte()..9.toByte(), 3, 9, 1, listOf(3, 4, 5, 6, 7, 8, 9))
doTest(3.toShort()..9.toShort(), 3, 9, 1, listOf(3, 4, 5, 6, 7, 8, 9))
doTest(3.toLong()..9.toLong(), 3.toLong(), 9.toLong(), 1.toLong(), listOf<Long>(3, 4, 5, 6, 7, 8, 9))
doTest(3L..9L, 3L, 9L, 1L, listOf<Long>(3, 4, 5, 6, 7, 8, 9))
doTest('c'..'g', 'c', 'g', 1, listOf('c', 'd', 'e', 'f', 'g'))
@@ -143,7 +143,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest((1 + 2)..(10 - 1), 3, 9, 1, listOf(3, 4, 5, 6, 7, 8, 9))
doTest((1.toByte() + 2.toByte()).toByte()..(10.toByte() - 1.toByte()).toByte(), 3, 9, 1, listOf(3, 4, 5, 6, 7, 8, 9))
doTest((1.toShort() + 2.toShort()).toShort()..(10.toShort() - 1.toShort()).toShort(), 3, 9, 1, listOf(3, 4, 5, 6, 7, 8, 9))
doTest((1.toLong() + 2.toLong())..(10.toLong() - 1.toLong()), 3.toLong(), 9.toLong(), 1.toLong(), listOf<Long>(3, 4, 5, 6, 7, 8, 9))
doTest((1L + 2L)..(10L - 1L), 3L, 9L, 1L, listOf<Long>(3, 4, 5, 6, 7, 8, 9))
doTest(("ace"[1])..("age"[1]), 'c', 'g', 1, listOf('c', 'd', 'e', 'f', 'g'))
}
@@ -152,7 +152,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(1 until 5, 1, 4, 1, listOf(1, 2, 3, 4))
doTest(1.toByte() until 5.toByte(), 1, 4, 1, listOf(1, 2, 3, 4))
doTest(1.toShort() until 5.toShort(), 1, 4, 1, listOf(1, 2, 3, 4))
doTest(1.toLong() until 5.toLong(), 1L, 4L, 1L, listOf<Long>(1, 2, 3, 4))
doTest(1L until 5L, 1L, 4L, 1L, listOf<Long>(1, 2, 3, 4))
doTest('a' until 'd', 'a', 'c', 1, listOf('a', 'b', 'c'))
// TODO: Unsigned until
@@ -163,7 +163,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(5 downTo 10, 5, 10, -1, listOf())
doTest(5.toByte() downTo 10.toByte(), 5, 10, -1, listOf())
doTest(5.toShort() downTo 10.toShort(), 5, 10, -1, listOf())
doTest(5.toLong() downTo 10.toLong(), 5.toLong(), 10.toLong(), -1.toLong(), listOf())
doTest(5L downTo 10L, 5L, 10L, -1L, listOf())
doTest('a' downTo 'z', 'a', 'z', -1, listOf())
@@ -174,7 +174,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(5 downTo 5, 5, 5, -1, listOf(5))
doTest(5.toByte() downTo 5.toByte(), 5, 5, -1, listOf(5))
doTest(5.toShort() downTo 5.toShort(), 5, 5, -1, listOf(5))
doTest(5.toLong() downTo 5.toLong(), 5.toLong(), 5.toLong(), -1.toLong(), listOf(5.toLong()))
doTest(5L downTo 5L, 5L, 5L, -1L, listOf(5L))
doTest('k' downTo 'k', 'k', 'k', -1, listOf('k'))
// TODO: Unsigned downTo
@@ -184,7 +184,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(9 downTo 3, 9, 3, -1, listOf(9, 8, 7, 6, 5, 4, 3))
doTest(9.toByte() downTo 3.toByte(), 9, 3, -1, listOf(9, 8, 7, 6, 5, 4, 3))
doTest(9.toShort() downTo 3.toShort(), 9, 3, -1, listOf(9, 8, 7, 6, 5, 4, 3))
doTest(9.toLong() downTo 3.toLong(), 9.toLong(), 3.toLong(), -1.toLong(), listOf<Long>(9, 8, 7, 6, 5, 4, 3))
doTest(9L downTo 3L, 9L, 3L, -1L, listOf<Long>(9, 8, 7, 6, 5, 4, 3))
doTest('g' downTo 'c', 'g', 'c', -1, listOf('g', 'f', 'e', 'd', 'c'))
// TODO: Unsigned downTo
@@ -195,7 +195,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(3..9 step 2, 3, 9, 2, listOf(3, 5, 7, 9))
doTest(3.toByte()..9.toByte() step 2, 3, 9, 2, listOf(3, 5, 7, 9))
doTest(3.toShort()..9.toShort() step 2, 3, 9, 2, listOf(3, 5, 7, 9))
doTest(3.toLong()..9.toLong() step 2.toLong(), 3.toLong(), 9.toLong(), 2.toLong(), listOf<Long>(3, 5, 7, 9))
doTest(3L..9L step 2L, 3L, 9L, 2L, listOf<Long>(3, 5, 7, 9))
doTest('c'..'g' step 2, 'c', 'g', 2, listOf('c', 'e', 'g'))
// TODO: Unsigned step
@@ -205,7 +205,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(9 downTo 3 step 2, 9, 3, -2, listOf(9, 7, 5, 3))
doTest(9.toByte() downTo 3.toByte() step 2, 9, 3, -2, listOf(9, 7, 5, 3))
doTest(9.toShort() downTo 3.toShort() step 2, 9, 3, -2, listOf(9, 7, 5, 3))
doTest(9.toLong() downTo 3.toLong() step 2.toLong(), 9.toLong(), 3.toLong(), -2.toLong(), listOf<Long>(9, 7, 5, 3))
doTest(9L downTo 3L step 2L, 9L, 3L, -2L, listOf<Long>(9, 7, 5, 3))
doTest('g' downTo 'c' step 2, 'g', 'c', -2, listOf('g', 'e', 'c'))
// TODO: Unsigned step
@@ -217,7 +217,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(3..8 step 2, 3, 7, 2, listOf(3, 5, 7))
doTest(3.toByte()..8.toByte() step 2, 3, 7, 2, listOf(3, 5, 7))
doTest(3.toShort()..8.toShort() step 2, 3, 7, 2, listOf(3, 5, 7))
doTest(3.toLong()..8.toLong() step 2.toLong(), 3.toLong(), 7.toLong(), 2.toLong(), listOf<Long>(3, 5, 7))
doTest(3L..8L step 2L, 3L, 7L, 2L, listOf<Long>(3, 5, 7))
doTest('a'..'d' step 2, 'a', 'c', 2, listOf('a', 'c'))
// TODO: Unsigned step
@@ -228,7 +228,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(8 downTo 3 step 2, 8, 4, -2, listOf(8, 6, 4))
doTest(8.toByte() downTo 3.toByte() step 2, 8, 4, -2, listOf(8, 6, 4))
doTest(8.toShort() downTo 3.toShort() step 2, 8, 4, -2, listOf(8, 6, 4))
doTest(8.toLong() downTo 3.toLong() step 2.toLong(), 8.toLong(), 4.toLong(), -2.toLong(), listOf<Long>(8, 6, 4))
doTest(8L downTo 3L step 2L, 8L, 4L, -2L, listOf<Long>(8, 6, 4))
doTest('d' downTo 'a' step 2, 'd', 'b', -2, listOf('d', 'b'))
// TODO: Unsigned step
@@ -239,7 +239,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest((5..3).reversed(), 3, 5, -1, listOf())
doTest((5.toByte()..3.toByte()).reversed(), 3, 5, -1, listOf())
doTest((5.toShort()..3.toShort()).reversed(), 3, 5, -1, listOf())
doTest((5.toLong()..3.toLong()).reversed(), 3.toLong(), 5.toLong(), -1.toLong(), listOf())
doTest((5L..3L).reversed(), 3L, 5L, -1L, listOf())
doTest(('c'..'a').reversed(), 'a', 'c', -1, listOf())
// TODO: Unsigned reversed
@@ -249,7 +249,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest((3 downTo 5).reversed(), 5, 3, 1, listOf())
doTest((3.toByte() downTo 5.toByte()).reversed(), 5, 3, 1, listOf())
doTest((3.toShort() downTo 5.toShort()).reversed(), 5, 3, 1, listOf())
doTest((3.toLong() downTo 5.toLong()).reversed(), 5.toLong(), 3.toLong(), 1.toLong(), listOf())
doTest((3L downTo 5L).reversed(), 5L, 3L, 1L, listOf())
doTest(('a' downTo 'c').reversed(), 'c', 'a', 1, listOf())
// TODO: Unsigned reversed
@@ -259,7 +259,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest((3..5).reversed(), 5, 3, -1, listOf(5, 4, 3))
doTest((3.toByte()..5.toByte()).reversed(),5, 3, -1, listOf(5, 4, 3))
doTest((3.toShort()..5.toShort()).reversed(), 5, 3, -1, listOf(5, 4, 3))
doTest((3.toLong()..5.toLong()).reversed(), 5.toLong(), 3.toLong(), -1.toLong(), listOf<Long>(5, 4, 3))
doTest((3L..5L).reversed(), 5L, 3L, -1L, listOf<Long>(5, 4, 3))
doTest(('a'..'c').reversed(), 'c', 'a', -1, listOf('c', 'b', 'a'))
// TODO: Unsigned reversed
@@ -269,7 +269,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest((5 downTo 3).reversed(), 3, 5, 1, listOf(3, 4, 5))
doTest((5.toByte() downTo 3.toByte()).reversed(), 3, 5, 1, listOf(3, 4, 5))
doTest((5.toShort() downTo 3.toShort()).reversed(), 3, 5, 1, listOf(3, 4, 5))
doTest((5.toLong() downTo 3.toLong()).reversed(), 3.toLong(), 5.toLong(), 1.toLong(), listOf<Long>(3, 4, 5))
doTest((5L downTo 3L).reversed(), 3L, 5L, 1L, listOf<Long>(3, 4, 5))
doTest(('c' downTo 'a').reversed(), 'a', 'c', 1, listOf('a', 'b', 'c'))
// TODO: Unsigned reversed
@@ -279,7 +279,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest((3..9 step 2).reversed(), 9, 3, -2, listOf(9, 7, 5, 3))
doTest((3.toByte()..9.toByte() step 2).reversed(), 9, 3, -2, listOf(9, 7, 5, 3))
doTest((3.toShort()..9.toShort() step 2).reversed(), 9, 3, -2, listOf(9, 7, 5, 3))
doTest((3.toLong()..9.toLong() step 2.toLong()).reversed(), 9.toLong(), 3.toLong(), -2.toLong(), listOf<Long>(9, 7, 5, 3))
doTest((3L..9L step 2L).reversed(), 9L, 3L, -2L, listOf<Long>(9, 7, 5, 3))
doTest(('c'..'g' step 2).reversed(), 'g', 'c', -2, listOf('g', 'e', 'c'))
// TODO: Unsigned reversed
@@ -291,7 +291,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest((8 downTo 3 step 2).reversed(), 4, 8, 2, listOf(4, 6, 8))
doTest((8.toByte() downTo 3.toByte() step 2).reversed(), 4, 8, 2, listOf(4, 6, 8))
doTest((8.toShort() downTo 3.toShort() step 2).reversed(), 4, 8, 2, listOf(4, 6, 8))
doTest((8.toLong() downTo 3.toLong() step 2.toLong()).reversed(), 4.toLong(), 8.toLong(), 2.toLong(), listOf<Long>(4, 6, 8))
doTest((8L downTo 3L step 2L).reversed(), 4L, 8L, 2L, listOf<Long>(4, 6, 8))
doTest(('d' downTo 'a' step 2).reversed(), 'b', 'd', 2, listOf('b', 'd'))
// TODO: Unsigned reversed
@@ -302,7 +302,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(MaxI..MaxI, MaxI, MaxI, 1, listOf(MaxI))
doTest(MaxB..MaxB, MaxB.toInt(), MaxB.toInt(), 1, listOf(MaxB.toInt()))
doTest(MaxS..MaxS, MaxS.toInt(), MaxS.toInt(), 1, listOf(MaxS.toInt()))
doTest(MaxL..MaxL, MaxL, MaxL, 1.toLong(), listOf(MaxL))
doTest(MaxL..MaxL, MaxL, MaxL, 1L, listOf(MaxL))
doTest(MaxC..MaxC, MaxC, MaxC, 1, listOf(MaxC))
@@ -314,7 +314,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest((MaxI - 2)..MaxI, MaxI - 2, MaxI, 1, listOf(MaxI - 2, MaxI - 1, MaxI))
doTest((MaxB - 2).toByte()..MaxB, (MaxB - 2).toInt(), MaxB.toInt(), 1, listOf((MaxB - 2).toInt(), (MaxB - 1).toInt(), MaxB.toInt()))
doTest((MaxS - 2).toShort()..MaxS, (MaxS - 2).toInt(), MaxS.toInt(), 1, listOf((MaxS - 2).toInt(), (MaxS - 1).toInt(), MaxS.toInt()))
doTest((MaxL - 2).toLong()..MaxL, (MaxL - 2).toLong(), MaxL, 1.toLong(), listOf((MaxL - 2).toLong(), (MaxL - 1).toLong(), MaxL))
doTest((MaxL - 2).toLong()..MaxL, (MaxL - 2).toLong(), MaxL, 1L, listOf((MaxL - 2).toLong(), (MaxL - 1).toLong(), MaxL))
doTest((MaxC - 2)..MaxC, (MaxC - 2), MaxC, 1, listOf((MaxC - 2), (MaxC - 1), MaxC))
@@ -326,7 +326,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(MaxI..MinI, MaxI, MinI, 1, listOf())
doTest(MaxB..MinB, MaxB.toInt(), MinB.toInt(), 1, listOf())
doTest(MaxS..MinS, MaxS.toInt(), MinS.toInt(), 1, listOf())
doTest(MaxL..MinL, MaxL, MinL, 1.toLong(), listOf())
doTest(MaxL..MinL, MaxL, MinL, 1L, listOf())
doTest(MaxC..MinC, MaxC, MinC, 1, listOf())
@@ -338,7 +338,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(MaxI..MaxI step 1, MaxI, MaxI, 1, listOf(MaxI))
doTest(MaxB..MaxB step 1, MaxB.toInt(), MaxB.toInt(), 1, listOf(MaxB.toInt()))
doTest(MaxS..MaxS step 1, MaxS.toInt(), MaxS.toInt(), 1, listOf(MaxS.toInt()))
doTest(MaxL..MaxL step 1, MaxL, MaxL, 1.toLong(), listOf(MaxL))
doTest(MaxL..MaxL step 1, MaxL, MaxL, 1L, listOf(MaxL))
doTest(MaxC..MaxC step 1, MaxC, MaxC, 1, listOf(MaxC))
// TODO: Unsigned step
@@ -348,7 +348,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest((MaxI - 2)..MaxI step 2, MaxI - 2, MaxI, 2, listOf(MaxI - 2, MaxI))
doTest((MaxB - 2).toByte()..MaxB step 2, (MaxB - 2).toInt(), MaxB.toInt(), 2, listOf((MaxB - 2).toInt(), MaxB.toInt()))
doTest((MaxS - 2).toShort()..MaxS step 2, (MaxS - 2).toInt(), MaxS.toInt(), 2, listOf((MaxS - 2).toInt(), MaxS.toInt()))
doTest((MaxL - 2).toLong()..MaxL step 2, (MaxL - 2).toLong(), MaxL, 2.toLong(), listOf((MaxL - 2).toLong(), MaxL))
doTest((MaxL - 2).toLong()..MaxL step 2, (MaxL - 2).toLong(), MaxL, 2L, listOf((MaxL - 2).toLong(), MaxL))
doTest((MaxC - 2)..MaxC step 2, (MaxC - 2), MaxC, 2, listOf((MaxC - 2), MaxC))
// TODO: Unsigned step
@@ -358,7 +358,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(MaxI..MinI step 1, MaxI, MinI, 1, listOf())
doTest(MaxB..MinB step 1, MaxB.toInt(), MinB.toInt(), 1, listOf())
doTest(MaxS..MinS step 1, MaxS.toInt(), MinS.toInt(), 1, listOf())
doTest(MaxL..MinL step 1, MaxL, MinL, 1.toLong(), listOf())
doTest(MaxL..MinL step 1, MaxL, MinL, 1L, listOf())
doTest(MaxC..MinC step 1, MaxC, MinC, 1, listOf())
// TODO: Unsigned step
@@ -368,7 +368,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest(MinI..MinI step 1, MinI, MinI, 1, listOf(MinI))
doTest(MinB..MinB step 1, MinB.toInt(), MinB.toInt(), 1, listOf(MinB.toInt()))
doTest(MinS..MinS step 1, MinS.toInt(), MinS.toInt(), 1, listOf(MinS.toInt()))
doTest(MinL..MinL step 1, MinL, MinL, 1.toLong(), listOf(MinL))
doTest(MinL..MinL step 1, MinL, MinL, 1L, listOf(MinL))
doTest(MinC..MinC step 1, MinC, MinC, 1, listOf(MinC))
// TODO: Unsigned step
@@ -378,7 +378,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest((MaxI - 5)..MaxI step 3, MaxI - 5, MaxI - 2, 3, listOf(MaxI - 5, MaxI - 2))
doTest((MaxB - 5).toByte()..MaxB step 3, (MaxB - 5).toInt(), (MaxB - 2).toInt(), 3, listOf((MaxB - 5).toInt(), (MaxB - 2).toInt()))
doTest((MaxS - 5).toShort()..MaxS step 3, (MaxS - 5).toInt(), (MaxS - 2).toInt(), 3, listOf((MaxS - 5).toInt(), (MaxS - 2).toInt()))
doTest((MaxL - 5).toLong()..MaxL step 3, (MaxL - 5).toLong(), (MaxL - 2).toLong(), 3.toLong(), listOf((MaxL - 5).toLong(), (MaxL - 2).toLong()))
doTest((MaxL - 5).toLong()..MaxL step 3, (MaxL - 5).toLong(), (MaxL - 2).toLong(), 3L, listOf((MaxL - 5).toLong(), (MaxL - 2).toLong()))
doTest((MaxC - 5)..MaxC step 3, (MaxC - 5), (MaxC - 2), 3, listOf((MaxC - 5), (MaxC - 2)))
// TODO: Unsigned step
@@ -386,7 +386,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
@Test fun overflowZeroToMinValue() {
doTest(0..MinI step 3, 0, MinI, 3, listOf())
doTest(0L..MinL step 3, 0, MinL, 3.toLong(), listOf())
doTest(0L..MinL step 3, 0, MinL, 3L, listOf())
// TODO: Unsigned step
}
@@ -394,7 +394,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest((MinI + 2) downTo MinI step 1, MinI + 2, MinI, -1, listOf(MinI + 2, MinI + 1, MinI))
doTest((MinB + 2).toByte() downTo MinB step 1, (MinB + 2).toInt(), MinB.toInt(), -1, listOf((MinB + 2).toInt(), (MinB + 1).toInt(), MinB.toInt()))
doTest((MinS + 2).toShort() downTo MinS step 1, (MinS + 2).toInt(), MinS.toInt(), -1, listOf((MinS + 2).toInt(), (MinS + 1).toInt(), MinS.toInt()))
doTest((MinL + 2).toLong() downTo MinL step 1, (MinL + 2).toLong(), MinL, -1.toLong(), listOf((MinL + 2).toLong(), (MinL + 1).toLong(), MinL))
doTest((MinL + 2).toLong() downTo MinL step 1, (MinL + 2).toLong(), MinL, -1L, listOf((MinL + 2).toLong(), (MinL + 1).toLong(), MinL))
doTest((MinC + 2) downTo MinC step 1, (MinC + 2), MinC, -1, listOf((MinC + 2), (MinC + 1), MinC))
// TODO: Unsigned step
@@ -404,7 +404,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
doTest((MinI + 5) downTo MinI step 3, MinI + 5, MinI + 2, -3, listOf(MinI + 5, MinI + 2))
doTest((MinB + 5).toByte() downTo MinB step 3, (MinB + 5).toInt(), (MinB + 2).toInt(), -3, listOf((MinB + 5).toInt(), (MinB + 2).toInt()))
doTest((MinS + 5).toShort() downTo MinS step 3, (MinS + 5).toInt(), (MinS + 2).toInt(), -3, listOf((MinS + 5).toInt(), (MinS + 2).toInt()))
doTest((MinL + 5).toLong() downTo MinL step 3, (MinL + 5).toLong(), (MinL + 2).toLong(), -3.toLong(), listOf((MinL + 5).toLong(), (MinL + 2).toLong()))
doTest((MinL + 5).toLong() downTo MinL step 3, (MinL + 5).toLong(), (MinL + 2).toLong(), -3L, listOf((MinL + 5).toLong(), (MinL + 2).toLong()))
doTest((MinC + 5) downTo MinC step 3, (MinC + 5), (MinC + 2), -3, listOf((MinC + 5), (MinC + 2)))
// TODO: Unsigned step
@@ -412,7 +412,7 @@ public class RangeIterationTest : RangeIterationTestBase() {
@Test fun overflowZeroDownToMaxValue() {
doTest(0 downTo MaxI step 3, 0, MaxI, -3, listOf())
doTest(0 downTo MaxL step 3, 0, MaxL, -3.toLong(), listOf())
doTest(0 downTo MaxL step 3, 0, MaxL, -3L, listOf())
// TODO: Unsigned step
}
}