Permalink
Browse files

test long addition and subtraction in Misc, as well as multidimension…

…al array creation
  • Loading branch information...
1 parent b2e25f4 commit c9f06933e23335f5caff6b1b0871188e734fb8d6 Joel Dice committed May 18, 2008
Showing with 21 additions and 7 deletions.
  1. +21 −7 test/Misc.java
View
@@ -101,6 +101,8 @@ public static void main(String[] args) {
expect(a >> b == -5 >> 2);
expect(a >>> b == -5 >>> 2);
expect(a << b == -5 << 2);
+ expect(a + b == -5 + 2);
+ expect(a - b == -5 - 2);
expect(a * b == -5 * 2);
expect(a / b == -5 / 2);
expect(a % b == -5 % 2);
@@ -115,6 +117,8 @@ public static void main(String[] args) {
expect(a >> b == 5 >> 2);
expect(a >>> b == 5 >>> 2);
expect(a << b == 5 << 2);
+ expect(a + b == 5 + 2);
+ expect(a - b == 5 - 2);
expect(a * b == 5 * 2);
expect(a / b == 5 / 2);
expect(a % b == 5 % 2);
@@ -130,6 +134,8 @@ public static void main(String[] args) {
expect(a >> b == -5L >> 2);
expect(a >>> b == -5L >>> 2);
expect(a << b == -5L << 2);
+ expect(a + b == -5L + 2L);
+ expect(a - b == -5L - 2L);
expect(a * b == -5L * 2L);
expect(a / b == -5L / 2L);
expect(a % b == -5L % 2L);
@@ -144,6 +150,8 @@ public static void main(String[] args) {
expect(a >> b == 5L >> 2);
expect(a >>> b == 5L >>> 2);
expect(a << b == 5L << 2);
+ expect(a + b == 5L + 2L);
+ expect(a - b == 5L - 2L);
expect(a * b == 5L * 2L);
expect(a / b == 5L / 2L);
expect(a % b == 5L % 2L);
@@ -235,14 +243,20 @@ public static void main(String[] args) {
expect(zip() == 47);
expect(zup() == 47);
- int[] array = new int[0];
- Exception exception = null;
- try {
- int x = array[0];
- } catch (ArrayIndexOutOfBoundsException e) {
- exception = e;
+ { int[] array = new int[0];
+ Exception exception = null;
+ try {
+ int x = array[0];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ exception = e;
+ }
+
+ expect(exception != null);
}
- expect(exception != null);
+ { Object[][] array = new Object[1][1];
+ expect(array.length == 1);
+ expect(array[0].length == 1);
+ }
}
}

0 comments on commit c9f0693

Please sign in to comment.