summaryrefslogtreecommitdiff
path: root/test/IntMath/IntMath.java
diff options
context:
space:
mode:
author Ian Rogers <irogers@google.com> 2011-09-23 16:27:54 -0700
committer Ian Rogers <irogers@google.com> 2011-09-23 16:27:54 -0700
commitb886da8e3c26443ab4d2aa63268bd673c354c3d2 (patch)
tree26f01b0d92a79dea97fe80ccc580a7cbcd0178ac /test/IntMath/IntMath.java
parente51a511ccee3f3c0120807321bcc160fcaa664be (diff)
Support for exceptions from array allocation.
Adds support for exceptions during array allocation and checked array allocation (used by filled-new-array). Adds more unit tests. Change-Id: I3438b257a1cf19538d8b72529097a74347ac3b99
Diffstat (limited to 'test/IntMath/IntMath.java')
-rw-r--r--test/IntMath/IntMath.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/IntMath/IntMath.java b/test/IntMath/IntMath.java
index b1b7312fb2..7b0d5f81bd 100644
--- a/test/IntMath/IntMath.java
+++ b/test/IntMath/IntMath.java
@@ -833,6 +833,23 @@ class IntMath extends IntMathBase {
}
}
+ static int testArrayAllocation() {
+ int res = 0;
+ try {
+ int[] x = new int[-1];
+ res += 1;
+ } catch (NegativeArraySizeException e) {
+ res += 2;
+ }
+ try {
+ int[] x = new int [1];
+ res += 10;
+ } catch (Throwable e) {
+ res += 20;
+ }
+ return res;
+ }
+
public static void main(String[] args) {
boolean failure = false;
int res;
@@ -1010,6 +1027,14 @@ class IntMath extends IntMathBase {
failure = true;
}
+ res = testArrayAllocation();
+ if (res == 12) {
+ System.out.println("testArrayAllocation PASSED");
+ } else {
+ System.out.println("testArrayAllocation FAILED: " + res);
+ failure = true;
+ }
+
res = manyArgs(0, 1L, 2, 3L, 4, 5L, 6, 7, 8.0, 9.0f, 10.0,
(short)11, 12, (char)13, 14, 15, (byte)-16, true, 18,
19, 20L, 21L, 22, 23, 24, 25, 26);