Generate openRange tests for compiler.
#KT-4665
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT!
|
||||
import java.util.ArrayList
|
||||
import java.lang as j
|
||||
|
||||
fun box(): String {
|
||||
val list1 = ArrayList<Int>()
|
||||
val range1 = 1 until 5
|
||||
for (i in range1) {
|
||||
list1.add(i)
|
||||
if (list1.size() > 23) break
|
||||
}
|
||||
if (list1 != listOf<Int>(1, 2, 3, 4)) {
|
||||
return "Wrong elements for 1 until 5: $list1"
|
||||
}
|
||||
|
||||
val list2 = ArrayList<Byte>()
|
||||
val range2 = 1.toByte() until 5.toByte()
|
||||
for (i in range2) {
|
||||
list2.add(i)
|
||||
if (list2.size() > 23) break
|
||||
}
|
||||
if (list2 != listOf<Byte>(1, 2, 3, 4)) {
|
||||
return "Wrong elements for 1.toByte() until 5.toByte(): $list2"
|
||||
}
|
||||
|
||||
val list3 = ArrayList<Short>()
|
||||
val range3 = 1.toShort() until 5.toShort()
|
||||
for (i in range3) {
|
||||
list3.add(i)
|
||||
if (list3.size() > 23) break
|
||||
}
|
||||
if (list3 != listOf<Short>(1, 2, 3, 4)) {
|
||||
return "Wrong elements for 1.toShort() until 5.toShort(): $list3"
|
||||
}
|
||||
|
||||
val list4 = ArrayList<Long>()
|
||||
val range4 = 1.toLong() until 5.toLong()
|
||||
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"
|
||||
}
|
||||
|
||||
val list5 = ArrayList<Char>()
|
||||
val range5 = 'a' until 'd'
|
||||
for (i in range5) {
|
||||
list5.add(i)
|
||||
if (list5.size() > 23) break
|
||||
}
|
||||
if (list5 != listOf<Char>('a', 'b', 'c')) {
|
||||
return "Wrong elements for 'a' until 'd': $list5"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT!
|
||||
import java.util.ArrayList
|
||||
import java.lang as j
|
||||
|
||||
fun box(): String {
|
||||
val list1 = ArrayList<Int>()
|
||||
for (i in 1 until 5) {
|
||||
list1.add(i)
|
||||
if (list1.size() > 23) break
|
||||
}
|
||||
if (list1 != listOf<Int>(1, 2, 3, 4)) {
|
||||
return "Wrong elements for 1 until 5: $list1"
|
||||
}
|
||||
|
||||
val list2 = ArrayList<Byte>()
|
||||
for (i in 1.toByte() until 5.toByte()) {
|
||||
list2.add(i)
|
||||
if (list2.size() > 23) break
|
||||
}
|
||||
if (list2 != listOf<Byte>(1, 2, 3, 4)) {
|
||||
return "Wrong elements for 1.toByte() until 5.toByte(): $list2"
|
||||
}
|
||||
|
||||
val list3 = ArrayList<Short>()
|
||||
for (i in 1.toShort() until 5.toShort()) {
|
||||
list3.add(i)
|
||||
if (list3.size() > 23) break
|
||||
}
|
||||
if (list3 != listOf<Short>(1, 2, 3, 4)) {
|
||||
return "Wrong elements for 1.toShort() until 5.toShort(): $list3"
|
||||
}
|
||||
|
||||
val list4 = ArrayList<Long>()
|
||||
for (i in 1.toLong() until 5.toLong()) {
|
||||
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"
|
||||
}
|
||||
|
||||
val list5 = ArrayList<Char>()
|
||||
for (i in 'a' until 'd') {
|
||||
list5.add(i)
|
||||
if (list5.size() > 23) break
|
||||
}
|
||||
if (list5 != listOf<Char>('a', 'b', 'c')) {
|
||||
return "Wrong elements for 'a' until 'd': $list5"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+12
@@ -2466,6 +2466,12 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("openRange.kt")
|
||||
public void testOpenRange() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/ranges/expression/openRange.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("progressionDownToMinValue.kt")
|
||||
public void testProgressionDownToMinValue() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/ranges/expression/progressionDownToMinValue.kt");
|
||||
@@ -2649,6 +2655,12 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("openRange.kt")
|
||||
public void testOpenRange() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/ranges/literal/openRange.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("progressionDownToMinValue.kt")
|
||||
public void testProgressionDownToMinValue() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/ranges/literal/progressionDownToMinValue.kt");
|
||||
|
||||
@@ -89,7 +89,7 @@ public class RangeIterationTest {
|
||||
doTest(1 until 5, 1, 4, 1, listOf(1, 2, 3, 4))
|
||||
doTest(1.toByte() until 5.toByte(), 1.toByte(), 4.toByte(), 1, listOf<Byte>(1, 2, 3, 4))
|
||||
doTest(1.toShort() until 5.toShort(), 1.toShort(), 4.toShort(), 1, listOf<Short>(1, 2, 3, 4))
|
||||
doTest(1L until 5L, 1L, 4L, 1L, listOf<Long>(1, 2, 3, 4))
|
||||
doTest(1.toLong() until 5.toLong(), 1L, 4L, 1L, listOf<Long>(1, 2, 3, 4))
|
||||
doTest('a' until 'd', 'a', 'c', 1, listOf('a', 'b', 'c'))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user