Skip to content

Commit

Permalink
Update tests for #2130.
Browse files Browse the repository at this point in the history
  • Loading branch information
tombentley committed Jun 16, 2015
1 parent 0d75c16 commit 04f2e0f
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ class ArrayIterationStatic implements .com.redhat.ceylon.compiler.java.runtime.m
}

private final void arrayOfIntegersBy$priv$(final .ceylon.language.Array<.ceylon.language.Integer> array) {
final .java.lang.Object array$3 = array.toArray();
final int length$4 = .com.redhat.ceylon.compiler.java.Util.arrayLength(array$3);
final int step$6 = .com.redhat.ceylon.compiler.java.Util.toInt(5L);
if (step$6 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_1: for (int i$5 = 0; i$5 < length$4; i$5 += step$6) {
final long element = .com.redhat.ceylon.compiler.java.Util.getIntegerArray(array$3, i$5);
final .java.lang.Object array$4 = array.toArray();
final int length$5 = .com.redhat.ceylon.compiler.java.Util.arrayLength(array$4);
final int step$3 = .com.redhat.ceylon.compiler.java.Util.toInt(5L);
if (step$3 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_1: for (int i$6 = 0; i$6 < length$5; i$6 += step$3) {
final long element = .com.redhat.ceylon.compiler.java.Util.getIntegerArray(array$4, i$6);
.ceylon.language.print_.print(.ceylon.language.Integer.instance(element + 5L));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void compareMeasureCharacterBy2130(Character start, Integer length, Integer by,
throw Exception("(``start``:``length``).by(``by``): ``problems``");
}
}

void bug2130Measure() {
compareMeasureInteger2130 { start = 0; length = 0; };
compareMeasureInteger2130 { start = 0; length = -1; };
Expand Down Expand Up @@ -377,10 +377,50 @@ void bug2130Measure() {
compareMeasureIntegerBy2130 { start = 0; length = -1; by = step; };
compareMeasureIntegerBy2130 { start = 0; length = 1; by = step; };
compareMeasureIntegerBy2130 { start = 0; length = 10; by = step; };
// TODO compareMeasureIntegerBy2130(runtime.maxIntegerValue, 10, step);
// TODO compareMeasureIntegerBy2130(runtime.minIntegerValue, 10, step);
compareMeasureIntegerBy2130(runtime.minIntegerValue, 10, step);
compareMeasureIntegerBy2130(runtime.maxIntegerValue, 10, step);
}
compareMeasureIntegerBy2130 { start = runtime.maxIntegerValue-5; length = 10; by=3; };
compareMeasureIntegerBy2130 { start = runtime.minIntegerValue-5; length = 10; by=3; };
compareMeasureIntegerBy2130 { start = runtime.maxIntegerValue-5; length = 10; by=3; };

// Characters
compareMeasureCharacter2130 { start = '\0'; length = 0; };
compareMeasureCharacter2130 { start = '\0'; length = -1; };
compareMeasureCharacter2130 { start = '\0'; length = 1; };
compareMeasureCharacter2130 { start = '\0'; length = 10; };
compareMeasureCharacter2130 { start = '\0'; length = 10; };
compareMeasureCharacter2130{
start='\0';
length=100;
breakAfter=10;
};
value maxCharacterValue = #10FFFF.character;
value minCharacterValue = 0.character;
compareMeasureCharacter2130{
start=maxCharacterValue.neighbour(-2);
length=100;
breakAfter=10;
};
compareMeasureCharacter2130{
start='\0'.neighbour(1);
length=100;
breakAfter=10;
};

compareMeasureCharacter2130 { start = maxCharacterValue; length = 10; };
compareMeasureCharacter2130 { start = minCharacterValue; length = 10; };
compareMeasureCharacter2130 { start = maxCharacterValue.neighbour(-5); length = 10; };
//compareMeasureCharacter2130 { start = minCharacterValue.neighbour(-5); length = 10; };

for (step in [-1, 0, 1, 2, runtime.maxIntegerValue]) {
compareMeasureCharacterBy2130 { start = '\0'; length = 0; by = step; };
compareMeasureCharacterBy2130 { start = '\0'; length = -1; by = step; };
compareMeasureCharacterBy2130 { start = '\0'; length = 1; by = step; };
compareMeasureCharacterBy2130 { start = '\0'; length = 10; by = step; };
compareMeasureCharacterBy2130(minCharacterValue, 10, step);
compareMeasureCharacterBy2130(maxCharacterValue, 10, step);
}
//compareMeasureCharacterBy2130 { start = minCharacterValue-5; length = 10; by=3; };
compareMeasureCharacterBy2130 { start = maxCharacterValue.neighbour(-5); length = 10; by=3; };

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class JavaArrayIterationStatic implements .com.redhat.ceylon.compiler.java.runti
}

private final void arrayOfIntsBy$priv$(final int[] array) {
final int[] array$3 = array;
final int step$6 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$6 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_1: for (int i$5 = 0; i$5 < array$3.length; i$5 += step$6) {
final long element = array$3[i$5];
final int[] array$4 = array;
final int step$3 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$3 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_1: for (int i$6 = 0; i$6 < array$4.length; i$6 += step$3) {
final long element = array$4[i$6];
.ceylon.language.print_.print(.ceylon.language.Integer.instance(element + 5L));
}
}
Expand Down Expand Up @@ -47,11 +47,11 @@ class JavaArrayIterationStatic implements .com.redhat.ceylon.compiler.java.runti
}

private final void arrayOfCharsBy$priv$(final char[] array) {
final char[] array$14 = array;
final int step$17 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$17 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_5: for (int i$16 = 0; i$16 < array$14.length; i$16 += step$17) {
final int element = array$14[i$16];
final char[] array$15 = array;
final int step$14 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$14 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_5: for (int i$17 = 0; i$17 < array$15.length; i$17 += step$14) {
final int element = array$15[i$17];
.ceylon.language.print_.print(.ceylon.language.Character.instance(element));
}
}
Expand All @@ -65,11 +65,11 @@ class JavaArrayIterationStatic implements .com.redhat.ceylon.compiler.java.runti
}

private final void arrayOfBytesBy$priv$(final byte[] array) {
final byte[] array$21 = array;
final int step$24 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$24 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_7: for (int i$23 = 0; i$23 < array$21.length; i$23 += step$24) {
final byte element = array$21[i$23];
final byte[] array$22 = array;
final int step$21 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$21 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_7: for (int i$24 = 0; i$24 < array$22.length; i$24 += step$21) {
final byte element = array$22[i$24];
.ceylon.language.print_.print(.ceylon.language.Byte.instance(element));
}
}
Expand All @@ -83,11 +83,11 @@ class JavaArrayIterationStatic implements .com.redhat.ceylon.compiler.java.runti
}

private final void arrayOfShortsBy$priv$(final short[] array) {
final short[] array$28 = array;
final int step$31 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$31 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_9: for (int i$30 = 0; i$30 < array$28.length; i$30 += step$31) {
final long element = array$28[i$30];
final short[] array$29 = array;
final int step$28 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$28 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_9: for (int i$31 = 0; i$31 < array$29.length; i$31 += step$28) {
final long element = array$29[i$31];
.ceylon.language.print_.print(.ceylon.language.Integer.instance(element));
}
}
Expand All @@ -101,11 +101,11 @@ class JavaArrayIterationStatic implements .com.redhat.ceylon.compiler.java.runti
}

private final void arrayOfLongsBy$priv$(final long[] array) {
final long[] array$35 = array;
final int step$38 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$38 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_11: for (int i$37 = 0; i$37 < array$35.length; i$37 += step$38) {
final long element = array$35[i$37];
final long[] array$36 = array;
final int step$35 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$35 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_11: for (int i$38 = 0; i$38 < array$36.length; i$38 += step$35) {
final long element = array$36[i$38];
.ceylon.language.print_.print(.ceylon.language.Integer.instance(element));
}
}
Expand All @@ -119,11 +119,11 @@ class JavaArrayIterationStatic implements .com.redhat.ceylon.compiler.java.runti
}

private final void arrayOfBooleansBy$priv$(final boolean[] array) {
final boolean[] array$42 = array;
final int step$45 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$45 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_13: for (int i$44 = 0; i$44 < array$42.length; i$44 += step$45) {
final boolean element = array$42[i$44];
final boolean[] array$43 = array;
final int step$42 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$42 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_13: for (int i$45 = 0; i$45 < array$43.length; i$45 += step$42) {
final boolean element = array$43[i$45];
.ceylon.language.print_.print(.ceylon.language.Boolean.instance(element));
}
}
Expand All @@ -137,11 +137,11 @@ class JavaArrayIterationStatic implements .com.redhat.ceylon.compiler.java.runti
}

private final void arrayOfFloatsBy$priv$(final float[] array) {
final float[] array$49 = array;
final int step$52 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$52 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_15: for (int i$51 = 0; i$51 < array$49.length; i$51 += step$52) {
final double element = array$49[i$51];
final float[] array$50 = array;
final int step$49 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$49 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_15: for (int i$52 = 0; i$52 < array$50.length; i$52 += step$49) {
final double element = array$50[i$52];
.ceylon.language.print_.print(.ceylon.language.Float.instance(element));
}
}
Expand All @@ -155,11 +155,11 @@ class JavaArrayIterationStatic implements .com.redhat.ceylon.compiler.java.runti
}

private final void arrayOfDoublesBy$priv$(final double[] array) {
final double[] array$56 = array;
final int step$59 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$59 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_17: for (int i$58 = 0; i$58 < array$56.length; i$58 += step$59) {
final double element = array$56[i$58];
final double[] array$57 = array;
final int step$56 = .com.redhat.ceylon.compiler.java.Util.toInt(2L);
if (step$56 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_17: for (int i$59 = 0; i$59 < array$57.length; i$59 += step$56) {
final double element = array$57[i$59];
.ceylon.language.print_.print(.ceylon.language.Float.instance(element));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@ class OptimizedForWithSegment implements .com.redhat.ceylon.compiler.java.runtim

private final void by$priv$() {
long sum = 0L;
final long start$12 = 1L;
final long length$13 = 10L;
final long step$15 = 3L;
if (length$13 > 0 && step$15 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_4: for (long i$14 = 0; i$14 < length$13; i$14 = .ceylon.language.Integer.neighbour(i$14, step$15)) {
final long i = .ceylon.language.Integer.neighbour(start$12, i$14);
final long start$13 = 1L;
final long length$14 = 10L;
final long step$12 = 3L;
if (length$14 > 0 && step$12 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_4: for (long i$15 = 0; i$15 < length$14; i$15 = step$12 == 1L ? i$15 + 1L : .ceylon.language.Integer.neighbour(i$15, step$12)) {
final long i = step$12 == 1L ? i$15 + start$13 : .ceylon.language.Integer.neighbour(start$13, i$15);
sum += i;
}
final long start$16 = 1L;
final long length$17 = 10L;
final long step$19 = 3L;
if (length$17 > 0 && step$19 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_5: for (long i$18 = 0; i$18 < length$17; i$18 = .ceylon.language.Integer.neighbour(i$18, step$19)) {
final long i = .ceylon.language.Integer.neighbour(start$16, i$18);
final long start$17 = 1L;
final long length$18 = 10L;
final long step$16 = 3L;
if (length$18 > 0 && step$16 <= 0) throw new .ceylon.language.AssertionError("Assertion failed" + ": step size must be greater than zero" + (.java.lang.System.lineSeparator() + "\tviolated " + "step > 0"));
loop_5: for (long i$19 = 0; i$19 < length$18; i$19 = step$16 == 1L ? i$19 + 1L : .ceylon.language.Integer.neighbour(i$19, step$16)) {
final long i = step$16 == 1L ? i$19 + start$17 : .ceylon.language.Integer.neighbour(start$17, i$19);
sum += i;
}
}
Expand Down

0 comments on commit 04f2e0f

Please sign in to comment.