diff options
| author | 2011-09-22 20:06:48 -0700 | |
|---|---|---|
| committer | 2011-09-22 20:06:48 -0700 | |
| commit | d8b877a20c87e3c7ebef4a3ddd1d8896b2a5b822 (patch) | |
| tree | 92aeaf574b00a8177eba50d6408b5dbc183bc28d /test/IntMath/IntMath.java | |
| parent | 8fe11f02fdf16ad03d91a891c1a4570b85a82c83 (diff) | |
| parent | 932746a4f22951abcba7b7c4c94c27b1bf164272 (diff) | |
Merge "Stack overflow error and unit test." into dalvik-dev
Diffstat (limited to 'test/IntMath/IntMath.java')
| -rw-r--r-- | test/IntMath/IntMath.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/IntMath/IntMath.java b/test/IntMath/IntMath.java index c43d09eafc..e5fa806ca4 100644 --- a/test/IntMath/IntMath.java +++ b/test/IntMath/IntMath.java @@ -786,6 +786,25 @@ class IntMath extends IntMathBase { return res; } + static long recursion_count_; + static void throwStackOverflow(long l) { + recursion_count_++; + throwStackOverflow(recursion_count_); + } + + static long testStackOverflow() { + try { + throwStackOverflow(0); + if (recursion_count_ != 0) { + return recursion_count_; + } else { + return -1; + } + } catch(StackOverflowError soe) { + return 0; + } + } + public static void main(String[] args) { boolean failure = false; int res; @@ -947,6 +966,14 @@ class IntMath extends IntMathBase { failure = true; } + lres= testStackOverflow(); + if (lres == 0) { + System.out.println("testStackOverflow PASSED"); + } else { + System.out.println("testStackOverflow FAILED: " + lres); + 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); |