Add failing tests for overflow in empty progressions KT-24204
This commit is contained in:
+47
@@ -0,0 +1,47 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS_IR or not
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// TODO: muted automatically, investigate should it be ran for NATIVE or not
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
|
||||
// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT!
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
import java.lang.Integer.MAX_VALUE as MaxI
|
||||
import java.lang.Integer.MIN_VALUE as MinI
|
||||
import java.lang.Byte.MAX_VALUE as MaxB
|
||||
import java.lang.Byte.MIN_VALUE as MinB
|
||||
import java.lang.Short.MAX_VALUE as MaxS
|
||||
import java.lang.Short.MIN_VALUE as MinS
|
||||
import java.lang.Long.MAX_VALUE as MaxL
|
||||
import java.lang.Long.MIN_VALUE as MinL
|
||||
import java.lang.Character.MAX_VALUE as MaxC
|
||||
import java.lang.Character.MIN_VALUE as MinC
|
||||
|
||||
fun box(): String {
|
||||
val list1 = ArrayList<Int>()
|
||||
val range1 = 0 downTo MaxI step 3
|
||||
for (i in range1) {
|
||||
list1.add(i)
|
||||
if (list1.size > 23) break
|
||||
}
|
||||
if (list1 != listOf<Int>()) {
|
||||
return "Wrong elements for 0 downTo MaxI step 3: $list1"
|
||||
}
|
||||
|
||||
val list2 = ArrayList<Long>()
|
||||
val range2 = 0 downTo MaxL step 3
|
||||
for (i in range2) {
|
||||
list2.add(i)
|
||||
if (list2.size > 23) break
|
||||
}
|
||||
if (list2 != listOf<Long>()) {
|
||||
return "Wrong elements for 0 downTo MaxL step 3: $list2"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS_IR or not
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// TODO: muted automatically, investigate should it be ran for NATIVE or not
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
|
||||
// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT!
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
import java.lang.Integer.MAX_VALUE as MaxI
|
||||
import java.lang.Integer.MIN_VALUE as MinI
|
||||
import java.lang.Byte.MAX_VALUE as MaxB
|
||||
import java.lang.Byte.MIN_VALUE as MinB
|
||||
import java.lang.Short.MAX_VALUE as MaxS
|
||||
import java.lang.Short.MIN_VALUE as MinS
|
||||
import java.lang.Long.MAX_VALUE as MaxL
|
||||
import java.lang.Long.MIN_VALUE as MinL
|
||||
import java.lang.Character.MAX_VALUE as MaxC
|
||||
import java.lang.Character.MIN_VALUE as MinC
|
||||
|
||||
fun box(): String {
|
||||
val list1 = ArrayList<Int>()
|
||||
val range1 = 0..MinI step 3
|
||||
for (i in range1) {
|
||||
list1.add(i)
|
||||
if (list1.size > 23) break
|
||||
}
|
||||
if (list1 != listOf<Int>()) {
|
||||
return "Wrong elements for 0..MinI step 3: $list1"
|
||||
}
|
||||
|
||||
val list2 = ArrayList<Long>()
|
||||
val range2 = 0L..MinL step 3
|
||||
for (i in range2) {
|
||||
list2.add(i)
|
||||
if (list2.size > 23) break
|
||||
}
|
||||
if (list2 != listOf<Long>()) {
|
||||
return "Wrong elements for 0L..MinL step 3: $list2"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS_IR or not
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// TODO: muted automatically, investigate should it be ran for NATIVE or not
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
|
||||
// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT!
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
import java.lang.Integer.MAX_VALUE as MaxI
|
||||
import java.lang.Integer.MIN_VALUE as MinI
|
||||
import java.lang.Byte.MAX_VALUE as MaxB
|
||||
import java.lang.Byte.MIN_VALUE as MinB
|
||||
import java.lang.Short.MAX_VALUE as MaxS
|
||||
import java.lang.Short.MIN_VALUE as MinS
|
||||
import java.lang.Long.MAX_VALUE as MaxL
|
||||
import java.lang.Long.MIN_VALUE as MinL
|
||||
import java.lang.Character.MAX_VALUE as MaxC
|
||||
import java.lang.Character.MIN_VALUE as MinC
|
||||
|
||||
fun box(): String {
|
||||
val list1 = ArrayList<Int>()
|
||||
for (i in 0 downTo MaxI step 3) {
|
||||
list1.add(i)
|
||||
if (list1.size > 23) break
|
||||
}
|
||||
if (list1 != listOf<Int>()) {
|
||||
return "Wrong elements for 0 downTo MaxI step 3: $list1"
|
||||
}
|
||||
|
||||
val list2 = ArrayList<Long>()
|
||||
for (i in 0 downTo MaxL step 3) {
|
||||
list2.add(i)
|
||||
if (list2.size > 23) break
|
||||
}
|
||||
if (list2 != listOf<Long>()) {
|
||||
return "Wrong elements for 0 downTo MaxL step 3: $list2"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS_IR or not
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// TODO: muted automatically, investigate should it be ran for NATIVE or not
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
|
||||
// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT!
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
import java.lang.Integer.MAX_VALUE as MaxI
|
||||
import java.lang.Integer.MIN_VALUE as MinI
|
||||
import java.lang.Byte.MAX_VALUE as MaxB
|
||||
import java.lang.Byte.MIN_VALUE as MinB
|
||||
import java.lang.Short.MAX_VALUE as MaxS
|
||||
import java.lang.Short.MIN_VALUE as MinS
|
||||
import java.lang.Long.MAX_VALUE as MaxL
|
||||
import java.lang.Long.MIN_VALUE as MinL
|
||||
import java.lang.Character.MAX_VALUE as MaxC
|
||||
import java.lang.Character.MIN_VALUE as MinC
|
||||
|
||||
fun box(): String {
|
||||
val list1 = ArrayList<Int>()
|
||||
for (i in 0..MinI step 3) {
|
||||
list1.add(i)
|
||||
if (list1.size > 23) break
|
||||
}
|
||||
if (list1 != listOf<Int>()) {
|
||||
return "Wrong elements for 0..MinI step 3: $list1"
|
||||
}
|
||||
|
||||
val list2 = ArrayList<Long>()
|
||||
for (i in 0L..MinL step 3) {
|
||||
list2.add(i)
|
||||
if (list2.size > 23) break
|
||||
}
|
||||
if (list2 != listOf<Long>()) {
|
||||
return "Wrong elements for 0L..MinL step 3: $list2"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Generated
+20
@@ -15820,6 +15820,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/openRange.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroDownToMaxValue.kt")
|
||||
public void testOverflowZeroDownToMaxValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/overflowZeroDownToMaxValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroToMinValue.kt")
|
||||
public void testOverflowZeroToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/overflowZeroToMinValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("progressionDownToMinValue.kt")
|
||||
public void testProgressionDownToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/progressionDownToMinValue.kt");
|
||||
@@ -16351,6 +16361,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/openRange.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroDownToMaxValue.kt")
|
||||
public void testOverflowZeroDownToMaxValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/overflowZeroDownToMaxValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroToMinValue.kt")
|
||||
public void testOverflowZeroToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/overflowZeroToMinValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("progressionDownToMinValue.kt")
|
||||
public void testProgressionDownToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/progressionDownToMinValue.kt");
|
||||
|
||||
+20
@@ -15820,6 +15820,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/openRange.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroDownToMaxValue.kt")
|
||||
public void testOverflowZeroDownToMaxValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/overflowZeroDownToMaxValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroToMinValue.kt")
|
||||
public void testOverflowZeroToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/overflowZeroToMinValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("progressionDownToMinValue.kt")
|
||||
public void testProgressionDownToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/progressionDownToMinValue.kt");
|
||||
@@ -16351,6 +16361,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/openRange.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroDownToMaxValue.kt")
|
||||
public void testOverflowZeroDownToMaxValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/overflowZeroDownToMaxValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroToMinValue.kt")
|
||||
public void testOverflowZeroToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/overflowZeroToMinValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("progressionDownToMinValue.kt")
|
||||
public void testProgressionDownToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/progressionDownToMinValue.kt");
|
||||
|
||||
+20
@@ -15820,6 +15820,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/openRange.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroDownToMaxValue.kt")
|
||||
public void testOverflowZeroDownToMaxValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/overflowZeroDownToMaxValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroToMinValue.kt")
|
||||
public void testOverflowZeroToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/overflowZeroToMinValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("progressionDownToMinValue.kt")
|
||||
public void testProgressionDownToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/progressionDownToMinValue.kt");
|
||||
@@ -16351,6 +16361,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/openRange.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroDownToMaxValue.kt")
|
||||
public void testOverflowZeroDownToMaxValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/overflowZeroDownToMaxValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroToMinValue.kt")
|
||||
public void testOverflowZeroToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/overflowZeroToMinValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("progressionDownToMinValue.kt")
|
||||
public void testProgressionDownToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/progressionDownToMinValue.kt");
|
||||
|
||||
+8
-2
@@ -106,6 +106,7 @@ public class GenerateRangesCodegenTestData {
|
||||
|
||||
private static final List<String> INTEGER_PRIMITIVES = Arrays.asList("Integer", "Byte", "Short", "Long", "Character");
|
||||
|
||||
// TODO: Use common MIN_VALUE/MAX_VALUE constants and remove these exclusions
|
||||
private static final List<String> IGNORED_FOR_JS_BACKEND = Arrays.asList(
|
||||
"inexactDownToMinValue.kt",
|
||||
"inexactToMaxValue.kt",
|
||||
@@ -116,7 +117,10 @@ public class GenerateRangesCodegenTestData {
|
||||
"progressionMaxValueMinusTwoToMaxValue.kt",
|
||||
"progressionMaxValueToMaxValue.kt",
|
||||
"progressionMaxValueToMinValue.kt",
|
||||
"progressionMinValueToMinValue.kt");
|
||||
"progressionMinValueToMinValue.kt",
|
||||
"overflowZeroToMinValue.kt",
|
||||
"overflowZeroDownToMaxValue.kt"
|
||||
);
|
||||
|
||||
private static final List<String> IGNORED_FOR_NATIVE_BACKEND = Arrays.asList(
|
||||
"inexactDownToMinValue.kt",
|
||||
@@ -128,7 +132,9 @@ public class GenerateRangesCodegenTestData {
|
||||
"progressionMaxValueMinusTwoToMaxValue.kt",
|
||||
"progressionMaxValueToMaxValue.kt",
|
||||
"progressionMaxValueToMinValue.kt",
|
||||
"progressionMinValueToMinValue.kt"
|
||||
"progressionMinValueToMinValue.kt",
|
||||
"overflowZeroToMinValue.kt",
|
||||
"overflowZeroDownToMaxValue.kt"
|
||||
);
|
||||
|
||||
private static void writeIgnoreBackendDirective(PrintWriter out, String backendName) {
|
||||
|
||||
+20
@@ -14110,6 +14110,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/openRange.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroDownToMaxValue.kt")
|
||||
public void testOverflowZeroDownToMaxValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/overflowZeroDownToMaxValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroToMinValue.kt")
|
||||
public void testOverflowZeroToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/overflowZeroToMinValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("progressionDownToMinValue.kt")
|
||||
public void testProgressionDownToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/progressionDownToMinValue.kt");
|
||||
@@ -14641,6 +14651,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/openRange.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroDownToMaxValue.kt")
|
||||
public void testOverflowZeroDownToMaxValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/overflowZeroDownToMaxValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroToMinValue.kt")
|
||||
public void testOverflowZeroToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/overflowZeroToMinValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("progressionDownToMinValue.kt")
|
||||
public void testProgressionDownToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/progressionDownToMinValue.kt");
|
||||
|
||||
+20
@@ -14110,6 +14110,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/openRange.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroDownToMaxValue.kt")
|
||||
public void testOverflowZeroDownToMaxValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/overflowZeroDownToMaxValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroToMinValue.kt")
|
||||
public void testOverflowZeroToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/overflowZeroToMinValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("progressionDownToMinValue.kt")
|
||||
public void testProgressionDownToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/expression/progressionDownToMinValue.kt");
|
||||
@@ -14641,6 +14651,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/openRange.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroDownToMaxValue.kt")
|
||||
public void testOverflowZeroDownToMaxValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/overflowZeroDownToMaxValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overflowZeroToMinValue.kt")
|
||||
public void testOverflowZeroToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/overflowZeroToMinValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("progressionDownToMinValue.kt")
|
||||
public void testProgressionDownToMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/literal/progressionDownToMinValue.kt");
|
||||
|
||||
@@ -93,6 +93,11 @@ public class RangeIterationJVMTest : RangeIterationTestBase() {
|
||||
doTest((MaxC - 5)..MaxC step 3, (MaxC - 5), (MaxC - 2), 3, listOf((MaxC - 5), (MaxC - 2)))
|
||||
}
|
||||
|
||||
@Test fun overflowZeroToMinValue() {
|
||||
doTest(0..MinI step 3, 0, MinI, 3, listOf())
|
||||
doTest(0L..MinL step 3, 0, MinL, 3.toLong(), listOf())
|
||||
}
|
||||
|
||||
@Test fun progressionDownToMinValue() {
|
||||
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()))
|
||||
@@ -110,4 +115,9 @@ public class RangeIterationJVMTest : RangeIterationTestBase() {
|
||||
|
||||
doTest((MinC + 5) downTo MinC step 3, (MinC + 5), (MinC + 2), -3, listOf((MinC + 5), (MinC + 2)))
|
||||
}
|
||||
|
||||
@Test fun overflowZeroDownToMaxValue() {
|
||||
doTest(0 downTo MaxI step 3, 0, MaxI, -3, listOf())
|
||||
doTest(0 downTo MaxL step 3, 0, MaxL, -3.toLong(), listOf())
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,7 @@ class ProgressionLastElementTest {
|
||||
doTest(MIN + 1, MAX, MAX, MAX)
|
||||
doTest(MAX - 7, MAX, 3, MAX - 1)
|
||||
doTest(MAX - 7, MAX, MAX, MAX - 7)
|
||||
doTest(0, MAX, -3, MAX)
|
||||
|
||||
// end == MIN
|
||||
doTest(0, MIN, MIN, MIN)
|
||||
@@ -61,6 +62,7 @@ class ProgressionLastElementTest {
|
||||
doTest(MAX, MIN, MIN, -1)
|
||||
doTest(MIN + 7, MIN, -3, MIN + 1)
|
||||
doTest(MIN + 7, MIN, MIN, MIN + 7)
|
||||
doTest(0, MIN, 3, MIN)
|
||||
}
|
||||
|
||||
@Test fun iterateToFinalElement() {
|
||||
|
||||
Reference in New Issue
Block a user