Java 8 RFR 8022094: BigDecimal/CompareToTests and BigInteger/CompareToTests are incorrect
Stuart Marks
stuart.marks at oracle.com
Fri Aug 2 02:54:11 UTC 2013
Looks good. Always a good idea to make sure that failures are reported
properly. :-)
It does look like the following cases are repeated, in both tests:
{valueOf(Long.MIN_VALUE+1), valueOf(Long.MAX_VALUE), MINUS_ONE},
{valueOf(Long.MIN_VALUE+1).negate(), valueOf(Long.MAX_VALUE), ZERO},
Is this right?
The first four cases are (excuse the poor cross product notation):
{max, max-1, min, min+1} x {1, -1} compareTo max
but then there's simply
{min} x {1, -1} compareTo min
followed by the duplicate
{min+1} x {1, -1} compareTo max
Just following the pattern, I'd expect
{max, max-1, min, min+1} x {1, -1} compareTo min
though I'm not sure that all of these cases are necessary.
s'marks
On 8/1/13 12:09 PM, Brian Burkhalter wrote:
> Reviewers:
>
> This is a test-only issue.
>
> Issue http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8022094 (not public quite yet)
> Webrev http://cr.openjdk.java.net/~bpb/8022094/
>
> Summary:
>
> 1) BigDecimal
> * The compareToTest() method was modified to correctly print and report errors.
> * The set of test cases was changed to eliminate incorrect assumptions.
> 2) BigInteger
> * Old version replaced by copying BigDecimal version and changing BigDecimal to BigInteger.
> * Fractional test cases were replace with others to probe internal mag array having different relative lengths.
>
> Thanks,
>
> Brian
>
More information about the core-libs-dev
mailing list