History log of /libcore/luni/src/test/java/libcore/java/math/BigIntegerTest.java
Revision Date Author Comments
e0840cc531ef6c534797a80b5e229fef5fec8570 26-Apr-2016 Tobias Thierer <tobiast@google.com> Fix BigDecimal result for -Long.MIN_VALUE / -1L

BigDecimal produced the result -9223372036854775808 (== -2^64
== Long.MIN_VALUE) instead of 9223372036854775808 (== 2^64).
This was because BigDecimal incorrectly used long arithmetic for
this calculation, which overflows back to Long.MIN_VALUE.

This bug didn't happen in the case where the result scale required
adjustment (diffScale != 0): The bitLength(power of ten) calculation
rounds up to whole bits, and therefore is generous enough not to fall
into this trap in the corner case.

Public bug: https://code.google.com/p/android/issues/detail?id=196555

Bug: 26105053
Change-Id: Ie4b1d08c9074d59d854c664ef17aedcaae24c56e
1d6c936ab01da702aab6c7e578e2c74cdc90b8a4 18-Mar-2014 Kenny Root <kroot@google.com> NativeBN: use bn_correct_top on negative BN

If you use BN_bin2bn, it will call bn_correct_top for you. However,
since this code is poking into the structure of the BIGNUM itself
without using API, we must call it ourselves.

Before the test_negativeValues_superfluousZeroes would fail with this
confusing error:

libcore.java.math.BigIntegerTest#test_negativeValues_superfluousZeros
junit.framework.AssertionFailedError: expected -1374707309 but was -1374707309
at junit.framework.Assert.assertEquals(Assert.java:99)
at libcore.java.math.BigIntegerTest.test_negativeValues_superfluousZeros(BigIntegerTest.java:171)

Bug: 12761797
Change-Id: I724c1313e4febca8ce2bda9d10f9b5ebde96a6b1
dd9d07889d37fd2d8d5052b517150ca31ac9d95a 13-Apr-2013 Elliott Hughes <enh@google.com> Fix BigInteger small prime generation.

OpenSSL won't generate primes smaller than 16 bits, so do it ourselves
roughly the same way they would.

Also remove pure duplicate tests from OldBigIntegerTest, and add some
new tests to the modern BigIntegerTest.

Change-Id: I3000942a7a4f2359d5cbe28795b4f8dd96715ef8
495c740217c5ab4ed117c030e9bf72919c47809e 12-Jul-2011 Elliott Hughes <enh@google.com> Add a failing test for a BigInteger.hashCode bug.

Bug: http://code.google.com/p/android/issues/detail?id=18452
Change-Id: I072c54b16de9630833fdf9107428aa4045f4f937
99d9f92a991cbbfc58b103b3f1c114fbac5d1188 08-Sep-2010 Elliott Hughes <enh@google.com> Fix off-by-one error in BigInteger.valueOf.

Bug: 2981072
Change-Id: Ic85aea22fc4e519355c537376b1526828e2375c5
4557728efb66c455a52b7669a8eefef7a9e54854 11-Aug-2010 Jesse Wilson <jessewilson@google.com> Moving tests to be under the libcore.* package.

This is indended to make it easier to run on VMs that restrict the packages
from which application classes can be loaded. For example, on the RI you need
to use the bootclasspath to load these tests.

Change-Id: I52193f35c5fcca18b5a3e1d280505b1e29b388af