summaryrefslogtreecommitdiff
path: root/test/IntMath/IntMath.java
diff options
context:
space:
mode:
author Ian Rogers <irogers@google.com> 2011-09-23 14:16:35 -0700
committer Ian Rogers <irogers@google.com> 2011-09-23 15:24:10 -0700
commite51a511ccee3f3c0120807321bcc160fcaa664be (patch)
tree24ae359ac6331afbfabcfb8b938bfad2e4d44ce6 /test/IntMath/IntMath.java
parent382ece5707c7b7c61f44a01f57ac22df9a8197d0 (diff)
Exception support for CanPutArrayElementFromCode.
Also a unit test. Change-Id: I6fb4b4180d36ea2d8447a9b4d5cf28cf410960cd
Diffstat (limited to 'test/IntMath/IntMath.java')
-rw-r--r--test/IntMath/IntMath.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/IntMath/IntMath.java b/test/IntMath/IntMath.java
index e5fa806ca4..b1b7312fb2 100644
--- a/test/IntMath/IntMath.java
+++ b/test/IntMath/IntMath.java
@@ -786,6 +786,34 @@ class IntMath extends IntMathBase {
return res;
}
+ static void throwArrayStoreException(Object[] array, Object element) {
+ array[0] = element;
+ }
+
+ static int testArrayStoreException() {
+ int res=0;
+ Object[] array = new Number[2];
+ try {
+ throwArrayStoreException(array, null);
+ res += 1;
+ } catch(ArrayStoreException e) {
+ res += 2;
+ }
+ try {
+ throwArrayStoreException(array, Integer.valueOf(1));
+ res += 10;
+ } catch(ArrayStoreException e) {
+ res += 20;
+ }
+ try {
+ throwArrayStoreException(array, "hello MTV-44");
+ res += 100;
+ } catch(ArrayStoreException e) {
+ res += 200;
+ }
+ return res;
+ }
+
static long recursion_count_;
static void throwStackOverflow(long l) {
recursion_count_++;
@@ -966,6 +994,14 @@ class IntMath extends IntMathBase {
failure = true;
}
+ res = testArrayStoreException();
+ if (res == 211) {
+ System.out.println("testArrayStore PASSED");
+ } else {
+ System.out.println("testArrayStore FAILED: " + res);
+ failure = true;
+ }
+
lres= testStackOverflow();
if (lres == 0) {
System.out.println("testStackOverflow PASSED");