Commit b3268598 by Andrew Haley Committed by Andrew Haley

Divide_1.java: Add may more test cases.

2001-07-06  Andrew Haley  <aph@cambridge.redhat.com>

        * libjava.lang/Divide_1.java: Add may more test cases.
        * libjava.lang/Divide_1.out: Likewise.

From-SVN: r43812
parent 93603141
2001-07-06 Andrew Haley <aph@cambridge.redhat.com>
* libjava.lang/Divide_1.java: Add many more test cases.
* libjava.lang/Divide_1.out: Likewise.
2001-07-03 Jeff Sturm <jsturm@one-point.com>
* libjava.lang/II.java: New file.
......
......@@ -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 ();
}
}
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment