Removed old range test which were spread all over the place.

This commit is contained in:
Evgeny Gerashchenko
2013-01-30 16:03:22 +04:00
parent 9c83a2f85f
commit 21c37951d6
11 changed files with 2 additions and 329 deletions
@@ -1,24 +0,0 @@
fun box(): String {
if (IntRange(1, 0) != IntRange.EMPTY) {
return IntRange.EMPTY.toString()
}
if (CharRange(1.toChar(), 0.toChar()) != CharRange.EMPTY) {
return CharRange.EMPTY.toString()
}
if (ByteRange(1, 0) != ByteRange.EMPTY) {
return ByteRange.EMPTY.toString()
}
if (ShortRange(1, 0) != ShortRange.EMPTY) {
return ShortRange.EMPTY.toString()
}
if (FloatRange(1.toFloat(), 0.toFloat()) != FloatRange.EMPTY) {
return FloatRange.EMPTY.toString()
}
if (LongRange(1, 0) != LongRange.EMPTY) {
return LongRange.EMPTY.toString()
}
if (DoubleRange(1.0, 0.0) != DoubleRange.EMPTY) {
return DoubleRange.EMPTY.toString()
}
return "OK"
}
@@ -1,24 +0,0 @@
fun box() : String {
val r1 = IntRange(1, 4)
if(r1.start != 1 || r1.end != 4) return "fail"
val r2 = ByteRange(1, 4)
if(r2.start != 1.toByte() || r2.end != 4.toByte()) return "fail"
val r3 = ShortRange(1, 4)
if(r3.start != 1.toShort() || r3.end != 4.toShort()) return "fail"
val r4 = CharRange('a', 'd')
if(r4.start != 'a' || r4.end != 'd') return "fail"
val r5 = FloatRange(0.0.toFloat(), 1.0.toFloat())
if(r5.start != 0.0.toFloat() || r5.end != 1.0.toFloat()) return "fail"
val r6 = DoubleRange(0.0, 1.0)
if(r6.start != 0.0 || r6.end != 1.0) return "fail"
val r7 = LongRange(1, 4)
if(r7.start != 1.toLong() || r7.end != 4.toLong()) return "fail"
return "OK"
}
@@ -1,8 +0,0 @@
fun box() : String {
for (i in "".indices) {
""[i]
}
return "OK"
}
val String?.indices : IntRange get() = 0..(this!!.length - 1)
@@ -1,7 +0,0 @@
fun box(): String {
val iterator: Iterator<Int> = (0..0).iterator()
for (i in iterator) {
return "OK"
}
return "fail"
}
@@ -1,11 +0,0 @@
fun box() : String {
var cnt = 0
for (len in 4 downTo 1) {
cnt++
}
for (n in (1..5).reversed())
cnt++
return if(cnt == 9) "OK" else cnt.toString()
}
@@ -1,13 +0,0 @@
fun box() : String {
System.out?.println(System.out?.println(10.toFloat()..11.toFloat()))
for(f in 10.toFloat()..11.toFloat() step 0.3.toFloat()) {
System.out?.println(f)
}
for(f in 10.toDouble()..11.toDouble() step 0.3.toDouble()) {
System.out?.println(f)
}
return "OK"
}
@@ -1,54 +0,0 @@
fun test1() : Boolean {
val r1 = 1..10
var s1 = 0
for(e in r1 step 2) {
s1 += e
}
return s1 == 25
}
fun test2() : Boolean {
val r1 = 1.toByte()..10.toByte()
var s1 = 0
for(e in r1 step 2) {
s1 += e
}
return s1 == 25
}
fun test3() : Boolean {
val r1 = 1.toByte()..10.toLong()
var s1 = 0.toLong()
for(e in r1 step 2) {
s1 += e
}
return s1 == 25.toLong()
}
fun test4() : Boolean {
val r1 = 1.toByte()..10.toShort()
var s1 = 0.toShort()
for(e in r1 step 2) {
s1 += e
}
return s1 == 25.toShort()
}
fun test5() : Boolean {
val r1 = 'a'..'h'
var s1 = 0
for(e in r1 step 2) {
s1 ++
}
return s1 == 4
}
fun box() : String {
if(test1().not()) return "test1 failed"
if(test2().not()) return "test2 failed"
if(test3().not()) return "test3 failed"
if(test4().not()) return "test4 failed"
if(test5().not()) return "test4 failed"
return "OK"
}
@@ -1,100 +0,0 @@
fun testInt () : String {
val r1 = 1 rangeTo 4
if (r1.start != 1 || r1.end != 4) return "int rangeTo fail"
val r2 = 4 rangeTo 1
if (r2.start != 4 || r2.end != 1) return "int negative rangeTo fail"
val r3 = 5 downTo 0
if (r3.start != 5 || r3.end != 0 || r3.increment != -1) return "int downTo fail"
val r4 = 5 downTo 6
if (r4.start != 5 || r4.end != 6 || r4.increment != -1) return "int negative downTo fail"
return "OK"
}
fun testByte () : String {
val r1 = 1.toByte() rangeTo 4.toByte()
if (r1.start != 1.toByte() || r1.end != 4.toByte()) return "byte rangeTo fail"
val r2 = 4.toByte() rangeTo 1.toByte()
if (r2.start != 4.toByte() || r2.end != 1.toByte()) return "byte negative rangeTo fail"
val r3 = 5.toByte() downTo 0.toByte()
if (r3.start != 5.toByte() || r3.end != 0.toByte() || r3.increment != -1) return "byte downTo fail"
val r4 = 5.toByte() downTo 6.toByte()
if (r3.start != 5.toByte() || r3.end != 0.toByte() || r4.increment != -1) return "byte negative downTo fail"
return "OK"
}
fun testShort () : String {
val r1 = 1.toShort() rangeTo 4.toShort()
if (r1.start != 1.toShort() || r1.end != 4.toShort()) return "short rangeTo fail"
val r2 = 4.toShort() rangeTo 1.toShort()
if (r2.start != 4.toShort() || r2.end != 1.toShort()) return "short negative rangeTo fail"
val r3 = 5.toShort() downTo 0.toShort()
if (r3.start != 5.toShort() || r3.end != 0.toShort() || r3.increment != -1) return "short downTo fail"
val r4 = 5.toShort() downTo 6.toShort()
if (r3.start != 5.toShort() || r3.end != 0.toShort() || r4.increment != -1) return "short negative downTo fail"
return "OK"
}
fun testLong () : String {
val r1 = 1.toLong() rangeTo 4.toLong()
if (r1.start != 1.toLong() || r1.end != 4.toLong()) return "long rangeTo fail"
val r2 = 4.toLong() rangeTo 1.toLong()
if (r2.start != 4.toLong() || r2.end != 1.toLong()) return "long negative rangeTo fail"
val r3 = 5.toLong() downTo 0.toLong()
if (r3.start != 5.toLong() || r3.end != 0.toLong() || r3.increment != -1.toLong()) return "long downTo fail"
val r4 = 5.toLong() downTo 6.toLong()
if (r3.start != 5.toLong() || r3.end != 0.toLong() || r4.increment != -1.toLong()) return "long negative downTo fail"
return "OK"
}
fun testChar () : String {
val r1 = 'a' rangeTo 'd'
if (r1.start != 'a' || r1.end != 'd') return "char rangeTo fail"
val r2 = 'd' rangeTo 'a'
if(r2.start != 'd' || r2.end != 'a') return "char negative long fail"
val r3 = 'd' downTo 'a'
if (r3.start != 'd' || r3.end != 'a' || r3.increment != -1) return "char downTo fail"
val r4 = 'a' downTo 'd'
if (r4.start != 'a' || r4.end != 'd' || r4.increment != -1) return "char negative downTo fail"
return "OK"
}
fun box() : String {
var r : String
r = testInt()
if(r != "OK") return r
r = testByte()
if(r != "OK") return r
r = testShort()
if(r != "OK") return r
r = testLong()
if(r != "OK") return r
return "OK"
}
-38
View File
@@ -1,38 +0,0 @@
fun box(): String {
val sb = StringBuilder()
fun ap(i : Int) {
if (sb.size != 0) sb.append(" ")
sb.append(i)
}
for (i in 0..0) {
ap(i)
}
sb.append(";")
for (i in 0..1) {
ap(i)
}
sb.append(";")
for (i in IntRange(0, 0)) {
ap(i)
}
sb.append(";")
for (i in 0 downTo 0) {
ap(i)
}
sb.append(";")
for (i in 1 downTo 0) {
ap(i)
}
return if (sb.toString() == "0; 0 1; 0; 0; 1 0") "OK" else sb.toString()!!
}
fun main(args: Array<String>) {
println(box())
}
@@ -316,22 +316,6 @@ public class StdlibTest extends CodegenTestCase {
blackBoxFile("regressions/kt2334.kt");
}
public void testUptoDownto() {
blackBoxFile("uptoDownto.kt");
}
public void testKt765 () {
blackBoxFile("regressions/kt765.kt");
}
public void testKt925 () {
blackBoxFile("regressions/kt925.kt");
}
public void testKt930 () {
blackBoxFile("regressions/kt930.kt");
}
public void test1733() {
blackBoxFile("regressions/kt1733.kt");
}
@@ -364,10 +348,6 @@ public class StdlibTest extends CodegenTestCase {
blackBoxFile("jdk-annotations/collections.kt");
}
public void testKt1076() {
blackBoxFile("regressions/kt1076.kt");
}
public void testKt1515() {
blackBoxMultiFile("/multi/kt1515/thisPackage.kt", "/multi/kt1515/otherPackage.kt");
}
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jet.codegen.generated;
import junit.framework.Assert;
@@ -29,7 +30,7 @@ import org.jetbrains.jet.codegen.generated.AbstractBlackBoxCodegenTest;
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/codegen/box")
@InnerTestClasses({BlackBoxCodegenTestGenerated.Arrays.class, BlackBoxCodegenTestGenerated.Bridges.class, BlackBoxCodegenTestGenerated.Casts.class, BlackBoxCodegenTestGenerated.Classes.class, BlackBoxCodegenTestGenerated.Closures.class, BlackBoxCodegenTestGenerated.ControlStructures.class, BlackBoxCodegenTestGenerated.DefaultArguments.class, BlackBoxCodegenTestGenerated.Enum.class, BlackBoxCodegenTestGenerated.ExtensionFunctions.class, BlackBoxCodegenTestGenerated.ExtensionProperties.class, BlackBoxCodegenTestGenerated.Functions.class, BlackBoxCodegenTestGenerated.InnerNested.class, BlackBoxCodegenTestGenerated.Instructions.class, BlackBoxCodegenTestGenerated.Intrinsics.class, BlackBoxCodegenTestGenerated.Labels.class, BlackBoxCodegenTestGenerated.LocalClasses.class, BlackBoxCodegenTestGenerated.MultiDecl.class, BlackBoxCodegenTestGenerated.Namespace.class, BlackBoxCodegenTestGenerated.Objects.class, BlackBoxCodegenTestGenerated.OperatorConventions.class, BlackBoxCodegenTestGenerated.PrimitiveTypes.class, BlackBoxCodegenTestGenerated.Properties.class, BlackBoxCodegenTestGenerated.Ranges.class, BlackBoxCodegenTestGenerated.SafeCall.class, BlackBoxCodegenTestGenerated.Strings.class, BlackBoxCodegenTestGenerated.Super.class, BlackBoxCodegenTestGenerated.Traits.class, BlackBoxCodegenTestGenerated.TypeInfo.class, BlackBoxCodegenTestGenerated.Unit.class, BlackBoxCodegenTestGenerated.Vararg.class, BlackBoxCodegenTestGenerated.When.class})
@InnerTestClasses({BlackBoxCodegenTestGenerated.Arrays.class, BlackBoxCodegenTestGenerated.Bridges.class, BlackBoxCodegenTestGenerated.Casts.class, BlackBoxCodegenTestGenerated.Classes.class, BlackBoxCodegenTestGenerated.Closures.class, BlackBoxCodegenTestGenerated.ControlStructures.class, BlackBoxCodegenTestGenerated.DefaultArguments.class, BlackBoxCodegenTestGenerated.Enum.class, BlackBoxCodegenTestGenerated.ExtensionFunctions.class, BlackBoxCodegenTestGenerated.ExtensionProperties.class, BlackBoxCodegenTestGenerated.Functions.class, BlackBoxCodegenTestGenerated.InnerNested.class, BlackBoxCodegenTestGenerated.Instructions.class, BlackBoxCodegenTestGenerated.Intrinsics.class, BlackBoxCodegenTestGenerated.Labels.class, BlackBoxCodegenTestGenerated.LocalClasses.class, BlackBoxCodegenTestGenerated.MultiDecl.class, BlackBoxCodegenTestGenerated.Namespace.class, BlackBoxCodegenTestGenerated.Objects.class, BlackBoxCodegenTestGenerated.OperatorConventions.class, BlackBoxCodegenTestGenerated.PrimitiveTypes.class, BlackBoxCodegenTestGenerated.Properties.class, BlackBoxCodegenTestGenerated.SafeCall.class, BlackBoxCodegenTestGenerated.Strings.class, BlackBoxCodegenTestGenerated.Super.class, BlackBoxCodegenTestGenerated.Traits.class, BlackBoxCodegenTestGenerated.TypeInfo.class, BlackBoxCodegenTestGenerated.Unit.class, BlackBoxCodegenTestGenerated.Vararg.class, BlackBoxCodegenTestGenerated.When.class})
public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInBox() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/codegen/box"), "kt", true);
@@ -2707,11 +2708,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
blackBoxFileByFullPath("compiler/testData/codegen/box/primitiveTypes/ea35963.kt");
}
@TestMetadata("emptyRanges.kt")
public void testEmptyRanges() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/box/primitiveTypes/emptyRanges.kt");
}
@TestMetadata("intLiteralIsNotNull.kt")
public void testIntLiteralIsNotNull() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/box/primitiveTypes/intLiteralIsNotNull.kt");
@@ -2837,11 +2833,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
blackBoxFileByFullPath("compiler/testData/codegen/box/primitiveTypes/kt757.kt");
}
@TestMetadata("kt821.kt")
public void testKt821() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/box/primitiveTypes/kt821.kt");
}
@TestMetadata("kt828.kt")
public void testKt828() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/box/primitiveTypes/kt828.kt");
@@ -2867,11 +2858,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
blackBoxFileByFullPath("compiler/testData/codegen/box/primitiveTypes/kt935.kt");
}
@TestMetadata("kt944.kt")
public void testKt944() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/box/primitiveTypes/kt944.kt");
}
@TestMetadata("kt945.kt")
public void testKt945() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/box/primitiveTypes/kt945.kt");
@@ -2987,19 +2973,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
}
@TestMetadata("compiler/testData/codegen/box/ranges")
public static class Ranges extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInRanges() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/codegen/box/ranges"), "kt", true);
}
@TestMetadata("kt2596.kt")
public void testKt2596() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/box/ranges/kt2596.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/safeCall")
public static class SafeCall extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInSafeCall() throws Exception {
@@ -3354,7 +3327,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
suite.addTest(OperatorConventions.innerSuite());
suite.addTestSuite(PrimitiveTypes.class);
suite.addTestSuite(Properties.class);
suite.addTestSuite(Ranges.class);
suite.addTestSuite(SafeCall.class);
suite.addTestSuite(Strings.class);
suite.addTestSuite(Super.class);