test/java/lang/Math/DivModTests.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
8004066 Cdiff test/java/lang/Math/DivModTests.java
test/java/lang/Math/DivModTests.java
Print this page
*** 63,73 ****
/**
* Test the integer floorDiv and floorMod methods.
* Math and StrictMath tested and the same results are expected for both.
*/
static void testIntFloorDivMod() {
! testIntFloorDivMod(4, 0, new ArithmeticException("/ by zero"), new ArithmeticException("/ by zero")); // Should throw ArithmeticException
testIntFloorDivMod(4, 3, 1, 1);
testIntFloorDivMod(3, 3, 1, 0);
testIntFloorDivMod(2, 3, 0, 2);
testIntFloorDivMod(1, 3, 0, 1);
testIntFloorDivMod(0, 3, 0, 0);
--- 63,73 ----
/**
* Test the integer floorDiv and floorMod methods.
* Math and StrictMath tested and the same results are expected for both.
*/
static void testIntFloorDivMod() {
! testIntFloorDivMod(4, 0, new ArithmeticException(), new ArithmeticException()); // Should throw ArithmeticException
testIntFloorDivMod(4, 3, 1, 1);
testIntFloorDivMod(3, 3, 1, 0);
testIntFloorDivMod(2, 3, 0, 2);
testIntFloorDivMod(1, 3, 0, 1);
testIntFloorDivMod(0, 3, 0, 0);
*** 149,159 ****
/**
* Test the floorDiv and floorMod methods for primitive long.
*/
static void testLongFloorDivMod() {
! testLongFloorDivMod(4L, 0L, new ArithmeticException("/ by zero"), new ArithmeticException("/ by zero")); // Should throw ArithmeticException
testLongFloorDivMod(4L, 3L, 1L, 1L);
testLongFloorDivMod(3L, 3L, 1L, 0L);
testLongFloorDivMod(2L, 3L, 0L, 2L);
testLongFloorDivMod(1L, 3L, 0L, 1L);
testLongFloorDivMod(0L, 3L, 0L, 0L);
--- 149,159 ----
/**
* Test the floorDiv and floorMod methods for primitive long.
*/
static void testLongFloorDivMod() {
! testLongFloorDivMod(4L, 0L, new ArithmeticException(), new ArithmeticException()); // Should throw ArithmeticException
testLongFloorDivMod(4L, 3L, 1L, 1L);
testLongFloorDivMod(3L, 3L, 1L, 0L);
testLongFloorDivMod(2L, 3L, 0L, 2L);
testLongFloorDivMod(1L, 3L, 0L, 1L);
testLongFloorDivMod(0L, 3L, 0L, 0L);
*** 383,395 ****
if (result.equals(expected)) {
return true;
}
// Handle special case to compare ArithmeticExceptions
if (result instanceof ArithmeticException && expected instanceof ArithmeticException) {
! ArithmeticException ae1 = (ArithmeticException)result;
! ArithmeticException ae2 = (ArithmeticException)expected;
! return ae1.getMessage().equals(ae2.getMessage());
}
return false;
}
}
--- 383,393 ----
if (result.equals(expected)) {
return true;
}
// Handle special case to compare ArithmeticExceptions
if (result instanceof ArithmeticException && expected instanceof ArithmeticException) {
! return true;
}
return false;
}
}
test/java/lang/Math/DivModTests.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File