diff options
Diffstat (limited to 'test/IntMath/IntMath.java')
| -rw-r--r-- | test/IntMath/IntMath.java | 25 |
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); |