From: Andrew Haley Date: Fri, 6 Jul 2001 16:32:40 +0000 (+0000) Subject: Divide_1.java: Add may more test cases. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b32685987f0b05b642646bf613f1c9b9853ac97a;p=gcc.git Divide_1.java: Add may more test cases. 2001-07-06 Andrew Haley * libjava.lang/Divide_1.java: Add may more test cases. * libjava.lang/Divide_1.out: Likewise. From-SVN: r43812 --- diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog index a7a98aa4d4e..cc7acc8506e 100644 --- a/libjava/testsuite/ChangeLog +++ b/libjava/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2001-07-06 Andrew Haley + + * libjava.lang/Divide_1.java: Add many more test cases. + * libjava.lang/Divide_1.out: Likewise. + 2001-07-03 Jeff Sturm * libjava.lang/II.java: New file. diff --git a/libjava/testsuite/libjava.lang/Divide_1.java b/libjava/testsuite/libjava.lang/Divide_1.java index d4e01939aa5..50db00935ba 100644 --- a/libjava/testsuite/libjava.lang/Divide_1.java +++ b/libjava/testsuite/libjava.lang/Divide_1.java @@ -4,7 +4,7 @@ public class Divide_1 int b1 = Integer.parseInt ("-1"); static int zero = Integer.parseInt ("0"); - void probe () + void probe_1 () { try { int a = Integer.parseInt ("-80000000", 16); @@ -98,8 +98,106 @@ public class Divide_1 System.out.println (_); } } + + void probe_2 () + { + try { + int a = -0x80000000; + int c = a/b; + System.out.println (c); + } catch (Exception _) { + System.out.println (_); + } + + try { + int a = -0x80000000; + int c = a/-1; + System.out.println (c); + } catch (Exception _) { + System.out.println (_); + } + + try { + int a = -0x80000000; + int c = a%b; + System.out.println (c); + } catch (Exception _) { + System.out.println (_); + } + + try { + int a = -0x80000000; + int c = a%b1; + System.out.println (c); + } catch (Exception _) { + System.out.println (_); + } + + try { + int a = -0x80000000; + int c = a%-1; + System.out.println (c); + } catch (Exception _) { + System.out.println (_); + } + + try { + int a = 0x8000; + int b = 0; + int c = a/b; + System.out.println (c); + } catch (Exception _) { + System.out.println (_); + } + + try { + int a = 0x8000; + int b = 0; + int c = a%b; + System.out.println (c); + } catch (Exception _) { + System.out.println (_); + } + + try { + long a = -0x7fffffffffffffffL - 1; + long c = a/b; + System.out.println (c); + } catch (Exception _) { + System.out.println (_); + } + + try { + long a = -0x7fffffffffffffffL - 1; + long c = a%b; + System.out.println (c); + } catch (Exception _) { + System.out.println (_); + } + + try { + long a = 0x8000; + long b = 0; + long c = a/b; + System.out.println (c); + } catch (Exception _) { + System.out.println (_); + } + + try { + long a = 0x8000; + long b = 0; + long c = a%b; + System.out.println (c); + } catch (Exception _) { + System.out.println (_); + } + } - public static void main (String[] args) { - new Divide_1 ().probe (); + public static void main (String[] args) + { + Divide_1 d = new Divide_1 (); + d.probe_1 (); + d.probe_2 (); } } diff --git a/libjava/testsuite/libjava.lang/Divide_1.out b/libjava/testsuite/libjava.lang/Divide_1.out index 6e1f87ed4fc..be5d07c7258 100644 --- a/libjava/testsuite/libjava.lang/Divide_1.out +++ b/libjava/testsuite/libjava.lang/Divide_1.out @@ -9,3 +9,14 @@ java.lang.ArithmeticException: / by zero 0 java.lang.ArithmeticException: / by zero java.lang.ArithmeticException: / by zero +-2147483648 +-2147483648 +0 +0 +0 +java.lang.ArithmeticException: / by zero +java.lang.ArithmeticException: / by zero +-9223372036854775808 +0 +java.lang.ArithmeticException: / by zero +java.lang.ArithmeticException: / by zero