Generate test data for in-expression tests, fix bug with indices

This commit is contained in:
Dmitry Petrov
2017-07-12 11:56:03 +03:00
parent 890c6a9983
commit 6a673a03e4
25 changed files with 11651 additions and 128 deletions
@@ -31,7 +31,7 @@ class ArrayIndicesRangeValue(rangeCall: ResolvedCall<out CallableDescriptor>): P
private val expectedReceiverType: KotlinType = ExpressionCodegen.getExpectedReceiverType(rangeCall)
override fun getBoundedValue(codegen: ExpressionCodegen) =
object : AbstractBoundedValue(codegen, rangeCall) {
object : AbstractBoundedValue(codegen, rangeCall, isHighInclusive = false) {
override fun putHighLow(v: InstructionAdapter, type: Type) {
codegen.generateCallReceiver(rangeCall).put(codegen.asmType(expectedReceiverType), v)
v.arraylength()
@@ -31,7 +31,7 @@ class CharSequenceIndicesRangeValue(rangeCall: ResolvedCall<out CallableDescript
private val expectedReceiverType: KotlinType = ExpressionCodegen.getExpectedReceiverType(rangeCall)
override fun getBoundedValue(codegen: ExpressionCodegen) =
object : AbstractBoundedValue(codegen, rangeCall) {
object : AbstractBoundedValue(codegen, rangeCall, isHighInclusive = false) {
override fun putHighLow(v: InstructionAdapter, type: Type) {
codegen.generateCallReceiver(rangeCall).put(codegen.asmType(expectedReceiverType), v)
v.invokeinterface("java/lang/CharSequence", "length", "()I")
@@ -31,7 +31,7 @@ class CollectionIndicesRangeValue(rangeCall: ResolvedCall<out CallableDescriptor
private val expectedReceiverType: KotlinType = ExpressionCodegen.getExpectedReceiverType(rangeCall)
override fun getBoundedValue(codegen: ExpressionCodegen) =
object : AbstractBoundedValue(codegen, rangeCall) {
object : AbstractBoundedValue(codegen, rangeCall, isHighInclusive = false) {
override fun putHighLow(v: InstructionAdapter, type: Type) {
codegen.generateCallReceiver(rangeCall).put(codegen.asmType(expectedReceiverType), v)
v.invokeinterface("java/util/Collection", "size", "()I")
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,159 @@
// Auto-generated by GenerateInRangeExpressionTestData. Do not edit!
// WITH_RUNTIME
val range0 = '3' downTo '1'
val range1 = '1' downTo '3'
val element0 = '0'
val element1 = '1'
val element2 = '2'
val element3 = '3'
val element4 = '4'
fun box(): String {
testR0xE0()
testR0xE1()
testR0xE2()
testR0xE3()
testR0xE4()
testR1xE0()
testR1xE1()
testR1xE2()
testR1xE3()
testR1xE4()
return "OK"
}
fun testR0xE0() {
// with possible local optimizations
if ('0' in '3' downTo '1' != range0.contains('0')) throw AssertionError()
if ('0' !in '3' downTo '1' != !range0.contains('0')) throw AssertionError()
if (!('0' in '3' downTo '1') != !range0.contains('0')) throw AssertionError()
if (!('0' !in '3' downTo '1') != range0.contains('0')) throw AssertionError()
// no local optimizations
if (element0 in '3' downTo '1' != range0.contains(element0)) throw AssertionError()
if (element0 !in '3' downTo '1' != !range0.contains(element0)) throw AssertionError()
if (!(element0 in '3' downTo '1') != !range0.contains(element0)) throw AssertionError()
if (!(element0 !in '3' downTo '1') != range0.contains(element0)) throw AssertionError()
}
fun testR0xE1() {
// with possible local optimizations
if ('1' in '3' downTo '1' != range0.contains('1')) throw AssertionError()
if ('1' !in '3' downTo '1' != !range0.contains('1')) throw AssertionError()
if (!('1' in '3' downTo '1') != !range0.contains('1')) throw AssertionError()
if (!('1' !in '3' downTo '1') != range0.contains('1')) throw AssertionError()
// no local optimizations
if (element1 in '3' downTo '1' != range0.contains(element1)) throw AssertionError()
if (element1 !in '3' downTo '1' != !range0.contains(element1)) throw AssertionError()
if (!(element1 in '3' downTo '1') != !range0.contains(element1)) throw AssertionError()
if (!(element1 !in '3' downTo '1') != range0.contains(element1)) throw AssertionError()
}
fun testR0xE2() {
// with possible local optimizations
if ('2' in '3' downTo '1' != range0.contains('2')) throw AssertionError()
if ('2' !in '3' downTo '1' != !range0.contains('2')) throw AssertionError()
if (!('2' in '3' downTo '1') != !range0.contains('2')) throw AssertionError()
if (!('2' !in '3' downTo '1') != range0.contains('2')) throw AssertionError()
// no local optimizations
if (element2 in '3' downTo '1' != range0.contains(element2)) throw AssertionError()
if (element2 !in '3' downTo '1' != !range0.contains(element2)) throw AssertionError()
if (!(element2 in '3' downTo '1') != !range0.contains(element2)) throw AssertionError()
if (!(element2 !in '3' downTo '1') != range0.contains(element2)) throw AssertionError()
}
fun testR0xE3() {
// with possible local optimizations
if ('3' in '3' downTo '1' != range0.contains('3')) throw AssertionError()
if ('3' !in '3' downTo '1' != !range0.contains('3')) throw AssertionError()
if (!('3' in '3' downTo '1') != !range0.contains('3')) throw AssertionError()
if (!('3' !in '3' downTo '1') != range0.contains('3')) throw AssertionError()
// no local optimizations
if (element3 in '3' downTo '1' != range0.contains(element3)) throw AssertionError()
if (element3 !in '3' downTo '1' != !range0.contains(element3)) throw AssertionError()
if (!(element3 in '3' downTo '1') != !range0.contains(element3)) throw AssertionError()
if (!(element3 !in '3' downTo '1') != range0.contains(element3)) throw AssertionError()
}
fun testR0xE4() {
// with possible local optimizations
if ('4' in '3' downTo '1' != range0.contains('4')) throw AssertionError()
if ('4' !in '3' downTo '1' != !range0.contains('4')) throw AssertionError()
if (!('4' in '3' downTo '1') != !range0.contains('4')) throw AssertionError()
if (!('4' !in '3' downTo '1') != range0.contains('4')) throw AssertionError()
// no local optimizations
if (element4 in '3' downTo '1' != range0.contains(element4)) throw AssertionError()
if (element4 !in '3' downTo '1' != !range0.contains(element4)) throw AssertionError()
if (!(element4 in '3' downTo '1') != !range0.contains(element4)) throw AssertionError()
if (!(element4 !in '3' downTo '1') != range0.contains(element4)) throw AssertionError()
}
fun testR1xE0() {
// with possible local optimizations
if ('0' in '1' downTo '3' != range1.contains('0')) throw AssertionError()
if ('0' !in '1' downTo '3' != !range1.contains('0')) throw AssertionError()
if (!('0' in '1' downTo '3') != !range1.contains('0')) throw AssertionError()
if (!('0' !in '1' downTo '3') != range1.contains('0')) throw AssertionError()
// no local optimizations
if (element0 in '1' downTo '3' != range1.contains(element0)) throw AssertionError()
if (element0 !in '1' downTo '3' != !range1.contains(element0)) throw AssertionError()
if (!(element0 in '1' downTo '3') != !range1.contains(element0)) throw AssertionError()
if (!(element0 !in '1' downTo '3') != range1.contains(element0)) throw AssertionError()
}
fun testR1xE1() {
// with possible local optimizations
if ('1' in '1' downTo '3' != range1.contains('1')) throw AssertionError()
if ('1' !in '1' downTo '3' != !range1.contains('1')) throw AssertionError()
if (!('1' in '1' downTo '3') != !range1.contains('1')) throw AssertionError()
if (!('1' !in '1' downTo '3') != range1.contains('1')) throw AssertionError()
// no local optimizations
if (element1 in '1' downTo '3' != range1.contains(element1)) throw AssertionError()
if (element1 !in '1' downTo '3' != !range1.contains(element1)) throw AssertionError()
if (!(element1 in '1' downTo '3') != !range1.contains(element1)) throw AssertionError()
if (!(element1 !in '1' downTo '3') != range1.contains(element1)) throw AssertionError()
}
fun testR1xE2() {
// with possible local optimizations
if ('2' in '1' downTo '3' != range1.contains('2')) throw AssertionError()
if ('2' !in '1' downTo '3' != !range1.contains('2')) throw AssertionError()
if (!('2' in '1' downTo '3') != !range1.contains('2')) throw AssertionError()
if (!('2' !in '1' downTo '3') != range1.contains('2')) throw AssertionError()
// no local optimizations
if (element2 in '1' downTo '3' != range1.contains(element2)) throw AssertionError()
if (element2 !in '1' downTo '3' != !range1.contains(element2)) throw AssertionError()
if (!(element2 in '1' downTo '3') != !range1.contains(element2)) throw AssertionError()
if (!(element2 !in '1' downTo '3') != range1.contains(element2)) throw AssertionError()
}
fun testR1xE3() {
// with possible local optimizations
if ('3' in '1' downTo '3' != range1.contains('3')) throw AssertionError()
if ('3' !in '1' downTo '3' != !range1.contains('3')) throw AssertionError()
if (!('3' in '1' downTo '3') != !range1.contains('3')) throw AssertionError()
if (!('3' !in '1' downTo '3') != range1.contains('3')) throw AssertionError()
// no local optimizations
if (element3 in '1' downTo '3' != range1.contains(element3)) throw AssertionError()
if (element3 !in '1' downTo '3' != !range1.contains(element3)) throw AssertionError()
if (!(element3 in '1' downTo '3') != !range1.contains(element3)) throw AssertionError()
if (!(element3 !in '1' downTo '3') != range1.contains(element3)) throw AssertionError()
}
fun testR1xE4() {
// with possible local optimizations
if ('4' in '1' downTo '3' != range1.contains('4')) throw AssertionError()
if ('4' !in '1' downTo '3' != !range1.contains('4')) throw AssertionError()
if (!('4' in '1' downTo '3') != !range1.contains('4')) throw AssertionError()
if (!('4' !in '1' downTo '3') != range1.contains('4')) throw AssertionError()
// no local optimizations
if (element4 in '1' downTo '3' != range1.contains(element4)) throw AssertionError()
if (element4 !in '1' downTo '3' != !range1.contains(element4)) throw AssertionError()
if (!(element4 in '1' downTo '3') != !range1.contains(element4)) throw AssertionError()
if (!(element4 !in '1' downTo '3') != range1.contains(element4)) throw AssertionError()
}
@@ -0,0 +1,159 @@
// Auto-generated by GenerateInRangeExpressionTestData. Do not edit!
// WITH_RUNTIME
val range0 = '1' .. '3'
val range1 = '3' .. '1'
val element0 = '0'
val element1 = '1'
val element2 = '2'
val element3 = '3'
val element4 = '4'
fun box(): String {
testR0xE0()
testR0xE1()
testR0xE2()
testR0xE3()
testR0xE4()
testR1xE0()
testR1xE1()
testR1xE2()
testR1xE3()
testR1xE4()
return "OK"
}
fun testR0xE0() {
// with possible local optimizations
if ('0' in '1' .. '3' != range0.contains('0')) throw AssertionError()
if ('0' !in '1' .. '3' != !range0.contains('0')) throw AssertionError()
if (!('0' in '1' .. '3') != !range0.contains('0')) throw AssertionError()
if (!('0' !in '1' .. '3') != range0.contains('0')) throw AssertionError()
// no local optimizations
if (element0 in '1' .. '3' != range0.contains(element0)) throw AssertionError()
if (element0 !in '1' .. '3' != !range0.contains(element0)) throw AssertionError()
if (!(element0 in '1' .. '3') != !range0.contains(element0)) throw AssertionError()
if (!(element0 !in '1' .. '3') != range0.contains(element0)) throw AssertionError()
}
fun testR0xE1() {
// with possible local optimizations
if ('1' in '1' .. '3' != range0.contains('1')) throw AssertionError()
if ('1' !in '1' .. '3' != !range0.contains('1')) throw AssertionError()
if (!('1' in '1' .. '3') != !range0.contains('1')) throw AssertionError()
if (!('1' !in '1' .. '3') != range0.contains('1')) throw AssertionError()
// no local optimizations
if (element1 in '1' .. '3' != range0.contains(element1)) throw AssertionError()
if (element1 !in '1' .. '3' != !range0.contains(element1)) throw AssertionError()
if (!(element1 in '1' .. '3') != !range0.contains(element1)) throw AssertionError()
if (!(element1 !in '1' .. '3') != range0.contains(element1)) throw AssertionError()
}
fun testR0xE2() {
// with possible local optimizations
if ('2' in '1' .. '3' != range0.contains('2')) throw AssertionError()
if ('2' !in '1' .. '3' != !range0.contains('2')) throw AssertionError()
if (!('2' in '1' .. '3') != !range0.contains('2')) throw AssertionError()
if (!('2' !in '1' .. '3') != range0.contains('2')) throw AssertionError()
// no local optimizations
if (element2 in '1' .. '3' != range0.contains(element2)) throw AssertionError()
if (element2 !in '1' .. '3' != !range0.contains(element2)) throw AssertionError()
if (!(element2 in '1' .. '3') != !range0.contains(element2)) throw AssertionError()
if (!(element2 !in '1' .. '3') != range0.contains(element2)) throw AssertionError()
}
fun testR0xE3() {
// with possible local optimizations
if ('3' in '1' .. '3' != range0.contains('3')) throw AssertionError()
if ('3' !in '1' .. '3' != !range0.contains('3')) throw AssertionError()
if (!('3' in '1' .. '3') != !range0.contains('3')) throw AssertionError()
if (!('3' !in '1' .. '3') != range0.contains('3')) throw AssertionError()
// no local optimizations
if (element3 in '1' .. '3' != range0.contains(element3)) throw AssertionError()
if (element3 !in '1' .. '3' != !range0.contains(element3)) throw AssertionError()
if (!(element3 in '1' .. '3') != !range0.contains(element3)) throw AssertionError()
if (!(element3 !in '1' .. '3') != range0.contains(element3)) throw AssertionError()
}
fun testR0xE4() {
// with possible local optimizations
if ('4' in '1' .. '3' != range0.contains('4')) throw AssertionError()
if ('4' !in '1' .. '3' != !range0.contains('4')) throw AssertionError()
if (!('4' in '1' .. '3') != !range0.contains('4')) throw AssertionError()
if (!('4' !in '1' .. '3') != range0.contains('4')) throw AssertionError()
// no local optimizations
if (element4 in '1' .. '3' != range0.contains(element4)) throw AssertionError()
if (element4 !in '1' .. '3' != !range0.contains(element4)) throw AssertionError()
if (!(element4 in '1' .. '3') != !range0.contains(element4)) throw AssertionError()
if (!(element4 !in '1' .. '3') != range0.contains(element4)) throw AssertionError()
}
fun testR1xE0() {
// with possible local optimizations
if ('0' in '3' .. '1' != range1.contains('0')) throw AssertionError()
if ('0' !in '3' .. '1' != !range1.contains('0')) throw AssertionError()
if (!('0' in '3' .. '1') != !range1.contains('0')) throw AssertionError()
if (!('0' !in '3' .. '1') != range1.contains('0')) throw AssertionError()
// no local optimizations
if (element0 in '3' .. '1' != range1.contains(element0)) throw AssertionError()
if (element0 !in '3' .. '1' != !range1.contains(element0)) throw AssertionError()
if (!(element0 in '3' .. '1') != !range1.contains(element0)) throw AssertionError()
if (!(element0 !in '3' .. '1') != range1.contains(element0)) throw AssertionError()
}
fun testR1xE1() {
// with possible local optimizations
if ('1' in '3' .. '1' != range1.contains('1')) throw AssertionError()
if ('1' !in '3' .. '1' != !range1.contains('1')) throw AssertionError()
if (!('1' in '3' .. '1') != !range1.contains('1')) throw AssertionError()
if (!('1' !in '3' .. '1') != range1.contains('1')) throw AssertionError()
// no local optimizations
if (element1 in '3' .. '1' != range1.contains(element1)) throw AssertionError()
if (element1 !in '3' .. '1' != !range1.contains(element1)) throw AssertionError()
if (!(element1 in '3' .. '1') != !range1.contains(element1)) throw AssertionError()
if (!(element1 !in '3' .. '1') != range1.contains(element1)) throw AssertionError()
}
fun testR1xE2() {
// with possible local optimizations
if ('2' in '3' .. '1' != range1.contains('2')) throw AssertionError()
if ('2' !in '3' .. '1' != !range1.contains('2')) throw AssertionError()
if (!('2' in '3' .. '1') != !range1.contains('2')) throw AssertionError()
if (!('2' !in '3' .. '1') != range1.contains('2')) throw AssertionError()
// no local optimizations
if (element2 in '3' .. '1' != range1.contains(element2)) throw AssertionError()
if (element2 !in '3' .. '1' != !range1.contains(element2)) throw AssertionError()
if (!(element2 in '3' .. '1') != !range1.contains(element2)) throw AssertionError()
if (!(element2 !in '3' .. '1') != range1.contains(element2)) throw AssertionError()
}
fun testR1xE3() {
// with possible local optimizations
if ('3' in '3' .. '1' != range1.contains('3')) throw AssertionError()
if ('3' !in '3' .. '1' != !range1.contains('3')) throw AssertionError()
if (!('3' in '3' .. '1') != !range1.contains('3')) throw AssertionError()
if (!('3' !in '3' .. '1') != range1.contains('3')) throw AssertionError()
// no local optimizations
if (element3 in '3' .. '1' != range1.contains(element3)) throw AssertionError()
if (element3 !in '3' .. '1' != !range1.contains(element3)) throw AssertionError()
if (!(element3 in '3' .. '1') != !range1.contains(element3)) throw AssertionError()
if (!(element3 !in '3' .. '1') != range1.contains(element3)) throw AssertionError()
}
fun testR1xE4() {
// with possible local optimizations
if ('4' in '3' .. '1' != range1.contains('4')) throw AssertionError()
if ('4' !in '3' .. '1' != !range1.contains('4')) throw AssertionError()
if (!('4' in '3' .. '1') != !range1.contains('4')) throw AssertionError()
if (!('4' !in '3' .. '1') != range1.contains('4')) throw AssertionError()
// no local optimizations
if (element4 in '3' .. '1' != range1.contains(element4)) throw AssertionError()
if (element4 !in '3' .. '1' != !range1.contains(element4)) throw AssertionError()
if (!(element4 in '3' .. '1') != !range1.contains(element4)) throw AssertionError()
if (!(element4 !in '3' .. '1') != range1.contains(element4)) throw AssertionError()
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,159 @@
// Auto-generated by GenerateInRangeExpressionTestData. Do not edit!
// WITH_RUNTIME
val range0 = '1' until '3'
val range1 = '3' until '1'
val element0 = '0'
val element1 = '1'
val element2 = '2'
val element3 = '3'
val element4 = '4'
fun box(): String {
testR0xE0()
testR0xE1()
testR0xE2()
testR0xE3()
testR0xE4()
testR1xE0()
testR1xE1()
testR1xE2()
testR1xE3()
testR1xE4()
return "OK"
}
fun testR0xE0() {
// with possible local optimizations
if ('0' in '1' until '3' != range0.contains('0')) throw AssertionError()
if ('0' !in '1' until '3' != !range0.contains('0')) throw AssertionError()
if (!('0' in '1' until '3') != !range0.contains('0')) throw AssertionError()
if (!('0' !in '1' until '3') != range0.contains('0')) throw AssertionError()
// no local optimizations
if (element0 in '1' until '3' != range0.contains(element0)) throw AssertionError()
if (element0 !in '1' until '3' != !range0.contains(element0)) throw AssertionError()
if (!(element0 in '1' until '3') != !range0.contains(element0)) throw AssertionError()
if (!(element0 !in '1' until '3') != range0.contains(element0)) throw AssertionError()
}
fun testR0xE1() {
// with possible local optimizations
if ('1' in '1' until '3' != range0.contains('1')) throw AssertionError()
if ('1' !in '1' until '3' != !range0.contains('1')) throw AssertionError()
if (!('1' in '1' until '3') != !range0.contains('1')) throw AssertionError()
if (!('1' !in '1' until '3') != range0.contains('1')) throw AssertionError()
// no local optimizations
if (element1 in '1' until '3' != range0.contains(element1)) throw AssertionError()
if (element1 !in '1' until '3' != !range0.contains(element1)) throw AssertionError()
if (!(element1 in '1' until '3') != !range0.contains(element1)) throw AssertionError()
if (!(element1 !in '1' until '3') != range0.contains(element1)) throw AssertionError()
}
fun testR0xE2() {
// with possible local optimizations
if ('2' in '1' until '3' != range0.contains('2')) throw AssertionError()
if ('2' !in '1' until '3' != !range0.contains('2')) throw AssertionError()
if (!('2' in '1' until '3') != !range0.contains('2')) throw AssertionError()
if (!('2' !in '1' until '3') != range0.contains('2')) throw AssertionError()
// no local optimizations
if (element2 in '1' until '3' != range0.contains(element2)) throw AssertionError()
if (element2 !in '1' until '3' != !range0.contains(element2)) throw AssertionError()
if (!(element2 in '1' until '3') != !range0.contains(element2)) throw AssertionError()
if (!(element2 !in '1' until '3') != range0.contains(element2)) throw AssertionError()
}
fun testR0xE3() {
// with possible local optimizations
if ('3' in '1' until '3' != range0.contains('3')) throw AssertionError()
if ('3' !in '1' until '3' != !range0.contains('3')) throw AssertionError()
if (!('3' in '1' until '3') != !range0.contains('3')) throw AssertionError()
if (!('3' !in '1' until '3') != range0.contains('3')) throw AssertionError()
// no local optimizations
if (element3 in '1' until '3' != range0.contains(element3)) throw AssertionError()
if (element3 !in '1' until '3' != !range0.contains(element3)) throw AssertionError()
if (!(element3 in '1' until '3') != !range0.contains(element3)) throw AssertionError()
if (!(element3 !in '1' until '3') != range0.contains(element3)) throw AssertionError()
}
fun testR0xE4() {
// with possible local optimizations
if ('4' in '1' until '3' != range0.contains('4')) throw AssertionError()
if ('4' !in '1' until '3' != !range0.contains('4')) throw AssertionError()
if (!('4' in '1' until '3') != !range0.contains('4')) throw AssertionError()
if (!('4' !in '1' until '3') != range0.contains('4')) throw AssertionError()
// no local optimizations
if (element4 in '1' until '3' != range0.contains(element4)) throw AssertionError()
if (element4 !in '1' until '3' != !range0.contains(element4)) throw AssertionError()
if (!(element4 in '1' until '3') != !range0.contains(element4)) throw AssertionError()
if (!(element4 !in '1' until '3') != range0.contains(element4)) throw AssertionError()
}
fun testR1xE0() {
// with possible local optimizations
if ('0' in '3' until '1' != range1.contains('0')) throw AssertionError()
if ('0' !in '3' until '1' != !range1.contains('0')) throw AssertionError()
if (!('0' in '3' until '1') != !range1.contains('0')) throw AssertionError()
if (!('0' !in '3' until '1') != range1.contains('0')) throw AssertionError()
// no local optimizations
if (element0 in '3' until '1' != range1.contains(element0)) throw AssertionError()
if (element0 !in '3' until '1' != !range1.contains(element0)) throw AssertionError()
if (!(element0 in '3' until '1') != !range1.contains(element0)) throw AssertionError()
if (!(element0 !in '3' until '1') != range1.contains(element0)) throw AssertionError()
}
fun testR1xE1() {
// with possible local optimizations
if ('1' in '3' until '1' != range1.contains('1')) throw AssertionError()
if ('1' !in '3' until '1' != !range1.contains('1')) throw AssertionError()
if (!('1' in '3' until '1') != !range1.contains('1')) throw AssertionError()
if (!('1' !in '3' until '1') != range1.contains('1')) throw AssertionError()
// no local optimizations
if (element1 in '3' until '1' != range1.contains(element1)) throw AssertionError()
if (element1 !in '3' until '1' != !range1.contains(element1)) throw AssertionError()
if (!(element1 in '3' until '1') != !range1.contains(element1)) throw AssertionError()
if (!(element1 !in '3' until '1') != range1.contains(element1)) throw AssertionError()
}
fun testR1xE2() {
// with possible local optimizations
if ('2' in '3' until '1' != range1.contains('2')) throw AssertionError()
if ('2' !in '3' until '1' != !range1.contains('2')) throw AssertionError()
if (!('2' in '3' until '1') != !range1.contains('2')) throw AssertionError()
if (!('2' !in '3' until '1') != range1.contains('2')) throw AssertionError()
// no local optimizations
if (element2 in '3' until '1' != range1.contains(element2)) throw AssertionError()
if (element2 !in '3' until '1' != !range1.contains(element2)) throw AssertionError()
if (!(element2 in '3' until '1') != !range1.contains(element2)) throw AssertionError()
if (!(element2 !in '3' until '1') != range1.contains(element2)) throw AssertionError()
}
fun testR1xE3() {
// with possible local optimizations
if ('3' in '3' until '1' != range1.contains('3')) throw AssertionError()
if ('3' !in '3' until '1' != !range1.contains('3')) throw AssertionError()
if (!('3' in '3' until '1') != !range1.contains('3')) throw AssertionError()
if (!('3' !in '3' until '1') != range1.contains('3')) throw AssertionError()
// no local optimizations
if (element3 in '3' until '1' != range1.contains(element3)) throw AssertionError()
if (element3 !in '3' until '1' != !range1.contains(element3)) throw AssertionError()
if (!(element3 in '3' until '1') != !range1.contains(element3)) throw AssertionError()
if (!(element3 !in '3' until '1') != range1.contains(element3)) throw AssertionError()
}
fun testR1xE4() {
// with possible local optimizations
if ('4' in '3' until '1' != range1.contains('4')) throw AssertionError()
if ('4' !in '3' until '1' != !range1.contains('4')) throw AssertionError()
if (!('4' in '3' until '1') != !range1.contains('4')) throw AssertionError()
if (!('4' !in '3' until '1') != range1.contains('4')) throw AssertionError()
// no local optimizations
if (element4 in '3' until '1' != range1.contains(element4)) throw AssertionError()
if (element4 !in '3' until '1' != !range1.contains(element4)) throw AssertionError()
if (!(element4 in '3' until '1') != !range1.contains(element4)) throw AssertionError()
if (!(element4 !in '3' until '1') != range1.contains(element4)) throw AssertionError()
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,43 @@
// Auto-generated by GenerateInRangeExpressionTestData. Do not edit!
// WITH_RUNTIME
val range0 = 3 downTo 1
val range1 = 1 downTo 3
val element0 = 1
fun box(): String {
testR0xE0()
testR1xE0()
return "OK"
}
fun testR0xE0() {
// with possible local optimizations
if (1 in 3 downTo 1 != range0.contains(1)) throw AssertionError()
if (1 !in 3 downTo 1 != !range0.contains(1)) throw AssertionError()
if (!(1 in 3 downTo 1) != !range0.contains(1)) throw AssertionError()
if (!(1 !in 3 downTo 1) != range0.contains(1)) throw AssertionError()
// no local optimizations
if (element0 in 3 downTo 1 != range0.contains(element0)) throw AssertionError()
if (element0 !in 3 downTo 1 != !range0.contains(element0)) throw AssertionError()
if (!(element0 in 3 downTo 1) != !range0.contains(element0)) throw AssertionError()
if (!(element0 !in 3 downTo 1) != range0.contains(element0)) throw AssertionError()
}
fun testR1xE0() {
// with possible local optimizations
if (1 in 1 downTo 3 != range1.contains(1)) throw AssertionError()
if (1 !in 1 downTo 3 != !range1.contains(1)) throw AssertionError()
if (!(1 in 1 downTo 3) != !range1.contains(1)) throw AssertionError()
if (!(1 !in 1 downTo 3) != range1.contains(1)) throw AssertionError()
// no local optimizations
if (element0 in 1 downTo 3 != range1.contains(element0)) throw AssertionError()
if (element0 !in 1 downTo 3 != !range1.contains(element0)) throw AssertionError()
if (!(element0 in 1 downTo 3) != !range1.contains(element0)) throw AssertionError()
if (!(element0 !in 1 downTo 3) != range1.contains(element0)) throw AssertionError()
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,43 @@
// Auto-generated by GenerateInRangeExpressionTestData. Do not edit!
// WITH_RUNTIME
val range0 = 3L downTo 1L
val range1 = 1L downTo 3L
val element0 = 1L
fun box(): String {
testR0xE0()
testR1xE0()
return "OK"
}
fun testR0xE0() {
// with possible local optimizations
if (1L in 3L downTo 1L != range0.contains(1L)) throw AssertionError()
if (1L !in 3L downTo 1L != !range0.contains(1L)) throw AssertionError()
if (!(1L in 3L downTo 1L) != !range0.contains(1L)) throw AssertionError()
if (!(1L !in 3L downTo 1L) != range0.contains(1L)) throw AssertionError()
// no local optimizations
if (element0 in 3L downTo 1L != range0.contains(element0)) throw AssertionError()
if (element0 !in 3L downTo 1L != !range0.contains(element0)) throw AssertionError()
if (!(element0 in 3L downTo 1L) != !range0.contains(element0)) throw AssertionError()
if (!(element0 !in 3L downTo 1L) != range0.contains(element0)) throw AssertionError()
}
fun testR1xE0() {
// with possible local optimizations
if (1L in 1L downTo 3L != range1.contains(1L)) throw AssertionError()
if (1L !in 1L downTo 3L != !range1.contains(1L)) throw AssertionError()
if (!(1L in 1L downTo 3L) != !range1.contains(1L)) throw AssertionError()
if (!(1L !in 1L downTo 3L) != range1.contains(1L)) throw AssertionError()
// no local optimizations
if (element0 in 1L downTo 3L != range1.contains(element0)) throw AssertionError()
if (element0 !in 1L downTo 3L != !range1.contains(element0)) throw AssertionError()
if (!(element0 in 1L downTo 3L) != !range1.contains(element0)) throw AssertionError()
if (!(element0 !in 1L downTo 3L) != range1.contains(element0)) throw AssertionError()
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,21 +0,0 @@
// WITH_RUNTIME
val ints = intArrayOf(1, 2, 3)
val objs = arrayOf(1, 2, 3)
val i1 = 1
fun box(): String {
// NB partially const-folded in JVM BE
if (!(1 in ints.indices)) return "Fail 1 in IntArray.indices"
if (1 !in ints.indices) return "Fail 1 !in IntArray.indices"
if (!(1 in objs.indices)) return "Fail 1 in Array.indices"
if (1 !in objs.indices) return "Fail 1 !in Array.indices"
if (!(i1 in ints.indices)) return "Fail i1 in IntArray.indices"
if (i1 !in ints.indices) return "Fail i1 !in IntArray.indices"
if (!(i1 in objs.indices)) return "Fail i1 in Array.indices"
if (i1 !in objs.indices) return "Fail i1 !in Array.indices"
return "OK"
}
@@ -1,16 +0,0 @@
// WITH_RUNTIME
val cs = "123"
val i1 = 1
fun box(): String {
// NB partially const-folded in JVM BE
if (!(1 in cs.indices)) return "Fail 1 in CharSequence.indices"
if (1 !in cs.indices) return "Fail 1 !in CharSequence.indices"
if (!(i1 in cs.indices)) return "Fail i1 in CharSequence.indices"
if (i1 !in cs.indices) return "Fail i1 !in CharSequence.indices"
return "OK"
}
@@ -1,16 +0,0 @@
// WITH_RUNTIME
val xs = listOf(1, 2, 3)
val i1 = 1
fun box(): String {
// NB partially const-folded in JVM BE
if (!(1 in xs.indices)) return "Fail 1 in Collection.indices"
if (1 !in xs.indices) return "Fail 1 !in Collection.indices"
if (!(i1 in xs.indices)) return "Fail i1 in Collection.indices"
if (i1 !in xs.indices) return "Fail i1 !in Collection.indices"
return "OK"
}
@@ -13231,30 +13231,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
doTest(fileName);
}
@TestMetadata("inArrayIndices.kt")
public void testInArrayIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inArrayIndices.kt");
doTest(fileName);
}
@TestMetadata("inCharSequence.kt")
public void testInCharSequence() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inCharSequence.kt");
doTest(fileName);
}
@TestMetadata("inCharSequenceIndices.kt")
public void testInCharSequenceIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inCharSequenceIndices.kt");
doTest(fileName);
}
@TestMetadata("inCollectionIndices.kt")
public void testInCollectionIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inCollectionIndices.kt");
doTest(fileName);
}
@TestMetadata("inComparableRange.kt")
public void testInComparableRange() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inComparableRange.kt");
@@ -13380,6 +13362,99 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/rangeContainsString.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/codegen/box/ranges/contains/generated")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Generated extends AbstractIrBlackBoxCodegenTest {
public void testAllFilesPresentInGenerated() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/contains/generated"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("arrayIndices.kt")
public void testArrayIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/arrayIndices.kt");
doTest(fileName);
}
@TestMetadata("charDownTo.kt")
public void testCharDownTo() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charDownTo.kt");
doTest(fileName);
}
@TestMetadata("charRangeLiteral.kt")
public void testCharRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("charSequenceIndices.kt")
public void testCharSequenceIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charSequenceIndices.kt");
doTest(fileName);
}
@TestMetadata("charUntil.kt")
public void testCharUntil() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charUntil.kt");
doTest(fileName);
}
@TestMetadata("collectionIndices.kt")
public void testCollectionIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/collectionIndices.kt");
doTest(fileName);
}
@TestMetadata("doubleRangeLiteral.kt")
public void testDoubleRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/doubleRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("floatRangeLiteral.kt")
public void testFloatRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/floatRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("intDownTo.kt")
public void testIntDownTo() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/intDownTo.kt");
doTest(fileName);
}
@TestMetadata("intRangeLiteral.kt")
public void testIntRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/intRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("intUntil.kt")
public void testIntUntil() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/intUntil.kt");
doTest(fileName);
}
@TestMetadata("longDownTo.kt")
public void testLongDownTo() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/longDownTo.kt");
doTest(fileName);
}
@TestMetadata("longRangeLiteral.kt")
public void testLongRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/longRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("longUntil.kt")
public void testLongUntil() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/longUntil.kt");
doTest(fileName);
}
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/expression")
@@ -13231,30 +13231,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("inArrayIndices.kt")
public void testInArrayIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inArrayIndices.kt");
doTest(fileName);
}
@TestMetadata("inCharSequence.kt")
public void testInCharSequence() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inCharSequence.kt");
doTest(fileName);
}
@TestMetadata("inCharSequenceIndices.kt")
public void testInCharSequenceIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inCharSequenceIndices.kt");
doTest(fileName);
}
@TestMetadata("inCollectionIndices.kt")
public void testInCollectionIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inCollectionIndices.kt");
doTest(fileName);
}
@TestMetadata("inComparableRange.kt")
public void testInComparableRange() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inComparableRange.kt");
@@ -13380,6 +13362,99 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/rangeContainsString.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/codegen/box/ranges/contains/generated")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Generated extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInGenerated() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/contains/generated"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("arrayIndices.kt")
public void testArrayIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/arrayIndices.kt");
doTest(fileName);
}
@TestMetadata("charDownTo.kt")
public void testCharDownTo() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charDownTo.kt");
doTest(fileName);
}
@TestMetadata("charRangeLiteral.kt")
public void testCharRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("charSequenceIndices.kt")
public void testCharSequenceIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charSequenceIndices.kt");
doTest(fileName);
}
@TestMetadata("charUntil.kt")
public void testCharUntil() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charUntil.kt");
doTest(fileName);
}
@TestMetadata("collectionIndices.kt")
public void testCollectionIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/collectionIndices.kt");
doTest(fileName);
}
@TestMetadata("doubleRangeLiteral.kt")
public void testDoubleRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/doubleRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("floatRangeLiteral.kt")
public void testFloatRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/floatRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("intDownTo.kt")
public void testIntDownTo() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/intDownTo.kt");
doTest(fileName);
}
@TestMetadata("intRangeLiteral.kt")
public void testIntRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/intRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("intUntil.kt")
public void testIntUntil() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/intUntil.kt");
doTest(fileName);
}
@TestMetadata("longDownTo.kt")
public void testLongDownTo() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/longDownTo.kt");
doTest(fileName);
}
@TestMetadata("longRangeLiteral.kt")
public void testLongRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/longRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("longUntil.kt")
public void testLongUntil() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/longUntil.kt");
doTest(fileName);
}
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/expression")
@@ -13231,30 +13231,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
doTest(fileName);
}
@TestMetadata("inArrayIndices.kt")
public void testInArrayIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inArrayIndices.kt");
doTest(fileName);
}
@TestMetadata("inCharSequence.kt")
public void testInCharSequence() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inCharSequence.kt");
doTest(fileName);
}
@TestMetadata("inCharSequenceIndices.kt")
public void testInCharSequenceIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inCharSequenceIndices.kt");
doTest(fileName);
}
@TestMetadata("inCollectionIndices.kt")
public void testInCollectionIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inCollectionIndices.kt");
doTest(fileName);
}
@TestMetadata("inComparableRange.kt")
public void testInComparableRange() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inComparableRange.kt");
@@ -13380,6 +13362,99 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/rangeContainsString.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/codegen/box/ranges/contains/generated")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Generated extends AbstractLightAnalysisModeTest {
public void testAllFilesPresentInGenerated() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/contains/generated"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("arrayIndices.kt")
public void testArrayIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/arrayIndices.kt");
doTest(fileName);
}
@TestMetadata("charDownTo.kt")
public void testCharDownTo() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charDownTo.kt");
doTest(fileName);
}
@TestMetadata("charRangeLiteral.kt")
public void testCharRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("charSequenceIndices.kt")
public void testCharSequenceIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charSequenceIndices.kt");
doTest(fileName);
}
@TestMetadata("charUntil.kt")
public void testCharUntil() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charUntil.kt");
doTest(fileName);
}
@TestMetadata("collectionIndices.kt")
public void testCollectionIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/collectionIndices.kt");
doTest(fileName);
}
@TestMetadata("doubleRangeLiteral.kt")
public void testDoubleRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/doubleRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("floatRangeLiteral.kt")
public void testFloatRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/floatRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("intDownTo.kt")
public void testIntDownTo() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/intDownTo.kt");
doTest(fileName);
}
@TestMetadata("intRangeLiteral.kt")
public void testIntRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/intRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("intUntil.kt")
public void testIntUntil() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/intUntil.kt");
doTest(fileName);
}
@TestMetadata("longDownTo.kt")
public void testLongDownTo() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/longDownTo.kt");
doTest(fileName);
}
@TestMetadata("longRangeLiteral.kt")
public void testLongRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/longRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("longUntil.kt")
public void testLongUntil() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/longUntil.kt");
doTest(fileName);
}
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/expression")
@@ -0,0 +1,176 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.generators.tests
import java.io.File
import com.intellij.openapi.util.io.FileUtil
import java.io.PrintWriter
import java.io.StringWriter
object GenerateInRangeExpressionTestData {
private val TEST_DATA_DIR = File("compiler/testData/codegen/box/ranges/contains")
private val GENERATED_DIR = File(TEST_DATA_DIR, "generated")
private val PREAMBLE_MESSAGE = "Auto-generated by ${GenerateInRangeExpressionTestData::class.java.simpleName}. Do not edit!"
private fun generateMatrixTestCase(
fileName: String,
rangeExpressions: List<String>,
elementExpressions: List<String>,
header: String = ""
) {
PrintWriter(File(GENERATED_DIR, fileName)).use {
it.generateTestCaseBody(header, rangeExpressions, elementExpressions)
}
}
private fun PrintWriter.generateTestCaseBody(header: String, rangeExpressions: List<String>, elementExpressions: List<String>) {
println("// $PREAMBLE_MESSAGE")
println("// WITH_RUNTIME")
println()
println(header)
println()
val rangeValNames = generateGlobalValDefinitions(rangeExpressions, "range")
val elementValNames = generateGlobalValDefinitions(elementExpressions, "element")
val testFunctions = StringWriter()
val testFunctionsWriter = PrintWriter(testFunctions)
println("fun box(): String {")
rangeValNames.zip(rangeExpressions).forEachIndexed { i, (rangeValName, rangeExpression) ->
elementValNames.zip(elementExpressions).forEachIndexed { j, (elementValName, elementExpression) ->
val functionName = "testR${i}xE${j}"
println(" $functionName()")
testFunctionsWriter.generateTestCaseFunction(functionName, rangeValName, rangeExpression, elementValName, elementExpression)
}
}
println(" return \"OK\"")
println("}")
println()
println(testFunctions.toString())
}
private fun PrintWriter.generateGlobalValDefinitions(expressions: List<String>, prefix: String): List<String> {
val valNames = expressions.indices.map { "$prefix$it" }
valNames.zip(expressions).forEach { (name, expression) -> println("val $name = $expression") }
println()
return valNames
}
private fun PrintWriter.generateTestCaseFunction(
functionName: String,
rangeValName: String,
rangeExpression: String,
elementValName: String,
elementExpression: String
) {
println("fun $functionName() {")
println(" // with possible local optimizations")
println(" if ($elementExpression in $rangeExpression != $rangeValName.contains($elementExpression)) throw AssertionError()")
println(" if ($elementExpression !in $rangeExpression != !$rangeValName.contains($elementExpression)) throw AssertionError()")
println(" if (!($elementExpression in $rangeExpression) != !$rangeValName.contains($elementExpression)) throw AssertionError()")
println(" if (!($elementExpression !in $rangeExpression) != $rangeValName.contains($elementExpression)) throw AssertionError()")
println(" // no local optimizations")
println(" if ($elementValName in $rangeExpression != $rangeValName.contains($elementValName)) throw AssertionError()")
println(" if ($elementValName !in $rangeExpression != !$rangeValName.contains($elementValName)) throw AssertionError()")
println(" if (!($elementValName in $rangeExpression) != !$rangeValName.contains($elementValName)) throw AssertionError()")
println(" if (!($elementValName !in $rangeExpression) != $rangeValName.contains($elementValName)) throw AssertionError()")
println("}")
println()
}
private fun generateRangeOperatorTestCase(
name: String,
aExpression: String,
op: String,
bExpression: String,
elementExpressions: List<String>
) {
generateMatrixTestCase(
name,
listOf(
"$aExpression $op $bExpression",
"$bExpression $op $aExpression"
),
elementExpressions
)
}
@JvmStatic
fun main(args: Array<String>) {
if (!TEST_DATA_DIR.exists()) throw AssertionError("${TEST_DATA_DIR.path} doesn't exist")
FileUtil.delete(GENERATED_DIR)
GENERATED_DIR.mkdirs()
val charLiterals = listOf("'0'", "'1'", "'2'", "'3'", "'4'")
val numericLiterals =
listOf("(-1)", "0", "1", "2", "3", "4").flatMap {
listOf("$it.toByte()", "$it.toShort()", it, "$it.toLong()", "$it.toFloat()", "$it.toDouble()")
}
generateRangeOperatorTestCase("charRangeLiteral.kt", "'1'", "..", "'3'", charLiterals)
generateRangeOperatorTestCase("charUntil.kt", "'1'", "until", "'3'", charLiterals)
generateRangeOperatorTestCase("charDownTo.kt", "'3'", "downTo", "'1'", charLiterals)
generateRangeOperatorTestCase("intRangeLiteral.kt", "1", "..", "3", numericLiterals)
generateRangeOperatorTestCase("intUntil.kt", "1", "until", "3", numericLiterals)
generateRangeOperatorTestCase("intDownTo.kt", "3", "downTo", "1", listOf("1"))
generateRangeOperatorTestCase("longRangeLiteral.kt", "1L", "..", "3L", numericLiterals)
generateRangeOperatorTestCase("longUntil.kt", "1L", "until", "3L", numericLiterals)
generateRangeOperatorTestCase("longDownTo.kt", "3L", "downTo", "1L", listOf("1L"))
generateRangeOperatorTestCase("floatRangeLiteral.kt", "1.0F", "..", "3.0F", numericLiterals)
generateRangeOperatorTestCase("doubleRangeLiteral.kt", "1.0", "..", "3.0", numericLiterals)
generateMatrixTestCase(
"arrayIndices.kt",
listOf("intArray.indices", "objectArray.indices", "emptyIntArray.indices", "emptyObjectArray.indices"),
numericLiterals,
"""val intArray = intArrayOf(1, 2, 3)
|val objectArray = arrayOf(1, 2, 3)
|val emptyIntArray = intArrayOf()
|val emptyObjectArray = arrayOf<Any>()
""".trimMargin()
)
generateMatrixTestCase(
"collectionIndices.kt",
listOf("collection.indices", "emptyCollection.indices"),
numericLiterals,
"""val collection = listOf(1, 2, 3)
|val emptyCollection = listOf<Any>()
""".trimMargin()
)
generateMatrixTestCase(
"charSequenceIndices.kt",
listOf("charSequence.indices", "emptyCharSequence.indices"),
numericLiterals,
"""val charSequence: CharSequence = "123"
|val emptyCharSequence: CharSequence = ""
""".trimMargin()
)
}
}
@@ -14845,30 +14845,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
doTest(fileName);
}
@TestMetadata("inArrayIndices.kt")
public void testInArrayIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inArrayIndices.kt");
doTest(fileName);
}
@TestMetadata("inCharSequence.kt")
public void testInCharSequence() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inCharSequence.kt");
doTest(fileName);
}
@TestMetadata("inCharSequenceIndices.kt")
public void testInCharSequenceIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inCharSequenceIndices.kt");
doTest(fileName);
}
@TestMetadata("inCollectionIndices.kt")
public void testInCollectionIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inCollectionIndices.kt");
doTest(fileName);
}
@TestMetadata("inComparableRange.kt")
public void testInComparableRange() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inComparableRange.kt");
@@ -15066,6 +15048,99 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/rangeContainsString.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/codegen/box/ranges/contains/generated")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Generated extends AbstractJsCodegenBoxTest {
public void testAllFilesPresentInGenerated() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/contains/generated"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("arrayIndices.kt")
public void testArrayIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/arrayIndices.kt");
doTest(fileName);
}
@TestMetadata("charDownTo.kt")
public void testCharDownTo() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charDownTo.kt");
doTest(fileName);
}
@TestMetadata("charRangeLiteral.kt")
public void testCharRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("charSequenceIndices.kt")
public void testCharSequenceIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charSequenceIndices.kt");
doTest(fileName);
}
@TestMetadata("charUntil.kt")
public void testCharUntil() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/charUntil.kt");
doTest(fileName);
}
@TestMetadata("collectionIndices.kt")
public void testCollectionIndices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/collectionIndices.kt");
doTest(fileName);
}
@TestMetadata("doubleRangeLiteral.kt")
public void testDoubleRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/doubleRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("floatRangeLiteral.kt")
public void testFloatRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/floatRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("intDownTo.kt")
public void testIntDownTo() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/intDownTo.kt");
doTest(fileName);
}
@TestMetadata("intRangeLiteral.kt")
public void testIntRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/intRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("intUntil.kt")
public void testIntUntil() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/intUntil.kt");
doTest(fileName);
}
@TestMetadata("longDownTo.kt")
public void testLongDownTo() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/longDownTo.kt");
doTest(fileName);
}
@TestMetadata("longRangeLiteral.kt")
public void testLongRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/longRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("longUntil.kt")
public void testLongUntil() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/generated/longUntil.kt");
doTest(fileName);
}
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/expression")