diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-01-09 17:50:54 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-01-09 17:50:54 -0800 |
commit | a0881d052ee72e3f7e773374e9b1aa75fbd6be4c (patch) | |
tree | 8a9462436077d0d906368cb21f521f1bf8a25500 /math | |
parent | dd828f42a5c83b4270d4fbf6fce2da1878f1e84a (diff) | |
download | libcore-a0881d052ee72e3f7e773374e9b1aa75fbd6be4c.zip libcore-a0881d052ee72e3f7e773374e9b1aa75fbd6be4c.tar.gz libcore-a0881d052ee72e3f7e773374e9b1aa75fbd6be4c.tar.bz2 |
auto import from //branches/cupcake/...@125939
Diffstat (limited to 'math')
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/AllTests.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/AllTests.java) | 4 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalArithmeticTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalArithmeticTest.java) | 2098 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalCompareTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalCompareTest.java) | 572 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalConstructorsTest.java | 1603 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalConvertTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConvertTest.java) | 1250 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalScaleOperationsTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalScaleOperationsTest.java) | 480 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerAddTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAddTest.java) | 351 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerAndTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAndTest.java) | 321 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerCompareTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerCompareTest.java) | 501 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerConstructorsTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConstructorsTest.java) | 786 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerConvertTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConvertTest.java) | 876 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerDivideTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerDivideTest.java) | 508 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerHashCodeTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerHashCodeTest.java) | 51 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerModPowTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerModPowTest.java) | 231 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerMultiplyTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerMultiplyTest.java) | 276 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerNotTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerNotTest.java) | 141 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerOperateBitsTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOperateBitsTest.java) | 1326 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerOrTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOrTest.java) | 306 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerSubtractTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerSubtractTest.java) | 381 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerToStringTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerToStringTest.java) | 261 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerXorTest.java (renamed from math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerXorTest.java) | 291 | ||||
-rw-r--r-- | math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java | 1201 | ||||
-rw-r--r-- | math/src/test/java/tests/api/java/math/AllTests.java | 4 | ||||
-rw-r--r-- | math/src/test/java/tests/api/java/math/BigDecimalTest.java | 770 | ||||
-rw-r--r-- | math/src/test/java/tests/api/java/math/BigIntegerTest.java | 712 | ||||
-rw-r--r-- | math/src/test/java/tests/api/java/math/MathContextTest.java | 135 | ||||
-rw-r--r-- | math/src/test/java/tests/api/java/math/RoundingModeTest.java | 61 | ||||
-rw-r--r-- | math/src/test/java/tests/math/AllTests.java | 4 |
28 files changed, 7487 insertions, 8014 deletions
diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/AllTests.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/AllTests.java index e61b8f0..318e4b6 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/AllTests.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/AllTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import junit.framework.Test; import junit.framework.TestSuite; @@ -30,7 +30,7 @@ public class AllTests { } public static Test suite() { - TestSuite suite = new TestSuite("All tests for package org.apache.harmony.tests.java.math;"); + TestSuite suite = tests.TestSuiteFactory.createTestSuite("All tests for package org.apache.harmony.tests.java.math;"); // $JUnit-BEGIN$ suite.addTestSuite(BigDecimalArithmeticTest.class); diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalArithmeticTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalArithmeticTest.java index 929a85f..b2375f8 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalArithmeticTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalArithmeticTest.java @@ -15,20 +15,19 @@ * limitations under the License. */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; -import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.KnownFailure; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; -import java.math.BigDecimal; +import junit.framework.TestCase; +import java.math.BigDecimal; import java.math.BigInteger; import java.math.MathContext; import java.math.RoundingMode; - -import junit.framework.TestCase; @TestTargetClass(BigDecimal.class) /** * Class: java.math.BigDecimal @@ -39,15 +38,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Add two numbers of equal positive scales */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigDecimal.class} + ) public void testAddEqualScalePosPos() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 10; @@ -65,15 +61,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Add two numbers of equal positive scales using MathContext */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Together with all other methods including a MathContext these tests form m a complete test set.", + method = "add", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testAddMathContextEqualScalePosPos() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 10; @@ -92,15 +85,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Add two numbers of equal negative scales */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigDecimal.class} + ) public void testAddEqualScaleNegNeg() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = -10; @@ -118,15 +108,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Add two numbers of equal negative scales using MathContext */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Together with all other methods including a MathContext these tests form a complete test set.", + method = "add", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testAddMathContextEqualScaleNegNeg() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = -10; @@ -145,15 +132,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Add two numbers of different scales; the first is positive */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigDecimal.class} + ) public void testAddDiffScalePosNeg() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 15; @@ -171,15 +155,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Add two numbers of different scales using MathContext; the first is positive */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Together with all other methods including a MathContext these tests form a complete test set.", + method = "add", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testAddMathContextDiffScalePosNeg() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 15; @@ -191,22 +172,19 @@ public class BigDecimalArithmeticTest extends TestCase { BigDecimal bNumber = new BigDecimal(new BigInteger(b), bScale); MathContext mc = new MathContext(15, RoundingMode.CEILING); BigDecimal result = aNumber.add(bNumber, mc); - assertEquals("incorrect value", c, c.toString()); + assertEquals("incorrect value", c, result.toString()); assertEquals("incorrect scale", cScale, result.scale()); } /** * Add two numbers of different scales; the first is negative */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigDecimal.class} + ) public void testAddDiffScaleNegPos() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = -15; @@ -224,15 +202,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Add two zeroes of different scales; the first is negative */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigDecimal.class} + ) public void testAddDiffScaleZeroZero() { String a = "0"; int aScale = -15; @@ -248,17 +223,49 @@ public class BigDecimalArithmeticTest extends TestCase { } /** + * Non-trivial tests using MathContext: + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "add", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) + @KnownFailure("Fix in BigDecimal.inplaceRound") + public void testAddMathContextNonTrivial() { + MathContext mc; + BigDecimal a, b, res; + + mc = new MathContext(17, RoundingMode.FLOOR); + a = new BigDecimal("123456789012345.678"); + b = new BigDecimal("100000000000000.009"); + assertEquals("incorrect value", "123456789012345.67", + a.round(mc).toString()); + assertEquals("incorrect value", "100000000000000.00", + b.round(mc).toString()); + assertEquals("incorrect value", "223456789012345.67", + a.round(mc).add(b.round(mc)).toString()); + res = a.add(b, mc); + assertEquals("incorrect value", "223456789012345.68", res.toString()); + + mc = new MathContext(33, RoundingMode.UNNECESSARY); + a = new BigDecimal("1234567890123456789012345678.9012395"); + b = new BigDecimal("1000000000000000090000000000.0000005"); + res = a.add(b, mc); + assertEquals("Incorrect value!", "2234567890123456879012345678.90124", res.toString()); + assertEquals("Incorrect scale!", 5, res.scale()); + assertEquals("Incorrect precision!", 33, res.precision()); + } + + /** * Subtract two numbers of equal positive scales */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method.", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method.", + method = "subtract", + args = {java.math.BigDecimal.class} + ) public void testSubtractEqualScalePosPos() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 10; @@ -276,15 +283,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Subtract two numbers of equal positive scales using MathContext */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "subtract", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testSubtractMathContextEqualScalePosPos() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 10; @@ -303,15 +307,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Subtract two numbers of equal negative scales */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method.", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method.", + method = "subtract", + args = {java.math.BigDecimal.class} + ) public void testSubtractEqualScaleNegNeg() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = -10; @@ -329,15 +330,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Subtract two numbers of different scales; the first is positive */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method.", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method.", + method = "subtract", + args = {java.math.BigDecimal.class} + ) public void testSubtractDiffScalePosNeg() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 15; @@ -356,15 +354,12 @@ public class BigDecimalArithmeticTest extends TestCase { * Subtract two numbers of different scales using MathContext; * the first is positive */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "subtract", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testSubtractMathContextDiffScalePosNeg() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 15; @@ -383,15 +378,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Subtract two numbers of different scales; the first is negative */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method.", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method.", + method = "subtract", + args = {java.math.BigDecimal.class} + ) public void testSubtractDiffScaleNegPos() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = -15; @@ -410,15 +402,12 @@ public class BigDecimalArithmeticTest extends TestCase { * Subtract two numbers of different scales using MathContext; * the first is negative */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "subtract", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testSubtractMathContextDiffScaleNegPos() { String a = "986798656676789766678767876078779810457634781384756794987"; int aScale = -15; @@ -435,17 +424,47 @@ public class BigDecimalArithmeticTest extends TestCase { } /** + * Non-trivial tests using MathContext: + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "subtract", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) + @KnownFailure("Fix in BigDecimal.inplaceRound") + public void testSubtractMathContextNonTrivial() { + MathContext mc; + BigDecimal a, b, res; + + mc = new MathContext(17, RoundingMode.FLOOR); + a = new BigDecimal("12345678901234567.8"); + b = new BigDecimal("10000000000000000.9"); + assertEquals("incorrect value", "2345678901234567", + a.round(mc).subtract(b.round(mc)).toString()); + res = a.subtract(b, mc); + assertEquals("incorrect value", "2345678901234566.9", res.toString()); + assertEquals("Incorrect scale!", 1, res.scale()); + assertEquals("Incorrect precision!", 17, res.precision()); + + mc = new MathContext(33, RoundingMode.UNNECESSARY); + a = new BigDecimal("1234567890123456789012345678.9012395"); + b = new BigDecimal("1000000000000000090000000000.0000005"); + res = a.subtract(b, mc); + assertEquals("incorrect value", "234567890123456699012345678.901239", res.toString()); + assertEquals("Incorrect scale!", 6, res.scale()); + assertEquals("Incorrect precision!", 33, res.precision()); + } + + /** * Multiply two numbers of positive scales */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method.", + method = "multiply", + args = {java.math.BigDecimal.class} + ) public void testMultiplyScalePosPos() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 15; @@ -463,15 +482,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Multiply two numbers of positive scales using MathContext */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "multiply", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testMultiplyMathContextScalePosPos() { String a = "97665696756578755423325476545428779810457634781384756794987"; int aScale = -25; @@ -490,15 +506,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Multiply two numbers of negative scales */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method.", + method = "multiply", + args = {java.math.BigDecimal.class} + ) public void testMultiplyEqualScaleNegNeg() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = -15; @@ -516,15 +529,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Multiply two numbers of different scales */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method.", + method = "multiply", + args = {java.math.BigDecimal.class} + ) public void testMultiplyDiffScalePosNeg() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 10; @@ -542,15 +552,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Multiply two numbers of different scales using MathContext */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "multiply", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testMultiplyMathContextDiffScalePosNeg() { String a = "987667796597975765768768767866756808779810457634781384756794987"; int aScale = 100; @@ -569,15 +576,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Multiply two numbers of different scales */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method.", + method = "multiply", + args = {java.math.BigDecimal.class} + ) public void testMultiplyDiffScaleNegPos() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = -15; @@ -595,15 +599,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Multiply two numbers of different scales using MathContext */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "multiply", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testMultiplyMathContextDiffScaleNegPos() { String a = "488757458676796558668876576576579097029810457634781384756794987"; int aScale = -63; @@ -620,17 +621,41 @@ public class BigDecimalArithmeticTest extends TestCase { } /** + * Non-trivial tests using MathContext: + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "multiply", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) + @KnownFailure("Fix in BigDecimal.inplaceRound") + public void testMultiplyMathContextNonTrivial() { + MathContext mc; + BigDecimal a, b, res; + + mc = new MathContext(17, RoundingMode.FLOOR); + a = new BigDecimal("92345678901234567.8"); + b = new BigDecimal("10000000000000000.9"); + res = a.round(mc).multiply(b.round(mc)); + assertEquals("incorrect value", "923456789012345670000000000000000", res.toString()); + res = res.round(mc); + assertEquals("incorrect value", "9.2345678901234567E+32", res.toString()); + res = a.multiply(b, mc); + assertEquals("incorrect value", "9.2345678901234576E+32", res.toString()); + assertEquals("Incorrect scale!", -16, res.scale()); + assertEquals("Incorrect precision!", 17, res.precision()); + } + + /** * pow(int) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "pow", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "pow", + args = {int.class} + ) public void testPow() { String a = "123121247898748298842980"; int aScale = 10; @@ -649,15 +674,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * pow(0) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "pow", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "pow", + args = {int.class} + ) public void testPow0() { String a = "123121247898748298842980"; int aScale = 10; @@ -673,15 +695,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * ZERO.pow(0) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "pow", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "pow", + args = {int.class} + ) public void testZeroPow0() { String c = "1"; int cScale = 0; @@ -691,17 +710,41 @@ public class BigDecimalArithmeticTest extends TestCase { } /** + * Non-trivial tests using MathContext: + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "pow", + args = {int.class} + ) + public void testPowNonTrivial() { + BigDecimal a, b, res; + + a = new BigDecimal("100.9"); + try { + res = a.pow(-1); + fail("ArithmeticException is not thrown for negative exponent"); + } catch (ArithmeticException e) { + // expected + } + try { + res = a.pow(-103); + fail("ArithmeticException is not thrown for negative exponent"); + } catch (ArithmeticException e) { + // expected + } + } + + /** * pow(int, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "pow", - methodArgs = {int.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "pow", + args = {int.class, java.math.MathContext.class} + ) public void testPowMathContext() { String a = "123121247898748298842980"; int aScale = 10; @@ -716,17 +759,89 @@ public class BigDecimalArithmeticTest extends TestCase { } /** + * Non-trivial tests using MathContext: + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "pow", + args = {int.class, java.math.MathContext.class} + ) + @KnownFailure("Fix in BigDecimal.inplaceRound") + public void testPowMathContextNonTrivial() { + MathContext mc; + BigDecimal a, b, res; + + mc = new MathContext(7, RoundingMode.FLOOR); + a = new BigDecimal("1000000.9"); + assertEquals("incorrect value", "1.000000E+6000", + a.round(mc).pow(1000).round(mc).toString()); + res = a.pow(1000, mc); + assertEquals("incorrect value", "1.000900E+6000", res.toString()); + + mc = new MathContext(4, RoundingMode.FLOOR); + a = new BigDecimal("1000.9"); + assertEquals("incorrect value", "1.000E+3000", + a.round(mc).pow(1000).round(mc).toString()); + res = a.pow(1000, mc); + assertEquals("incorrect value", "2.458E+3000", res.toString()); + + mc = new MathContext(2, RoundingMode.UNNECESSARY); + a = new BigDecimal("1234"); + try { + res = a.pow(-2, mc); + fail("ArithmeticException is not thrown"); + } catch (ArithmeticException e) { + // expected + } + + a = new BigDecimal("100"); + mc = new MathContext(4, RoundingMode.UNNECESSARY); + res = a.pow(-2, mc); + assertEquals("incorrect value", "0.0001", res.toString()); + + a = new BigDecimal("1000.9"); + try { + mc = new MathContext(0, RoundingMode.FLOOR); + res = a.pow(-1, mc); + fail("ArithmeticException is not thrown for negative exponent and precision = 0"); + } catch (ArithmeticException e) { + // expected + } + + a = new BigDecimal("000.0001"); + try { + mc = new MathContext(0, RoundingMode.FLOOR); + res = a.pow(-1, mc); + fail("ArithmeticException is not thrown for negative exponent and precision = 0"); + } catch (ArithmeticException e) { + // expected + } + + a = new BigDecimal("1E-400"); + mc = new MathContext(4, RoundingMode.UNNECESSARY); + res = a.pow(-1, mc); + assertEquals("incorrect value", "1E+400", res.toString()); + +// Doesn't succeed against JDK of Sun!: +// mc = new MathContext(3, RoundingMode.FLOOR); +// a = new BigDecimal("100.9"); +// assertEquals("incorrect value", "1.00E+2000", +// a.round(mc).pow(1000).round(mc).toString()); +// res = a.pow(1000).round(mc); +// res = a.pow(1000, mc); +// assertEquals("incorrect value", "7.783E+2003", res.toString()); + } + + /** * Divide by zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "ArithmeticException checked.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "ArithmeticException checked.", + method = "divide", + args = {java.math.BigDecimal.class} + ) public void testDivideByZero() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 15; @@ -743,15 +858,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide with ROUND_UNNECESSARY */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException only checked.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException only checked.", + method = "divide", + args = {java.math.BigDecimal.class, int.class} + ) public void testDivideExceptionRM() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 15; @@ -770,15 +882,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide with invalid rounding mode */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "IllegalArgumentException only checked.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "IllegalArgumentException only checked.", + method = "divide", + args = {java.math.BigDecimal.class, int.class} + ) public void testDivideExceptionInvalidRM() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 15; @@ -795,17 +904,51 @@ public class BigDecimalArithmeticTest extends TestCase { } /** + * Non-trivial tests using MathContext: + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "divide", + args = {java.math.BigDecimal.class, int.class} + ) + @KnownFailure("Fix in BigDecimal.inplaceRound") + public void testDivideINonTrivial() { + MathContext mc; + BigDecimal a, b, res; + + mc = new MathContext(17, RoundingMode.FLOOR); + a = new BigDecimal("12345678901234567E1234"); + b = new BigDecimal("1.23456789012345679"); + assertEquals("incorrect value", "1E+1250", + a.round(mc).divide(b.round(mc)).toString()); + res = a.divide(b, BigDecimal.ROUND_FLOOR); + assertEquals("incorrect value", "9.999999999999999E+1249", res.toString()); + + a = new BigDecimal("1234567890123456789012345678.9012395"); + b = new BigDecimal("6172839450617283945061728394.5061975"); + res = a.divide(b, BigDecimal.ROUND_UNNECESSARY); + assertEquals("incorrect value", "0.2000000", res.toString()); + + a = new BigDecimal("1234567890123456789012345678.9012395"); + b = new BigDecimal("1000000000000000090000000000.0000005"); + try { + res = a.divide(b, BigDecimal.ROUND_UNNECESSARY); + fail("ArithmeticException is not thrown for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + } + + /** * Divide: local variable exponent is less than zero */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideExpLessZero() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 15; @@ -823,15 +966,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: local variable exponent is equal to zero */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed. Should be added checking for ArithmeticException to complete functional testing.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed. Should be added checking for ArithmeticException to complete functional testing.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideExpEqualsZero() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = -15; @@ -849,15 +989,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: local variable exponent is greater than zero */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideExpGreaterZero() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = -15; @@ -875,15 +1012,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: remainder is zero */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRemainderIsZero() { String a = "8311389578904553209874735431110"; int aScale = -15; @@ -901,15 +1035,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_UP, result is negative */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundUpNeg() { String a = "-92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -927,15 +1058,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_UP, result is positive */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundUpPos() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -953,15 +1081,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_DOWN, result is negative */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundDownNeg() { String a = "-92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -979,15 +1104,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_DOWN, result is positive */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundDownPos() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -1005,15 +1127,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_FLOOR, result is positive */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundFloorPos() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -1031,15 +1150,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_FLOOR, result is negative */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundFloorNeg() { String a = "-92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -1057,15 +1173,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_CEILING, result is positive */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundCeilingPos() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -1083,15 +1196,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_CEILING, result is negative */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundCeilingNeg() { String a = "-92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -1109,15 +1219,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_HALF_UP, result is positive; distance = -1 */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundHalfUpPos() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -1135,15 +1242,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_HALF_UP, result is negative; distance = -1 */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundHalfUpNeg() { String a = "-92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -1161,15 +1265,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_HALF_UP, result is positive; distance = 1 */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundHalfUpPos1() { String a = "92948782094488478231212478987482988798104576347813847567949855464535634534563456"; int aScale = -24; @@ -1187,15 +1288,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_HALF_UP, result is negative; distance = 1 */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundHalfUpNeg1() { String a = "-92948782094488478231212478987482988798104576347813847567949855464535634534563456"; int aScale = -24; @@ -1213,15 +1311,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_HALF_UP, result is negative; equidistant */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundHalfUpNeg2() { String a = "-37361671119238118911893939591735"; int aScale = 10; @@ -1239,15 +1334,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_HALF_DOWN, result is positive; distance = -1 */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundHalfDownPos() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -1265,15 +1357,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_HALF_DOWN, result is negative; distance = -1 */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundHalfDownNeg() { String a = "-92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -1291,15 +1380,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_HALF_DOWN, result is positive; distance = 1 */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundHalfDownPos1() { String a = "92948782094488478231212478987482988798104576347813847567949855464535634534563456"; int aScale = -24; @@ -1317,15 +1403,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_HALF_DOWN, result is negative; distance = 1 */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundHalfDownNeg1() { String a = "-92948782094488478231212478987482988798104576347813847567949855464535634534563456"; int aScale = -24; @@ -1343,15 +1426,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_HALF_UP, result is negative; equidistant */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundHalfDownNeg2() { String a = "-37361671119238118911893939591735"; int aScale = 10; @@ -1369,15 +1449,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_HALF_EVEN, result is positive; distance = -1 */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundHalfEvenPos() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -1395,15 +1472,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_HALF_EVEN, result is negative; distance = -1 */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundHalfEvenNeg() { String a = "-92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -1421,15 +1495,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_HALF_EVEN, result is positive; distance = 1 */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundHalfEvenPos1() { String a = "92948782094488478231212478987482988798104576347813847567949855464535634534563456"; int aScale = -24; @@ -1447,15 +1518,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_HALF_EVEN, result is negative; distance = 1 */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundHalfEvenNeg1() { String a = "-92948782094488478231212478987482988798104576347813847567949855464535634534563456"; int aScale = -24; @@ -1473,15 +1541,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide: rounding mode is ROUND_HALF_EVEN, result is negative; equidistant */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ROUND_UNNECESSARY and exceptions checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ROUND_UNNECESSARY and exceptions checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void testDivideRoundHalfEvenNeg2() { String a = "-37361671119238118911893939591735"; int aScale = 10; @@ -1497,17 +1562,48 @@ public class BigDecimalArithmeticTest extends TestCase { } /** + * Non-trivial tests using MathContext: + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) + public void testDivideIINonTrivial() { + MathContext mc; + BigDecimal a, b, res; + + mc = new MathContext(17, RoundingMode.FLOOR); + a = new BigDecimal("12345678901234567E1234"); + b = new BigDecimal("1.23456789012345679"); + res = a.divide(b, -1220, BigDecimal.ROUND_FLOOR); + assertEquals("incorrect value", "9.99999999999999927099999343899E+1249", res.toString()); + + a = new BigDecimal("1234567890123456789012345678.9012395"); + b = new BigDecimal("6172839450617283945061728394.5061975"); + res = a.divide(b, 1, BigDecimal.ROUND_UNNECESSARY); + assertEquals("incorrect value", "0.2", res.toString()); + + a = new BigDecimal("1234567890123456789012345678.9012395"); + b = new BigDecimal("6172839450617283945061728394.5061975"); + try { + res = a.divide(b, 0, BigDecimal.ROUND_UNNECESSARY); + fail("ArithmeticException is not thrown for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + } + + /** * Divide to BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Common functionality checked", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Common functionality checked", + method = "divide", + args = {java.math.BigDecimal.class} + ) public void testDivideBigDecimal1() { String a = "-37361671119238118911893939591735"; int aScale = 10; @@ -1525,15 +1621,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * Divide to BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Common functionality checked", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Common functionality checked", + method = "divide", + args = {java.math.BigDecimal.class} + ) public void testDivideBigDecimal2() { String a = "-37361671119238118911893939591735"; int aScale = 10; @@ -1551,15 +1644,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divide(BigDecimal, scale, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException and UNNECESSARY round mode checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, java.math.RoundingMode.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException and UNNECESSARY round mode checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, java.math.RoundingMode.class} + ) public void testDivideBigDecimalScaleRoundingModeUP() { String a = "-37361671119238118911893939591735"; int aScale = 10; @@ -1578,15 +1668,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divide(BigDecimal, scale, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException and UNNECESSARY round mode checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, java.math.RoundingMode.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException and UNNECESSARY round mode checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, java.math.RoundingMode.class} + ) public void testDivideBigDecimalScaleRoundingModeDOWN() { String a = "-37361671119238118911893939591735"; int aScale = 10; @@ -1605,15 +1692,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divide(BigDecimal, scale, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException and UNNECESSARY round mode checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, java.math.RoundingMode.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException and UNNECESSARY round mode checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, java.math.RoundingMode.class} + ) public void testDivideBigDecimalScaleRoundingModeCEILING() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 100; @@ -1632,15 +1716,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divide(BigDecimal, scale, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException and UNNECESSARY round mode checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, java.math.RoundingMode.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException and UNNECESSARY round mode checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, java.math.RoundingMode.class} + ) public void testDivideBigDecimalScaleRoundingModeFLOOR() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 100; @@ -1659,15 +1740,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divide(BigDecimal, scale, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException and UNNECESSARY round mode checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, java.math.RoundingMode.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException and UNNECESSARY round mode checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, java.math.RoundingMode.class} + ) public void testDivideBigDecimalScaleRoundingModeHALF_UP() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = -51; @@ -1688,15 +1766,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divide(BigDecimal, scale, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException and UNNECESSARY round mode checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, java.math.RoundingMode.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException and UNNECESSARY round mode checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, java.math.RoundingMode.class} + ) public void testDivideBigDecimalScaleRoundingModeHALF_DOWN() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 5; @@ -1715,15 +1790,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divide(BigDecimal, scale, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException and UNNECESSARY round mode checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, java.math.RoundingMode.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException and UNNECESSARY round mode checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, java.math.RoundingMode.class} + ) public void testDivideBigDecimalScaleRoundingModeHALF_EVEN() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 5; @@ -1740,17 +1812,53 @@ public class BigDecimalArithmeticTest extends TestCase { } /** + * Non-trivial tests using MathContext: + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "divide", + args = {java.math.BigDecimal.class, int.class, java.math.RoundingMode.class} + ) + @KnownFailure("Fix in BigDecimal.inplaceRound IS INSUFFICIENT!!!") + public void testDivideScaleRoundingModeNonTrivial() { + MathContext mc; + BigDecimal a, b, res; + + mc = new MathContext(17, RoundingMode.FLOOR); + a = new BigDecimal("12345678901234567.1"); + b = new BigDecimal("12345678901234567.9"); + assertEquals("incorrect value", "1", + a.round(mc).divide(b.round(mc)).toString()); + res = a.divide(b, mc); + assertEquals("incorrect value", "0.99999999999999993", res.toString()); + + mc = new MathContext(13, RoundingMode.UNNECESSARY); + a = new BigDecimal("1234567890123456789012345678.9012395"); + b = new BigDecimal("6172839450617283945061728394.5061975"); + res = a.divide(b, mc); + assertEquals("incorrect value", "0.2", res.toString()); + + mc = new MathContext(33, RoundingMode.UNNECESSARY); + a = new BigDecimal("1234567890123456789012345678.9012395"); + b = new BigDecimal("1000000000000000090000000000.0000005"); + try { + res = a.divide(b, mc); + fail("ArithmeticException is not thrown for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + } + + /** * divide(BigDecimal, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testDivideBigDecimalScaleMathContextUP() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 15; @@ -1771,15 +1879,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divide(BigDecimal, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testDivideBigDecimalScaleMathContextDOWN() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 15; @@ -1800,15 +1905,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divide(BigDecimal, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testDivideBigDecimalScaleMathContextCEILING() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 15; @@ -1829,15 +1931,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divide(BigDecimal, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testDivideBigDecimalScaleMathContextFLOOR() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 15; @@ -1858,15 +1957,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divide(BigDecimal, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testDivideBigDecimalScaleMathContextHALF_UP() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 45; @@ -1887,15 +1983,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divide(BigDecimal, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testDivideBigDecimalScaleMathContextHALF_DOWN() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 45; @@ -1916,15 +2009,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divide(BigDecimal, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "divide", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testDivideBigDecimalScaleMathContextHALF_EVEN() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 45; @@ -1943,17 +2033,70 @@ public class BigDecimalArithmeticTest extends TestCase { } /** + * Non-trivial tests using MathContext: + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "divide", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) + @KnownFailure("Fix in BigDecimal.inplaceRound IS INSUFFICIENT!!!") + public void testDivideMathContextNonTrivial() { + MathContext mc; + BigDecimal a, b, res; + +// FAILS AGAINST RI!: +// mc = new MathContext(6, RoundingMode.FLOOR); +// a = new BigDecimal("12345.1"); +// b = new BigDecimal("12345.9"); +// assertEquals("incorrect value", "1", +// a.round(mc).divide(b.round(mc)).toString()); +// res = a.divide(b, mc); +// assertEquals("incorrect value", "0.99993", res.toString()); + + mc = new MathContext(5, RoundingMode.FLOOR); + a = new BigDecimal("12345.1"); + b = new BigDecimal("12345.9"); + assertEquals("incorrect value", "1", + a.round(mc).divide(b.round(mc)).toString()); + res = a.divide(b, mc); + assertEquals("incorrect value", "0.99993", res.toString()); + + mc = new MathContext(17, RoundingMode.FLOOR); + a = new BigDecimal("12345678901234567.1"); + b = new BigDecimal("12345678901234567.9"); + assertEquals("incorrect value", "1", + a.round(mc).divide(b.round(mc)).toString()); + res = a.divide(b, mc); + assertEquals("incorrect value", "0.99999999999999993", res.toString()); + assertEquals("incorrect value", res.round(mc).toString(), res.toString()); + + mc = new MathContext(13, RoundingMode.UNNECESSARY); + a = new BigDecimal("1234567890123456789012345678.9012395"); + b = new BigDecimal("6172839450617283945061728394.5061975"); + res = a.divide(b, mc); + assertEquals("incorrect value", "0.2", res.toString()); + + mc = new MathContext(33, RoundingMode.UNNECESSARY); + a = new BigDecimal("1234567890123456789012345678.9012395"); + b = new BigDecimal("1000000000000000090000000000.0000005"); + try { + res = a.divide(b, mc); + fail("ArithmeticException is not thrown for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + } + + /** * divideToIntegralValue(BigDecimal) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "divideToIntegralValue", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "divideToIntegralValue", + args = {java.math.BigDecimal.class} + ) public void testDivideToIntegralValue() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 45; @@ -1968,18 +2111,39 @@ public class BigDecimalArithmeticTest extends TestCase { assertEquals("incorrect scale", resScale, result.scale()); } + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "divideToIntegralValue", + args = {java.math.BigDecimal.class} + ) + public void testDivideToIntegralValueByZero() { + String a = "3736186567876876578956958765675671119238118911893939591735"; + int aScale = 45; + String b = "0"; + int bScale = -70; + String res = "277923185514690367474770683"; + int resScale = 0; + String rem = "1.3032693871288309587558885943391070087960319452465789990E-15"; + int remScale = 70; + BigDecimal aNumber = new BigDecimal(new BigInteger(a), aScale); + BigDecimal bNumber = new BigDecimal(new BigInteger(b), bScale); + try { + BigDecimal result = aNumber.divideToIntegralValue(bNumber); + fail("ArithmeticException not thrown for division by 0"); + } catch (ArithmeticException e) { + // expected + } + } + /** * divideToIntegralValue(BigDecimal, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "divideToIntegralValue", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "divideToIntegralValue", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testDivideToIntegralValueMathContextUP() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 45; @@ -2000,15 +2164,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divideToIntegralValue(BigDecimal, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "divideToIntegralValue", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "divideToIntegralValue", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testDivideToIntegralValueMathContextDOWN() { String a = "3736186567876876578956958769675785435673453453653543654354365435675671119238118911893939591735"; int aScale = 45; @@ -2027,17 +2188,56 @@ public class BigDecimalArithmeticTest extends TestCase { } /** + * Non-trivial tests using MathContext: + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "divideToIntegralValue", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) + @KnownFailure("Fix in BigDecimal.inplaceRound") + public void testDivideToIntegralValueMathContextNonTrivial() { + MathContext mc; + BigDecimal a, b, res; + + a = new BigDecimal("92345678901234567.8"); + b = new BigDecimal("43"); + res = a.multiply(b); + assertEquals("incorrect value", "3970864192753086415.4", res.toString()); + + mc = new MathContext(20, RoundingMode.DOWN); + a = new BigDecimal("3970864192753086415.4"); + b = new BigDecimal("92345678901234567.8"); + b = new BigDecimal("92345678901234567.8001"); + assertEquals("incorrect value", "43", + a.round(mc).divideToIntegralValue(b.round(mc)).toString()); + res = a.divideToIntegralValue(b, mc); + assertEquals("incorrect value", "42", res.toString()); + +// mc = new MathContext(1, RoundingMode.DOWN); +// res = a.divideToIntegralValue(b, mc); +// assertEquals("incorrect value", "42", res.toString()); + + + mc = new MathContext(17, RoundingMode.FLOOR); + a = new BigDecimal("518518513851851830"); + b = new BigDecimal("12345678901234567.9"); + assertEquals("incorrect value", "42", + a.round(mc).divideToIntegralValue(b.round(mc)).toString()); + res = a.divideToIntegralValue(b, mc); + assertEquals("incorrect value", "41", res.toString()); + } + + /** * divideAndRemainder(BigDecimal) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "divideAndRemainder", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "divideAndRemainder", + args = {java.math.BigDecimal.class} + ) public void testDivideAndRemainder1() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 45; @@ -2059,15 +2259,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divideAndRemainder(BigDecimal) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "divideAndRemainder", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "divideAndRemainder", + args = {java.math.BigDecimal.class} + ) public void testDivideAndRemainder2() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = -45; @@ -2089,17 +2286,42 @@ public class BigDecimalArithmeticTest extends TestCase { } /** + * divideAndRemainder(BigDecimal) + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "divideAndRemainder", + args = {java.math.BigDecimal.class} + ) + public void testDivideAndRemainderByZero() { + String a = "3736186567876876578956958765675671119238118911893939591735"; + int aScale = 45; + String b = "0"; + int bScale = -70; + String res = "277923185514690367474770683"; + int resScale = 0; + String rem = "1.3032693871288309587558885943391070087960319452465789990E-15"; + int remScale = 70; + BigDecimal aNumber = new BigDecimal(new BigInteger(a), aScale); + BigDecimal bNumber = new BigDecimal(new BigInteger(b), bScale); + try { + BigDecimal result[] = aNumber.divideAndRemainder(bNumber); + fail("ArithmeticException not thrown for division by 0"); + } catch (ArithmeticException e) { + // expected + } + } + + /** * divideAndRemainder(BigDecimal, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "divideAndRemainder", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "divideAndRemainder", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testDivideAndRemainderMathContextUP() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 45; @@ -2124,15 +2346,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * divideAndRemainder(BigDecimal, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "divideAndRemainder", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "divideAndRemainder", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testDivideAndRemainderMathContextDOWN() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 45; @@ -2155,17 +2374,54 @@ public class BigDecimalArithmeticTest extends TestCase { } /** + * Non-trivial tests using MathContext: + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "divideAndRemainder", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) + @KnownFailure("WHY ISN'T THE LAST VALUE ROUNDED?") + public void testDivideAndRemainderMathContextNonTrivial() { + MathContext mc; + BigDecimal a, b, res[]; + + mc = new MathContext(13, RoundingMode.FLOOR); + a = new BigDecimal("12345678901234567.1"); + b = new BigDecimal("12345678901234567.9"); + assertEquals("incorrect value", "0E+4", + a.round(mc).divideAndRemainder(b.round(mc))[1].toString()); + res = a.divideAndRemainder(b, mc); + assertEquals("incorrect value", "12345678901234567.1", res[1].toString()); + + mc = new MathContext(1, RoundingMode.UNNECESSARY); + a = new BigDecimal("6172839450617283945061728394.5061976"); + b = new BigDecimal("1234567890123456789012345678.9012395"); + res = a.divideAndRemainder(b, mc); + assertEquals("incorrect value", "1E-7", res[1].toString()); + + mc = new MathContext(3, RoundingMode.UNNECESSARY); + a = new BigDecimal("6172839450617283945061728394.6000000"); + b = new BigDecimal("1234567890123456789012345678.9012395"); + try { + res = a.divideAndRemainder(b, mc); + assertEquals("incorrect value", "0.0938025", res[1].toString()); + assertEquals("incorrect value", "0.09", res[1].round(mc).toString()); +// fail("ArithmeticException is not thrown for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + } + + /** * remainder(BigDecimal) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "remainder", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "remainder", + args = {java.math.BigDecimal.class} + ) public void testRemainder1() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 45; @@ -2183,15 +2439,11 @@ public class BigDecimalArithmeticTest extends TestCase { /** * remainder(BigDecimal) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "remainder", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "remainder", + args = {java.math.BigDecimal.class} + ) public void testRemainder2() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = -45; @@ -2206,18 +2458,38 @@ public class BigDecimalArithmeticTest extends TestCase { assertEquals("incorrect quotient scale", resScale, result.scale()); } + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "remainder", + args = {java.math.BigDecimal.class} + ) + public void testRemainderByZero() { + String a = "3736186567876876578956958765675671119238118911893939591735"; + int aScale = 45; + String b = "0"; + int bScale = -70; + String res = "277923185514690367474770683"; + int resScale = 0; + String rem = "1.3032693871288309587558885943391070087960319452465789990E-15"; + int remScale = 70; + BigDecimal aNumber = new BigDecimal(new BigInteger(a), aScale); + BigDecimal bNumber = new BigDecimal(new BigInteger(b), bScale); + try { + BigDecimal result = aNumber.remainder(bNumber); + fail("ArithmeticException not thrown for division by 0"); + } catch (ArithmeticException e) { + // expected + } + } /** * remainder(BigDecimal, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "remainder", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "remainder", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testRemainderMathContextHALF_UP() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 45; @@ -2238,15 +2510,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * remainder(BigDecimal, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "remainder", - methodArgs = {java.math.BigDecimal.class, java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "remainder", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) public void testRemainderMathContextHALF_DOWN() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = -45; @@ -2265,17 +2534,55 @@ public class BigDecimalArithmeticTest extends TestCase { } /** + * Non-trivial tests using MathContext: + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "remainder", + args = {java.math.BigDecimal.class, java.math.MathContext.class} + ) + @KnownFailure("WHY ISN'T THE LAST VALUE ROUNDED?") + public void testRemainderMathContextNonTrivial() { + MathContext mc; + BigDecimal a, b, res; + + mc = new MathContext(13, RoundingMode.DOWN); + a = new BigDecimal("12345678901234567.1"); + b = new BigDecimal("12345678901234567.9"); + assertEquals("incorrect value", "0E+4", + a.round(mc).divideAndRemainder(b.round(mc))[1].toString()); + res = a.remainder(b, mc); + assertEquals("incorrect value", "12345678901234567.1", res.toString()); + + mc = new MathContext(1, RoundingMode.UNNECESSARY); + a = new BigDecimal("6172839450617283945061728394.5061976"); + b = new BigDecimal("1234567890123456789012345678.9012395"); + res = a.remainder(b, mc); + assertEquals("incorrect value", "1E-7", res.toString()); + + mc = new MathContext(3, RoundingMode.UNNECESSARY); + a = new BigDecimal("6172839450617283945061728394.6000000"); + b = new BigDecimal("1234567890123456789012345678.9012395"); + try { + res = a.remainder(b, mc); + assertEquals("incorrect value", "0.0938025", res.toString()); + assertEquals("incorrect value", "0.09", res.round(mc).toString()); +// fail("ArithmeticException is not thrown for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + } + + /** * round(BigDecimal, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "round", - methodArgs = {java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "round", + args = {java.math.MathContext.class} + ) public void testRoundMathContextHALF_DOWN() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = -45; @@ -2293,15 +2600,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * round(BigDecimal, MathContext) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "round", - methodArgs = {java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "round", + args = {java.math.MathContext.class} + ) public void testRoundMathContextHALF_UP() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 45; @@ -2319,15 +2623,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * round(BigDecimal, MathContext) when precision = 0 */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "round", - methodArgs = {java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "round", + args = {java.math.MathContext.class} + ) public void testRoundMathContextPrecision0() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 45; @@ -2341,18 +2642,68 @@ public class BigDecimalArithmeticTest extends TestCase { assertEquals("incorrect quotient scale", aScale, result.scale()); } + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "round", + args = {java.math.MathContext.class} + ) + public void testRoundNonTrivial() { + MathContext mc; + String biStr = new String( "12345678901234567890123456789012345.0E+10"); + String nbiStr = new String("-12345678901234567890123456789012345.E+10"); + BigDecimal bd; + + mc = new MathContext(17, RoundingMode.FLOOR); + bd = new BigDecimal(new BigInteger("123456789012345678"), 3, mc); + assertEquals("incorrect value", "123456789012345.67", bd.toString()); + + mc = new MathContext(31, RoundingMode.UP); + bd = (new BigDecimal(biStr)).round(mc); + assertEquals("incorrect value", "1.234567890123456789012345678902E+44", bd.toString()); + bd = (new BigDecimal(nbiStr)).round(mc); + assertEquals("incorrect value", "-1.234567890123456789012345678902E+44", bd.toString()); + + mc = new MathContext(28, RoundingMode.DOWN); + bd = (new BigDecimal(biStr)).round(mc); + assertEquals("incorrect value", "1.234567890123456789012345678E+44", bd.toString()); + bd = (new BigDecimal(nbiStr)).round(mc); + assertEquals("incorrect value", "-1.234567890123456789012345678E+44", bd.toString()); + + mc = new MathContext(33, RoundingMode.CEILING); + bd = (new BigDecimal(biStr)).round(mc); + assertEquals("incorrect value", "1.23456789012345678901234567890124E+44", bd.toString()); + bd = (new BigDecimal(nbiStr)).round(mc); + assertEquals("incorrect value", "-1.23456789012345678901234567890123E+44", bd.toString()); + + mc = new MathContext(34, RoundingMode.UNNECESSARY); + try { + bd = (new BigDecimal(biStr)).round(mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + try { + bd = (new BigDecimal(nbiStr)).round(mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + + mc = new MathContext(7, RoundingMode.FLOOR); + bd = new BigDecimal("1000000.9", mc); + assertEquals("incorrect value", "1000000", bd.toString()); + } + /** * ulp() of a positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for ulp method.", - targets = { - @TestTarget( - methodName = "ulp", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for ulp method.", + method = "ulp", + args = {} + ) public void testUlpPos() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = -45; @@ -2367,15 +2718,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * ulp() of a negative BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for ulp method.", - targets = { - @TestTarget( - methodName = "ulp", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for ulp method.", + method = "ulp", + args = {} + ) public void testUlpNeg() { String a = "-3736186567876876578956958765675671119238118911893939591735"; int aScale = 45; @@ -2390,15 +2738,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * ulp() of a negative BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for ulp method.", - targets = { - @TestTarget( - methodName = "ulp", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for ulp method.", + method = "ulp", + args = {} + ) public void testUlpZero() { String a = "0"; int aScale = 2; @@ -2415,15 +2760,12 @@ public class BigDecimalArithmeticTest extends TestCase { /** * @tests java.math.BigDecimal#add(java.math.BigDecimal) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigDecimal.class} + ) public void test_addBigDecimal() { BigDecimal add1 = new BigDecimal("23.456"); BigDecimal add2 = new BigDecimal("3849.235"); @@ -2442,15 +2784,12 @@ public class BigDecimalArithmeticTest extends TestCase { * @tests java.math.BigDecimal#divide(java.math.BigDecimal, * java.math.MathContext) divide(BigDecimal, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, java.math.RoundingMode.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigDecimal.class, java.math.RoundingMode.class} + ) public void test_DivideBigDecimalRoundingModeUP() { String a = "-37361671119238118911893939591735"; String b = "74723342238476237823787879183470"; @@ -2466,15 +2805,12 @@ public class BigDecimalArithmeticTest extends TestCase { * @tests java.math.BigDecimal#divide(java.math.BigDecimal, * java.math.RoundingMode) divide(BigDecimal, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, java.math.RoundingMode.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigDecimal.class, java.math.RoundingMode.class} + ) public void test_DivideBigDecimalRoundingModeDOWN() { String a = "-37361671119238118911893939591735"; String b = "74723342238476237823787879183470"; @@ -2490,15 +2826,12 @@ public class BigDecimalArithmeticTest extends TestCase { * @tests java.math.BigDecimal#divide(java.math.BigDecimal, * java.math.RoundingMode) divide(BigDecimal, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, java.math.RoundingMode.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigDecimal.class, java.math.RoundingMode.class} + ) public void test_DivideBigDecimalRoundingModeCEILING() { String a = "3736186567876876578956958765675671119238118911893939591735"; String b = "74723342238476237823787879183470"; @@ -2514,15 +2847,12 @@ public class BigDecimalArithmeticTest extends TestCase { * @tests java.math.BigDecimal#divide(java.math.BigDecimal, * java.math.RoundingMode) divide(BigDecimal, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, java.math.RoundingMode.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigDecimal.class, java.math.RoundingMode.class} + ) public void test_DivideBigDecimalRoundingModeFLOOR() { String a = "3736186567876876578956958765675671119238118911893939591735"; String b = "74723342238476237823787879183470"; @@ -2538,15 +2868,12 @@ public class BigDecimalArithmeticTest extends TestCase { * @tests java.math.BigDecimal#divide(java.math.BigDecimal, * java.math.RoundingMode) divide(BigDecimal, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, java.math.RoundingMode.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigDecimal.class, java.math.RoundingMode.class} + ) public void test_DivideBigDecimalRoundingModeHALF_UP() { String a = "3736186567876876578956958765675671119238118911893939591735"; String b = "74723342238476237823787879183470"; @@ -2562,15 +2889,12 @@ public class BigDecimalArithmeticTest extends TestCase { * @tests java.math.BigDecimal#divide(java.math.BigDecimal, * java.math.RoundingMode) divide(BigDecimal, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, java.math.RoundingMode.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigDecimal.class, java.math.RoundingMode.class} + ) public void test_DivideBigDecimalRoundingModeHALF_DOWN() { String a = "3736186567876876578956958765675671119238118911893939591735"; int aScale = 5; @@ -2590,15 +2914,12 @@ public class BigDecimalArithmeticTest extends TestCase { * @tests java.math.BigDecimal#divide(java.math.BigDecimal, * java.math.RoundingMode) divide(BigDecimal, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, java.math.RoundingMode.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigDecimal.class, java.math.RoundingMode.class} + ) public void test_DivideBigDecimalRoundingModeHALF_EVEN() { String a = "3736186567876876578956958765675671119238118911893939591735"; String b = "74723342238476237823787879183470"; @@ -2614,15 +2935,12 @@ public class BigDecimalArithmeticTest extends TestCase { * @tests java.math.BigDecimal#divide(java.math.BigDecimal, * java.math.RoundingMode) divide(BigDecimal, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, java.math.RoundingMode.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigDecimal.class, java.math.RoundingMode.class} + ) public void test_DivideBigDecimalRoundingExc() { String a = "3736186567876876578956958765675671119238118911893939591735"; String b = "74723342238476237823787879183470"; diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalCompareTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalCompareTest.java index fe19a93..a1b3202 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalCompareTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalCompareTest.java @@ -19,19 +19,19 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; -import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.KnownFailure; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; + +import junit.framework.TestCase; import java.math.BigDecimal; import java.math.BigInteger; import java.math.MathContext; import java.math.RoundingMode; - -import junit.framework.TestCase; @TestTargetClass(BigDecimal.class) /** * Class: java.math.BigDecimal @@ -42,15 +42,12 @@ public class BigDecimalCompareTest extends TestCase { /** * Abs() of a negative BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for abs method.", - targets = { - @TestTarget( - methodName = "abs", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for abs method.", + method = "abs", + args = {} + ) public void testAbsNeg() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -61,15 +58,12 @@ public class BigDecimalCompareTest extends TestCase { /** * Abs() of a positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for abs method.", - targets = { - @TestTarget( - methodName = "abs", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for abs method.", + method = "abs", + args = {} + ) public void testAbsPos() { String a = "123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -80,15 +74,13 @@ public class BigDecimalCompareTest extends TestCase { /** * Abs(MathContext) of a negative BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "abs", - methodArgs = {java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Together with all other methods including a MathContext these tests for a complete test set.", + method = "abs", + args = {java.math.MathContext.class} + ) + @KnownFailure("Fix in BigDecimal.abs") public void testAbsMathContextNeg() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -100,20 +92,37 @@ public class BigDecimalCompareTest extends TestCase { BigDecimal res = aNumber.abs(mc); assertEquals("incorrect value", result, res.toString()); assertEquals("incorrect scale", resScale, res.scale()); + + mc = new MathContext(34, RoundingMode.UP); + assertEquals("incorrect value", "1.238096483923847545735673567457357E+53", aNumber.abs(mc).toString()); + + mc = new MathContext(34, RoundingMode.DOWN); + assertEquals("incorrect value", "1.238096483923847545735673567457356E+53", aNumber.abs(mc).toString()); + + mc = new MathContext(34, RoundingMode.FLOOR); + assertEquals("incorrect value", "1.238096483923847545735673567457356E+53", aNumber.abs(mc).toString()); + + mc = new MathContext(34, RoundingMode.CEILING); + assertEquals("incorrect value", "1.238096483923847545735673567457357E+53", aNumber.abs(mc).toString()); + + mc = new MathContext(34, RoundingMode.UNNECESSARY); + try { + res = aNumber.abs(mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } } /** * Abs(MathContext) of a positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "abs", - methodArgs = {java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Together with all other methods including a MathContext these tests for a complete test set.", + method = "abs", + args = {java.math.MathContext.class} + ) public void testAbsMathContextPos() { String a = "123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -130,15 +139,12 @@ public class BigDecimalCompareTest extends TestCase { /** * Compare to a number of an equal scale */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigDecimal.class} + ) public void testCompareEqualScale1() { String a = "12380964839238475457356735674573563567890295784902768787678287"; int aScale = 18; @@ -153,15 +159,12 @@ public class BigDecimalCompareTest extends TestCase { /** * Compare to a number of an equal scale */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigDecimal.class} + ) public void testCompareEqualScale2() { String a = "12380964839238475457356735674573563567890295784902768787678287"; int aScale = 18; @@ -176,15 +179,12 @@ public class BigDecimalCompareTest extends TestCase { /** * Compare to a number of an greater scale */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigDecimal.class} + ) public void testCompareGreaterScale1() { String a = "12380964839238475457356735674573563567890295784902768787678287"; int aScale = 28; @@ -199,15 +199,12 @@ public class BigDecimalCompareTest extends TestCase { /** * Compare to a number of an greater scale */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigDecimal.class} + ) public void testCompareGreaterScale2() { String a = "12380964839238475457356735674573563567890295784902768787678287"; int aScale = 48; @@ -222,15 +219,12 @@ public class BigDecimalCompareTest extends TestCase { /** * Compare to a number of an less scale */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigDecimal.class} + ) public void testCompareLessScale1() { String a = "12380964839238475457356735674573563567890295784902768787678287"; int aScale = 18; @@ -245,15 +239,12 @@ public class BigDecimalCompareTest extends TestCase { /** * Compare to a number of an less scale */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigDecimal.class} + ) public void testCompareLessScale2() { String a = "12380964839238475457356735674573"; int aScale = 36; @@ -268,15 +259,12 @@ public class BigDecimalCompareTest extends TestCase { /** * Equals() for unequal BigDecimals */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for equals method.", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for equals method.", + method = "equals", + args = {java.lang.Object.class} + ) public void testEqualsUnequal1() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -290,15 +278,12 @@ public class BigDecimalCompareTest extends TestCase { /** * Equals() for unequal BigDecimals */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for equals method.", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for equals method.", + method = "equals", + args = {java.lang.Object.class} + ) public void testEqualsUnequal2() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -312,15 +297,12 @@ public class BigDecimalCompareTest extends TestCase { /** * Equals() for unequal BigDecimals */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for equals method.", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for equals method.", + method = "equals", + args = {java.lang.Object.class} + ) public void testEqualsUnequal3() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -332,15 +314,12 @@ public class BigDecimalCompareTest extends TestCase { /** * equals() for equal BigDecimals */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for equals method.", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for equals method.", + method = "equals", + args = {java.lang.Object.class} + ) public void testEqualsEqual() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -354,15 +333,12 @@ public class BigDecimalCompareTest extends TestCase { /** * equals() for equal BigDecimals */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for equals method.", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for equals method.", + method = "equals", + args = {java.lang.Object.class} + ) public void testEqualsNull() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -373,15 +349,12 @@ public class BigDecimalCompareTest extends TestCase { /** * hashCode() for equal BigDecimals */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for hashCode method.", - targets = { - @TestTarget( - methodName = "hashCode", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for hashCode method.", + method = "hashCode", + args = {} + ) public void testHashCodeEqual() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = -24; @@ -395,15 +368,12 @@ public class BigDecimalCompareTest extends TestCase { /** * hashCode() for unequal BigDecimals */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for hashCode method.", - targets = { - @TestTarget( - methodName = "hashCode", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for hashCode method.", + method = "hashCode", + args = {} + ) public void testHashCodeUnequal() { String a = "8478231212478987482988429808779810457634781384756794987"; int aScale = 41; @@ -417,15 +387,12 @@ public class BigDecimalCompareTest extends TestCase { /** * max() for equal BigDecimals */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for max method.", - targets = { - @TestTarget( - methodName = "max", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for max method.", + method = "max", + args = {java.math.BigDecimal.class} + ) public void testMaxEqual() { String a = "8478231212478987482988429808779810457634781384756794987"; int aScale = 41; @@ -442,15 +409,12 @@ public class BigDecimalCompareTest extends TestCase { /** * max() for unequal BigDecimals */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for max method.", - targets = { - @TestTarget( - methodName = "max", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for max method.", + method = "max", + args = {java.math.BigDecimal.class} + ) public void testMaxUnequal1() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = 24; @@ -467,15 +431,12 @@ public class BigDecimalCompareTest extends TestCase { /** * max() for unequal BigDecimals */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for max method.", - targets = { - @TestTarget( - methodName = "max", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for max method.", + method = "max", + args = {java.math.BigDecimal.class} + ) public void testMaxUnequal2() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = 41; @@ -492,15 +453,12 @@ public class BigDecimalCompareTest extends TestCase { /** * min() for equal BigDecimals */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for min method.", - targets = { - @TestTarget( - methodName = "min", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for min method.", + method = "min", + args = {java.math.BigDecimal.class} + ) public void testMinEqual() { String a = "8478231212478987482988429808779810457634781384756794987"; int aScale = 41; @@ -517,15 +475,12 @@ public class BigDecimalCompareTest extends TestCase { /** * min() for unequal BigDecimals */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for min method.", - targets = { - @TestTarget( - methodName = "min", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for min method.", + method = "min", + args = {java.math.BigDecimal.class} + ) public void testMinUnequal1() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = 24; @@ -542,15 +497,12 @@ public class BigDecimalCompareTest extends TestCase { /** * min() for unequal BigDecimals */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for min method.", - targets = { - @TestTarget( - methodName = "min", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for min method.", + method = "min", + args = {java.math.BigDecimal.class} + ) public void testMinUnequal2() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = 41; @@ -567,15 +519,12 @@ public class BigDecimalCompareTest extends TestCase { /** * plus() for a positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for plus method.", - targets = { - @TestTarget( - methodName = "plus", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for plus method.", + method = "plus", + args = {} + ) public void testPlusPositive() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = 41; @@ -589,15 +538,12 @@ public class BigDecimalCompareTest extends TestCase { /** * plus(MathContext) for a positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "plus", - methodArgs = {java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Together with all other methods including a MathContext these tests for a complete test set.", + method = "plus", + args = {java.math.MathContext.class} + ) public void testPlusMathContextPositive() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = 41; @@ -615,15 +561,12 @@ public class BigDecimalCompareTest extends TestCase { /** * plus() for a negative BigDecimal */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for plus method.", - targets = { - @TestTarget( - methodName = "plus", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for plus method.", + method = "plus", + args = {} + ) public void testPlusNegative() { String a = "-92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = 41; @@ -637,15 +580,12 @@ public class BigDecimalCompareTest extends TestCase { /** * plus(MathContext) for a negative BigDecimal */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "plus", - methodArgs = {java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Together with all other methods including a MathContext these tests for a complete test set.", + method = "plus", + args = {java.math.MathContext.class} + ) public void testPlusMathContextNegative() { String a = "-92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = 49; @@ -663,15 +603,12 @@ public class BigDecimalCompareTest extends TestCase { /** * negate() for a positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for negate method.", - targets = { - @TestTarget( - methodName = "negate", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for negate method.", + method = "negate", + args = {} + ) public void testNegatePositive() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = 41; @@ -685,41 +622,43 @@ public class BigDecimalCompareTest extends TestCase { /** * negate(MathContext) for a positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "negate", - methodArgs = {java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Together with all other methods including a MathContext these tests for a complete test set.", + method = "negate", + args = {java.math.MathContext.class} + ) + @KnownFailure("Fix in BigDecimal.negate") public void testNegateMathContextPositive() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; - int aScale = 41; - int precision = 37; - RoundingMode rm = RoundingMode.FLOOR; - MathContext mc = new MathContext(precision, rm); - String c = "-929487820944884782312124789.8748298842"; - int cScale = 10; - BigDecimal aNumber = new BigDecimal(new BigInteger(a), aScale); + MathContext mc = new MathContext(37, RoundingMode.FLOOR); + BigDecimal aNumber = new BigDecimal(new BigInteger(a), 41); BigDecimal res = aNumber.negate(mc); - assertEquals("incorrect value", c, res.toString()); - assertEquals("incorrect scale", cScale, res.scale()); + assertEquals("incorrect value", "-929487820944884782312124789.8748298843", res.toString()); + assertEquals("incorrect scale", 10, res.scale()); + +// String a = "92948782094488478231212478987482988429808779810457634781384756794987"; +// int aScale = 41; +// int precision = 37; +// RoundingMode rm = RoundingMode.FLOOR; +// MathContext mc = new MathContext(precision, rm); +// String c = "-929487820944884782312124789.8748298842"; +// int cScale = 10; +// BigDecimal aNumber = new BigDecimal(new BigInteger(a), aScale); +// BigDecimal res = aNumber.negate(mc); +// assertEquals("incorrect value", c, res.toString()); +// assertEquals("incorrect scale", cScale, res.scale()); } /** * negate() for a negative BigDecimal */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for negate method.", - targets = { - @TestTarget( - methodName = "negate", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for negate method.", + method = "negate", + args = {} + ) public void testNegateNegative() { String a = "-92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = 41; @@ -733,22 +672,20 @@ public class BigDecimalCompareTest extends TestCase { /** * negate(MathContext) for a negative BigDecimal */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "negate", - methodArgs = {java.math.MathContext.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Together with all other methods including a MathContext these tests for a complete test set.", + method = "negate", + args = {java.math.MathContext.class} + ) + @KnownFailure("Fix in BigDecimal.negate") public void testNegateMathContextNegative() { String a = "-92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = 49; int precision = 46; RoundingMode rm = RoundingMode.CEILING; MathContext mc = new MathContext(precision, rm); - String c = "9294878209448847823.121247898748298842980877981"; + String c = "9294878209448847823.121247898748298842980877982"; int cScale = 27; BigDecimal aNumber = new BigDecimal(new BigInteger(a), aScale); BigDecimal res = aNumber.negate(mc); @@ -759,15 +696,12 @@ public class BigDecimalCompareTest extends TestCase { /** * signum() for a positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "This is a complete subset of tests for signum method.", - targets = { - @TestTarget( - methodName = "signum", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for signum method.", + method = "signum", + args = {} + ) public void testSignumPositive() { String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = 41; @@ -778,15 +712,12 @@ public class BigDecimalCompareTest extends TestCase { /** * signum() for a negative BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "This is a complete subset of tests for signum method.", - targets = { - @TestTarget( - methodName = "signum", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for signum method.", + method = "signum", + args = {} + ) public void testSignumNegative() { String a = "-92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = 41; @@ -797,15 +728,12 @@ public class BigDecimalCompareTest extends TestCase { /** * signum() for zero */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "This is a complete subset of tests for signum method.", - targets = { - @TestTarget( - methodName = "signum", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for signum method.", + method = "signum", + args = {} + ) public void testSignumZero() { String a = "0"; int aScale = 41; diff --git a/math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalConstructorsTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalConstructorsTest.java new file mode 100644 index 0000000..a428c9f --- /dev/null +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalConstructorsTest.java @@ -0,0 +1,1603 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @author Elena Semukhina + * @version $Revision$ + */ + +package org.apache.harmony.math.tests.java.math; + +import dalvik.annotation.KnownFailure; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; + +import junit.framework.TestCase; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.math.MathContext; +import java.math.RoundingMode; +@TestTargetClass(BigDecimal.class) +/** + * Class: java.math.BigDecimal + * Methods: constructors and fields + */ +public class BigDecimalConstructorsTest extends TestCase { + /** + * check ONE + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "tests BigDecimal.ONE to be 1.0d", + method = "!field:BigDecimal.ONE" + ) + public void testFieldONE() { + String oneS = "1"; + double oneD = 1.0; + assertEquals("incorrect string value", oneS, BigDecimal.ONE.toString()); + assertEquals("incorrect double value", oneD, BigDecimal.ONE.doubleValue(), 0); + } + + /** + * check TEN + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "tests BigDecimal.TEN to be 10.0d", + method = "!field:BigDecimal.TEN" + ) + public void testFieldTEN() { + String oneS = "10"; + double oneD = 10.0; + assertEquals("incorrect string value", oneS, BigDecimal.TEN.toString()); + assertEquals("incorrect double value", oneD, BigDecimal.TEN.doubleValue(), 0); + } + + /** + * check ZERO + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "tests BigDecimal.ZERO to be 0.0d", + method = "!field:BigDecimal.ZERO" + ) + public void testFieldZERO() { + String oneS = "0"; + double oneD = 0.0; + assertEquals("incorrect string value", oneS, BigDecimal.ZERO.toString()); + assertEquals("incorrect double value", oneD, BigDecimal.ZERO.doubleValue(), 0); + } + + /** + * new BigDecimal(BigInteger value) + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {java.math.BigInteger.class} + ) + public void testConstrBI() { + String a = "1231212478987482988429808779810457634781384756794987"; + BigInteger bA = new BigInteger(a); + BigDecimal aNumber = new BigDecimal(bA); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", 0, aNumber.scale()); + + try { + new BigDecimal((BigInteger) null); + fail("No NullPointerException"); + } catch (NullPointerException e) { + //expected + } + } + + /** + * new BigDecimal(BigInteger value, int scale) + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {java.math.BigInteger.class, int.class} + ) + public void testConstrBIScale() { + String a = "1231212478987482988429808779810457634781384756794987"; + BigInteger bA = new BigInteger(a); + int aScale = 10; + BigDecimal aNumber = new BigDecimal(bA, aScale); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(BigInteger value, MathContext) + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {java.math.BigInteger.class, java.math.MathContext.class} + ) + public void testConstrBigIntegerMathContext() { + String a = "1231212478987482988429808779810457634781384756794987"; + BigInteger bA = new BigInteger(a); + int precision = 46; + RoundingMode rm = RoundingMode.CEILING; + MathContext mc = new MathContext(precision, rm); + String res = "1231212478987482988429808779810457634781384757"; + int resScale = -6; + BigDecimal result = new BigDecimal(bA, mc); + assertEquals("incorrect value", res, result.unscaledValue().toString()); + assertEquals("incorrect scale", resScale, result.scale()); + + // Now test more than just RoundingMode.CEILING: + // + BigDecimal bd; + BigInteger bi = new BigInteger( "12345678901234567890123456789012345"); + BigInteger nbi = new BigInteger("-12345678901234567890123456789012345"); + + mc = new MathContext(31, RoundingMode.UP); + bd = new BigDecimal(bi, mc); + assertEquals("incorrect value", "1.234567890123456789012345678902E+34", bd.toString()); + bd = new BigDecimal(nbi, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678902E+34", bd.toString()); + + mc = new MathContext(28, RoundingMode.DOWN); + bd = new BigDecimal(bi, mc); + assertEquals("incorrect value", "1.234567890123456789012345678E+34", bd.toString()); + bd = new BigDecimal(nbi, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678E+34", bd.toString()); + + mc = new MathContext(33, RoundingMode.CEILING); + bd = new BigDecimal(bi, mc); + assertEquals("incorrect value", "1.23456789012345678901234567890124E+34", bd.toString()); + bd = new BigDecimal(nbi, mc); + assertEquals("incorrect value", "-1.23456789012345678901234567890123E+34", bd.toString()); + + mc = new MathContext(34, RoundingMode.FLOOR); + bd = new BigDecimal(bi, mc); + assertEquals("incorrect value", "1.234567890123456789012345678901234E+34", bd.toString()); + bd = new BigDecimal(nbi, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678901235E+34", bd.toString()); + + mc = new MathContext(34, RoundingMode.HALF_EVEN); + bd = new BigDecimal(bi, mc); + assertEquals("incorrect value", "1.234567890123456789012345678901234E+34", bd.toString()); + bd = new BigDecimal(nbi, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678901234E+34", bd.toString()); + bd = new BigDecimal(new BigInteger("-12345678901234567890123456789012335"), mc); + assertEquals("incorrect value", "-1.234567890123456789012345678901234E+34", bd.toString()); + + mc = new MathContext(34, RoundingMode.HALF_UP); + bd = new BigDecimal(bi, mc); + assertEquals("incorrect value", "1.234567890123456789012345678901235E+34", bd.toString()); + bd = new BigDecimal(nbi, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678901235E+34", bd.toString()); + + mc = new MathContext(34, RoundingMode.HALF_DOWN); + bd = new BigDecimal(bi, mc); + assertEquals("incorrect value", "1.234567890123456789012345678901234E+34", bd.toString()); + bd = new BigDecimal(nbi, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678901234E+34", bd.toString()); + + mc = new MathContext(34, RoundingMode.UNNECESSARY); + try { + bd = new BigDecimal(bi, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + try { + bd = new BigDecimal(nbi, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + } + + /** + * new BigDecimal(BigInteger value, int scale, MathContext) + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "BigDecimal", + args = {java.math.BigInteger.class, int.class, java.math.MathContext.class} + ) + public void testConstrBigIntegerScaleMathContext() { + String a = "1231212478987482988429808779810457634781384756794987"; + BigInteger bA = new BigInteger(a); + int aScale = 10; + int precision = 46; + RoundingMode rm = RoundingMode.CEILING; + MathContext mc = new MathContext(precision, rm); + String res = "1231212478987482988429808779810457634781384757"; + int resScale = 4; + BigDecimal result = new BigDecimal(bA, aScale, mc); + assertEquals("incorrect value", res, result.unscaledValue().toString()); + assertEquals("incorrect scale", resScale, result.scale()); + + // Now test more than just RoundingMode.CEILING: + // + // ATTENTION: + // The remaining section is TEXTUALLY COPIED + // from testConstrBigIntegerMathContext + // with minor repetitive modifications. + // + BigDecimal bd; + + BigInteger bi = new BigInteger( "12345678901234567890123456789012345"); + BigInteger nbi = new BigInteger("-12345678901234567890123456789012345"); + + mc = new MathContext(31, RoundingMode.UP); + bd = new BigDecimal(bi, -10, mc); + assertEquals("incorrect value", "1.234567890123456789012345678902E+44", bd.toString()); + bd = new BigDecimal(nbi, -10, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678902E+44", bd.toString()); + + mc = new MathContext(28, RoundingMode.DOWN); + bd = new BigDecimal(bi, -10, mc); + assertEquals("incorrect value", "1.234567890123456789012345678E+44", bd.toString()); + bd = new BigDecimal(nbi, -10, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678E+44", bd.toString()); + + mc = new MathContext(33, RoundingMode.CEILING); + bd = new BigDecimal(bi, -10, mc); + assertEquals("incorrect value", "1.23456789012345678901234567890124E+44", bd.toString()); + bd = new BigDecimal(nbi, -10, mc); + assertEquals("incorrect value", "-1.23456789012345678901234567890123E+44", bd.toString()); + + mc = new MathContext(34, RoundingMode.FLOOR); + bd = new BigDecimal(bi, -10, mc); + assertEquals("incorrect value", "1.234567890123456789012345678901234E+44", bd.toString()); + bd = new BigDecimal(nbi, -10, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678901235E+44", bd.toString()); + + mc = new MathContext(34, RoundingMode.HALF_EVEN); + bd = new BigDecimal(bi, -10, mc); + assertEquals("incorrect value", "1.234567890123456789012345678901234E+44", bd.toString()); + bd = new BigDecimal(nbi, -10, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678901234E+44", bd.toString()); + bd = new BigDecimal(new BigInteger("-12345678901234567890123456789012335"), -10, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678901234E+44", bd.toString()); + + mc = new MathContext(34, RoundingMode.HALF_UP); + bd = new BigDecimal(bi, -10, mc); + assertEquals("incorrect value", "1.234567890123456789012345678901235E+44", bd.toString()); + bd = new BigDecimal(nbi, -10, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678901235E+44", bd.toString()); + + mc = new MathContext(34, RoundingMode.HALF_DOWN); + bd = new BigDecimal(bi, -10, mc); + assertEquals("incorrect value", "1.234567890123456789012345678901234E+44", bd.toString()); + bd = new BigDecimal(nbi, -10, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678901234E+44", bd.toString()); + + mc = new MathContext(34, RoundingMode.UNNECESSARY); + try { + bd = new BigDecimal(bi, -10, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + try { + bd = new BigDecimal(nbi, -10, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + + // And just TEXTUALLY COPIED again: + // + mc = new MathContext(31, RoundingMode.UP); + bd = new BigDecimal(bi, 10, mc); + assertEquals("incorrect value", "1234567890123456789012345.678902", bd.toString()); + bd = new BigDecimal(nbi, 10, mc); + assertEquals("incorrect value", "-1234567890123456789012345.678902", bd.toString()); + + mc = new MathContext(28, RoundingMode.DOWN); + bd = new BigDecimal(bi, 10, mc); + assertEquals("incorrect value", "1234567890123456789012345.678", bd.toString()); + bd = new BigDecimal(nbi, 10, mc); + assertEquals("incorrect value", "-1234567890123456789012345.678", bd.toString()); + + mc = new MathContext(33, RoundingMode.CEILING); + bd = new BigDecimal(bi, 10, mc); + assertEquals("incorrect value", "1234567890123456789012345.67890124", bd.toString()); + bd = new BigDecimal(nbi, 10, mc); + assertEquals("incorrect value", "-1234567890123456789012345.67890123", bd.toString()); + + mc = new MathContext(34, RoundingMode.FLOOR); + bd = new BigDecimal(bi, 10, mc); + assertEquals("incorrect value", "1234567890123456789012345.678901234", bd.toString()); + bd = new BigDecimal(nbi, 10, mc); + assertEquals("incorrect value", "-1234567890123456789012345.678901235", bd.toString()); + + mc = new MathContext(34, RoundingMode.HALF_EVEN); + bd = new BigDecimal(bi, 10, mc); + assertEquals("incorrect value", "1234567890123456789012345.678901234", bd.toString()); + bd = new BigDecimal(nbi, 10, mc); + assertEquals("incorrect value", "-1234567890123456789012345.678901234", bd.toString()); + bd = new BigDecimal(new BigInteger("-12345678901234567890123456789012335"), 10, mc); + assertEquals("incorrect value", "-1234567890123456789012345.678901234", bd.toString()); + + mc = new MathContext(34, RoundingMode.HALF_UP); + bd = new BigDecimal(bi, 10, mc); + assertEquals("incorrect value", "1234567890123456789012345.678901235", bd.toString()); + bd = new BigDecimal(nbi, 10, mc); + assertEquals("incorrect value", "-1234567890123456789012345.678901235", bd.toString()); + + mc = new MathContext(34, RoundingMode.HALF_DOWN); + bd = new BigDecimal(bi, 10, mc); + assertEquals("incorrect value", "1234567890123456789012345.678901234", bd.toString()); + bd = new BigDecimal(nbi, 10, mc); + assertEquals("incorrect value", "-1234567890123456789012345.678901234", bd.toString()); + + mc = new MathContext(34, RoundingMode.UNNECESSARY); + try { + bd = new BigDecimal(bi, 10, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + try { + bd = new BigDecimal(nbi, 10, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + + mc = new MathContext(28, RoundingMode.FLOOR); + bd = new BigDecimal(bi, 10, mc); + assertEquals("incorrect value", "1234567890123456789012345.678", bd.toString()); + bd = new BigDecimal(nbi, 10, mc); + assertEquals("incorrect value", "-1234567890123456789012345.679", bd.toString()); + } + + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "BigDecimal", + args = {java.math.BigInteger.class, int.class, java.math.MathContext.class} + ) + @KnownFailure("Fix in BigDecimal.inplaceRound") + public void testConstrBigIntegerScaleMathContext_AndroidFailure() { + MathContext mc; + BigDecimal bd; + + mc = new MathContext(17, RoundingMode.FLOOR); + bd = new BigDecimal(new BigInteger("123456789012345678"), 3, mc); + assertEquals("incorrect value", "123456789012345.67", bd.toString()); + } + + /** + * new BigDecimal(char[] value); + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {char[].class} + ) + public void testConstrChar() { + char value[] = {'-', '1', '2', '3', '8', '0', '.', '4', '7', '3', '8', 'E', '-', '4', '2', '3'}; + BigDecimal result = new BigDecimal(value); + String res = "-1.23804738E-419"; + int resScale = 427; + assertEquals("incorrect value", res, result.toString()); + assertEquals("incorrect scale", resScale, result.scale()); + + try { + // Regression for HARMONY-783 + new BigDecimal(new char[] {}); + fail("NumberFormatException has not been thrown"); + } catch (NumberFormatException e) { + } + } + + /** + * new BigDecimal(char[] value, int offset, int len); + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {char[].class, int.class, int.class} + ) + public void testConstrCharIntInt() { + char value[] = {'-', '1', '2', '3', '8', '0', '.', '4', '7', '3', '8', 'E', '-', '4', '2', '3'}; + int offset = 3; + int len = 12; + BigDecimal result = new BigDecimal(value, offset, len); + String res = "3.804738E-40"; + int resScale = 46; + assertEquals("incorrect value", res, result.toString()); + assertEquals("incorrect scale", resScale, result.scale()); + + try { + // Regression for HARMONY-783 + new BigDecimal(new char[] {}, 0, 0); + fail("NumberFormatException has not been thrown"); + } catch (NumberFormatException e) { + } + } + + /** + * new BigDecimal(char[] value, int offset, int len, MathContext mc); + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "BigDecimal", + args = {char[].class, int.class, int.class, java.math.MathContext.class} + ) + public void testConstrCharIntIntMathContext() { + char value[] = {'-', '1', '2', '3', '8', '0', '.', '4', '7', '3', '8', 'E', '-', '4', '2', '3'}; + int offset = 3; + int len = 12; + int precision = 4; + RoundingMode rm = RoundingMode.CEILING; + MathContext mc = new MathContext(precision, rm); + BigDecimal result = new BigDecimal(value, offset, len, mc); + String res = "3.805E-40"; + int resScale = 43; + assertEquals("incorrect value", res, result.toString()); + assertEquals("incorrect scale", resScale, result.scale()); + + try { + // Regression for HARMONY-783 + new BigDecimal(new char[] {}, 0, 0, MathContext.DECIMAL32); + fail("NumberFormatException has not been thrown"); + } catch (NumberFormatException e) { + } + + // Now test more than just RoundingMode.CEILING: + // + // ATTENTION: + // The remaining section is TEXTUALLY COPIED + // from testConstrBigIntegerScaleMathContext + // with minor repetitive modifications. + // + char[] biCA = "bla: 12345678901234567890123456789012345.0E+10, and more bla".toCharArray(); + char[] nbiCA = "bla: -12345678901234567890123456789012345.E+10, and more bla".toCharArray(); + BigDecimal bd; + + mc = new MathContext(31, RoundingMode.UP); + bd = new BigDecimal(biCA, 5, 41, mc); + assertEquals("incorrect value", "1.234567890123456789012345678902E+44", bd.toString()); + bd = new BigDecimal(nbiCA, 5, 41, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678902E+44", bd.toString()); + + mc = new MathContext(28, RoundingMode.DOWN); + bd = new BigDecimal(biCA, 5, 41, mc); + assertEquals("incorrect value", "1.234567890123456789012345678E+44", bd.toString()); + bd = new BigDecimal(nbiCA, 5, 41, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678E+44", bd.toString()); + + mc = new MathContext(33, RoundingMode.CEILING); + bd = new BigDecimal(biCA, 5, 41, mc); + assertEquals("incorrect value", "1.23456789012345678901234567890124E+44", bd.toString()); + bd = new BigDecimal(nbiCA, 5, 41, mc); + assertEquals("incorrect value", "-1.23456789012345678901234567890123E+44", bd.toString()); + + mc = new MathContext(34, RoundingMode.FLOOR); + bd = new BigDecimal(biCA, 5, 41, mc); + assertEquals("incorrect value", "1.234567890123456789012345678901234E+44", bd.toString()); + bd = new BigDecimal(nbiCA, 5, 41, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678901235E+44", bd.toString()); + + mc = new MathContext(34, RoundingMode.HALF_EVEN); + bd = new BigDecimal(biCA, 5, 41, mc); + assertEquals("incorrect value", "1.234567890123456789012345678901234E+44", bd.toString()); + bd = new BigDecimal(nbiCA, 5, 41, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678901234E+44", bd.toString()); + bd = new BigDecimal("-123456789012345678901234567890123350000000000".toCharArray(), 0, 46, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678901234E+44", bd.toString()); + + mc = new MathContext(34, RoundingMode.HALF_UP); + bd = new BigDecimal(biCA, 5, 41, mc); + assertEquals("incorrect value", "1.234567890123456789012345678901235E+44", bd.toString()); + bd = new BigDecimal(nbiCA, 5, 41, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678901235E+44", bd.toString()); + + mc = new MathContext(34, RoundingMode.HALF_DOWN); + bd = new BigDecimal(biCA, 5, 41, mc); + assertEquals("incorrect value", "1.234567890123456789012345678901234E+44", bd.toString()); + bd = new BigDecimal(nbiCA, 5, 41, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678901234E+44", bd.toString()); + + mc = new MathContext(34, RoundingMode.UNNECESSARY); + try { + bd = new BigDecimal(biCA, 5, 41, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + try { + bd = new BigDecimal(nbiCA, 5, 41, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + } + + /** + * new BigDecimal(char[] value, int offset, int len, MathContext mc); + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "BigDecimal", + args = {char[].class, int.class, int.class, java.math.MathContext.class} + ) + public void testConstrCharIntIntMathContextException1() { + char value[] = {'-', '1', '2', '3', '8', '0', '.', '4', '7', '3', '8', 'E', '-', '4', '2', '3'}; + int offset = 3; + int len = 120; + int precision = 4; + RoundingMode rm = RoundingMode.CEILING; + MathContext mc = new MathContext(precision, rm); + try { + new BigDecimal(value, offset, len, mc); + fail("NumberFormatException has not been thrown"); + } catch (NumberFormatException e) { + } + } + + /** + * new BigDecimal(char[] value, MathContext mc); + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {char[].class, java.math.MathContext.class} + ) + public void testConstrCharMathContext() { + try { + // Regression for HARMONY-783 + new BigDecimal(new char[] {}, MathContext.DECIMAL32); + fail("NumberFormatException has not been thrown"); + } catch (NumberFormatException e) { + } + + // Now test more than just regression + // (even if for quite sure the implementation will use the offset/len variant internally): + // + char[] biCA = "12345678901234567890123456789012345.0E+10".toCharArray(); + char[] nbiCA = "-12345678901234567890123456789012345.E+10".toCharArray(); + BigDecimal bd; + MathContext mc; + + mc = new MathContext(31, RoundingMode.UP); + bd = new BigDecimal(biCA, mc); + assertEquals("incorrect value", "1.234567890123456789012345678902E+44", bd.toString()); + bd = new BigDecimal(nbiCA, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678902E+44", bd.toString()); + + mc = new MathContext(28, RoundingMode.DOWN); + bd = new BigDecimal(biCA, mc); + assertEquals("incorrect value", "1.234567890123456789012345678E+44", bd.toString()); + bd = new BigDecimal(nbiCA, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678E+44", bd.toString()); + + mc = new MathContext(33, RoundingMode.CEILING); + bd = new BigDecimal(biCA, mc); + assertEquals("incorrect value", "1.23456789012345678901234567890124E+44", bd.toString()); + bd = new BigDecimal(nbiCA, mc); + assertEquals("incorrect value", "-1.23456789012345678901234567890123E+44", bd.toString()); + + mc = new MathContext(34, RoundingMode.UNNECESSARY); + try { + bd = new BigDecimal(biCA, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + try { + bd = new BigDecimal(nbiCA, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + } + + /** + * new BigDecimal(double value) when value is NaN + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(double) constructor.", + method = "BigDecimal", + args = {double.class} + ) + public void testConstrDoubleNaN() { + double a = Double.NaN; + try { + new BigDecimal(a); + fail("NumberFormatException has not been caught"); + } catch (NumberFormatException e) { + assertEquals("Improper exception message", "Infinite or NaN", e + .getMessage()); + } + } + + /** + * new BigDecimal(double value) when value is positive infinity + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(double) constructor.", + method = "BigDecimal", + args = {double.class} + ) + public void testConstrDoublePosInfinity() { + double a = Double.POSITIVE_INFINITY; + try { + new BigDecimal(a); + fail("NumberFormatException has not been caught"); + } catch (NumberFormatException e) { + assertEquals("Improper exception message", "Infinite or NaN", + e.getMessage()); + } + } + + /** + * new BigDecimal(double value) when value is positive infinity + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(double) constructor.", + method = "BigDecimal", + args = {double.class} + ) + public void testConstrDoubleNegInfinity() { + double a = Double.NEGATIVE_INFINITY; + try { + new BigDecimal(a); + fail("NumberFormatException has not been caught"); + } catch (NumberFormatException e) { + assertEquals("Improper exception message", "Infinite or NaN", + e.getMessage()); + } + } + + /** + * new BigDecimal(double value) + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(double) constructor.", + method = "BigDecimal", + args = {double.class} + ) + public void testConstrDouble() { + double a = 732546982374982347892379283571094797.287346782359284756; + int aScale = 0; + BigInteger bA = new BigInteger("732546982374982285073458350476230656"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(double, MathContext) + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "BigDecimal", + args = {double.class, java.math.MathContext.class} + ) + public void testConstrDoubleMathContext() { + double a = 732546982374982347892379283571094797.287346782359284756; + int precision = 21; + RoundingMode rm = RoundingMode.CEILING; + MathContext mc = new MathContext(precision, rm); + String res = "732546982374982285074"; + int resScale = -15; + BigDecimal result = new BigDecimal(a, mc); + assertEquals("incorrect value", res, result.unscaledValue().toString()); + assertEquals("incorrect scale", resScale, result.scale()); + + // Now test more than just RoundingMode.CEILING + // + BigDecimal bd; + + mc = new MathContext(9, RoundingMode.UP); + bd = new BigDecimal(123456789.125, mc); + assertEquals("incorrect value", "123456790", bd.toString()); + bd = new BigDecimal(-123456789.125, mc); + assertEquals("incorrect value", "-123456790", bd.toString()); + + mc = new MathContext(8, RoundingMode.DOWN); + bd = new BigDecimal(123456789.125, mc); + assertEquals("incorrect value", "1.2345678E+8", bd.toString()); + bd = new BigDecimal(-123456789.125, mc); + assertEquals("incorrect value", "-1.2345678E+8", bd.toString()); + + mc = new MathContext(10, RoundingMode.CEILING); + bd = new BigDecimal(123456789.125, mc); + assertEquals("incorrect value", "123456789.2", bd.toString()); + bd = new BigDecimal(-123456789.125, mc); + assertEquals("incorrect value", "-123456789.1", bd.toString()); + + mc = new MathContext(8, RoundingMode.FLOOR); + bd = new BigDecimal(123456789.125, mc); + assertEquals("incorrect value", "1.2345678E+8", bd.toString()); + bd = new BigDecimal(-123456789.125, mc); + assertEquals("incorrect value", "-1.2345679E+8", bd.toString()); + + mc = new MathContext(11, RoundingMode.HALF_EVEN); + // + // VERY FUNNY: + // This works: + bd = new BigDecimal("123456789.125", mc); + assertEquals("incorrect value", "123456789.12", bd.toString()); + // But this doesn't: +// bd = new BigDecimal(123456789.125, mc); +// assertEquals("incorrect value", "123456789.12", bd.toString()); + +// bd = new BigDecimal(-123456789.125, mc); +// assertEquals("incorrect value", "-123456789.12", bd.toString()); + bd = new BigDecimal(-123456789.135, mc); + assertEquals("incorrect value", "-123456789.14", bd.toString()); + + mc = new MathContext(11, RoundingMode.HALF_UP); + bd = new BigDecimal("123456789.125", mc); + assertEquals("incorrect value", "123456789.13", bd.toString()); + + // AND HERE, TOO: +// mc = new MathContext(11, RoundingMode.HALF_UP); +// bd = new BigDecimal(123456789.125, mc); +// assertEquals("incorrect value", "123456789.13", bd.toString()); +// bd = new BigDecimal(-123456789.125, mc); +// assertEquals("incorrect value", "-123456789.13", bd.toString()); + + mc = new MathContext(11, RoundingMode.HALF_DOWN); + // + // SAME HERE: + // This works: + bd = new BigDecimal("123456789.125", mc); + assertEquals("incorrect value", "123456789.12", bd.toString()); + // But this doesn't: +// bd = new BigDecimal(123456789.125, mc); +// assertEquals("incorrect value", "123456789.12", bd.toString()); + +// bd = new BigDecimal(123456789.125, mc); +// assertEquals("incorrect value", "123456789.12", bd.toString()); +// bd = new BigDecimal(-123456789.125, mc); +// assertEquals("incorrect value", "-123456789.12", bd.toString()); + + mc = new MathContext(8, RoundingMode.UNNECESSARY); + try { + bd = new BigDecimal(123456789.125, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + try { + bd = new BigDecimal(-123456789.125, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + } + + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "BigDecimal", + args = {double.class, java.math.MathContext.class} + ) + @KnownFailure("Fix in BigDecimal.inplaceRound") + public void testConstrDoubleMathContext_AndroidFailure() { + BigDecimal bd; + MathContext mc; + + mc = new MathContext(11, RoundingMode.HALF_EVEN); + // + // VERY FUNNY: + // This works: + bd = new BigDecimal("123456789.125", mc); + assertEquals("incorrect value", "123456789.12", bd.toString()); + // But this doesn't: + bd = new BigDecimal(123456789.125, mc); + assertEquals("incorrect value", "123456789.12", bd.toString()); + + bd = new BigDecimal(-123456789.125, mc); + assertEquals("incorrect value", "-123456789.12", bd.toString()); + + // AND HERE, TOO: + mc = new MathContext(11, RoundingMode.HALF_UP); + bd = new BigDecimal(123456789.125, mc); + assertEquals("incorrect value", "123456789.13", bd.toString()); + bd = new BigDecimal(-123456789.125, mc); + assertEquals("incorrect value", "-123456789.13", bd.toString()); + + mc = new MathContext(11, RoundingMode.HALF_DOWN); + // + // SAME HERE: + // This works: + bd = new BigDecimal("123456789.125", mc); + assertEquals("incorrect value", "123456789.12", bd.toString()); + // But this doesn't: + bd = new BigDecimal(123456789.125, mc); + assertEquals("incorrect value", "123456789.12", bd.toString()); + + bd = new BigDecimal(123456789.125, mc); + assertEquals("incorrect value", "123456789.12", bd.toString()); + bd = new BigDecimal(-123456789.125, mc); + assertEquals("incorrect value", "-123456789.12", bd.toString()); + } + + /** + * new BigDecimal(0.1) + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(double) constructor.", + method = "BigDecimal", + args = {double.class} + ) + public void testConstrDouble01() { + double a = 1.E-1; + int aScale = 55; + BigInteger bA = new BigInteger("1000000000000000055511151231257827021181583404541015625"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(0.555) + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(double) constructor.", + method = "BigDecimal", + args = {double.class} + ) + public void testConstrDouble02() { + double a = 0.555; + int aScale = 53; + BigInteger bA = new BigInteger("55500000000000004884981308350688777863979339599609375"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(-0.1) + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(double) constructor.", + method = "BigDecimal", + args = {double.class} + ) + public void testConstrDoubleMinus01() { + double a = -1.E-1; + int aScale = 55; + BigInteger bA = new BigInteger("-1000000000000000055511151231257827021181583404541015625"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(int value) + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {int.class} + ) + public void testConstrInt() { + int a = 732546982; + String res = "732546982"; + int resScale = 0; + BigDecimal result = new BigDecimal(a); + assertEquals("incorrect value", res, result.unscaledValue().toString()); + assertEquals("incorrect scale", resScale, result.scale()); + } + + /** + * new BigDecimal(int, MathContext) + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {int.class, java.math.MathContext.class} + ) + public void testConstrIntMathContext() { + int a = 732546982; + int precision = 21; + RoundingMode rm = RoundingMode.CEILING; + MathContext mc = new MathContext(precision, rm); + String res = "732546982"; + int resScale = 0; + BigDecimal result = new BigDecimal(a, mc); + assertEquals("incorrect value", res, result.unscaledValue().toString()); + assertEquals("incorrect scale", resScale, result.scale()); + } + + /** + * new BigDecimal(long value) + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {long.class} + ) + public void testConstrLong() { + long a = 4576578677732546982L; + String res = "4576578677732546982"; + int resScale = 0; + BigDecimal result = new BigDecimal(a); + assertEquals("incorrect value", res, result.unscaledValue().toString()); + assertEquals("incorrect scale", resScale, result.scale()); + } + + /** + * new BigDecimal(long, MathContext) + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {long.class, java.math.MathContext.class} + ) + public void testConstrLongMathContext() { + long a = 4576578677732546982L; + int precision = 5; + RoundingMode rm = RoundingMode.CEILING; + MathContext mc = new MathContext(precision, rm); + String res = "45766"; + int resScale = -14; + BigDecimal result = new BigDecimal(a, mc); + assertEquals("incorrect value", res, result.unscaledValue().toString()); + assertEquals("incorrect scale", resScale, result.scale()); + + // Now test more than just RoundingMode.CEILING + // + BigDecimal bd; + + mc = new MathContext(15, RoundingMode.UP); + bd = new BigDecimal(78901234567890125L, mc); + assertEquals("incorrect value", "7.89012345678902E+16", bd.toString()); + bd = new BigDecimal(-78901234567890125L, mc); + assertEquals("incorrect value", "-7.89012345678902E+16", bd.toString()); + + mc = new MathContext(12, RoundingMode.DOWN); + bd = new BigDecimal(78901234567890125L, mc); + assertEquals("incorrect value", "7.89012345678E+16", bd.toString()); + bd = new BigDecimal(-78901234567890125L, mc); + assertEquals("incorrect value", "-7.89012345678E+16", bd.toString()); + + mc = new MathContext(15, RoundingMode.CEILING); + bd = new BigDecimal(78901234567890125L, mc); + assertEquals("incorrect value", "7.89012345678902E+16", bd.toString()); + bd = new BigDecimal(-78901234567890125L, mc); + assertEquals("incorrect value", "-7.89012345678901E+16", bd.toString()); + + mc = new MathContext(12, RoundingMode.FLOOR); + bd = new BigDecimal(78901234567890125L, mc); + assertEquals("incorrect value", "7.89012345678E+16", bd.toString()); + bd = new BigDecimal(-78901234567890125L, mc); + assertEquals("incorrect value", "-7.89012345679E+16", bd.toString()); + + mc = new MathContext(16, RoundingMode.HALF_EVEN); + bd = new BigDecimal(78901234567890125L, mc); + assertEquals("incorrect value", "7.890123456789012E+16", bd.toString()); + bd = new BigDecimal(-78901234567890125L, mc); + assertEquals("incorrect value", "-7.890123456789012E+16", bd.toString()); + bd = new BigDecimal(-78901234567890135L, mc); + assertEquals("incorrect value", "-7.890123456789014E+16", bd.toString()); + + mc = new MathContext(16, RoundingMode.HALF_UP); + bd = new BigDecimal(78901234567890125L, mc); + assertEquals("incorrect value", "7.890123456789013E+16", bd.toString()); + bd = new BigDecimal(-78901234567890125L, mc); + assertEquals("incorrect value", "-7.890123456789013E+16", bd.toString()); + + mc = new MathContext(16, RoundingMode.HALF_DOWN); + bd = new BigDecimal(78901234567890125L, mc); + assertEquals("incorrect value", "7.890123456789012E+16", bd.toString()); + bd = new BigDecimal(-78901234567890125L, mc); + assertEquals("incorrect value", "-7.890123456789012E+16", bd.toString()); + + mc = new MathContext(8, RoundingMode.UNNECESSARY); + try { + bd = new BigDecimal(78901234567890125L, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + try { + bd = new BigDecimal(-78901234567890125L, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + } + + /** + * new BigDecimal(double value) when value is denormalized + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(double) constructor.", + method = "BigDecimal", + args = {double.class} + ) + public void testConstrDoubleDenormalized() { + double a = 2.274341322658976E-309; + int aScale = 1073; + BigInteger bA = new BigInteger("227434132265897633950269241702666687639731047124115603942986140264569528085692462493371029187342478828091760934014851133733918639492582043963243759464684978401240614084312038547315281016804838374623558434472007664427140169018817050565150914041833284370702366055678057809362286455237716100382057360123091641959140448783514464639706721250400288267372238950016114583259228262046633530468551311769574111763316146065958042194569102063373243372766692713192728878701004405568459288708477607744497502929764155046100964958011009313090462293046650352146796805866786767887226278836423536035611825593567576424943331337401071583562754098901412372708947790843318760718495117047155597276492717187936854356663665005157041552436478744491526494952982062613955349661409854888916015625"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value) + * when value is not a valid representation of BigDecimal. + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringException() { + String a = "-238768.787678287a+10"; + try { +// BEGIN android-modified + BigDecimal bd = new BigDecimal(a); + fail("NumberFormatException has not been caught: " + bd.toString()); +// END android-modified + } catch (NumberFormatException e) {} + } + + /** + * new BigDecimal(String value) when exponent is empty. + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringExceptionEmptyExponent1() { + String a = "-238768.787678287e"; + try { + new BigDecimal(a); + fail("NumberFormatException has not been caught"); + } catch (NumberFormatException e) { + } + } + + /** + * new BigDecimal(String value) when exponent is empty. + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringExceptionEmptyExponent2() { + String a = "-238768.787678287e-"; + try { + new BigDecimal(a); + fail("NumberFormatException has not been caught"); + } catch (NumberFormatException e) { + } + } + + /** + * new BigDecimal(String value) when exponent is greater than + * Integer.MAX_VALUE. + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringExceptionExponentGreaterIntegerMax() { + String a = "-238768.787678287e214748364767876"; + try { + new BigDecimal(a); + fail("NumberFormatException has not been caught"); + } catch (NumberFormatException e) { + } + } + + /** + * new BigDecimal(String value) when exponent is less than + * Integer.MIN_VALUE. + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringExceptionExponentLessIntegerMin() { + String a = "-238768.787678287e-214748364767876"; + try { + new BigDecimal(a); + fail("NumberFormatException has not been caught"); + } catch (NumberFormatException e) { + } + } + + /** + * new BigDecimal(String value) + * when exponent is Integer.MAX_VALUE. + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringExponentIntegerMax() { + String a = "-238768.787678287e2147483647"; + int aScale = -2147483638; + BigInteger bA = new BigInteger("-238768787678287"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value) + * when exponent is Integer.MIN_VALUE. + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringExponentIntegerMin() { + String a = ".238768e-2147483648"; + try { + new BigDecimal(a); + fail("NumberFormatException expected"); + } catch (NumberFormatException e) { + assertEquals("Improper exception message","Scale out of range.", + e.getMessage()); + } + } + + /** + * new BigDecimal(String value); value does not contain exponent + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringWithoutExpPos1() { + String a = "732546982374982347892379283571094797.287346782359284756"; + int aScale = 18; + BigInteger bA = new BigInteger("732546982374982347892379283571094797287346782359284756"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value); value does not contain exponent + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringWithoutExpPos2() { + String a = "+732546982374982347892379283571094797.287346782359284756"; + int aScale = 18; + BigInteger bA = new BigInteger("732546982374982347892379283571094797287346782359284756"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value); value does not contain exponent + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringWithoutExpNeg() { + String a = "-732546982374982347892379283571094797.287346782359284756"; + int aScale = 18; + BigInteger bA = new BigInteger("-732546982374982347892379283571094797287346782359284756"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value); value does not contain exponent + * and decimal point + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringWithoutExpWithoutPoint() { + String a = "-732546982374982347892379283571094797287346782359284756"; + int aScale = 0; + BigInteger bA = new BigInteger("-732546982374982347892379283571094797287346782359284756"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value); value contains exponent + * and does not contain decimal point + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringWithExponentWithoutPoint1() { + String a = "-238768787678287e214"; + int aScale = -214; + BigInteger bA = new BigInteger("-238768787678287"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value); value contains exponent + * and does not contain decimal point + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringWithExponentWithoutPoint2() { + String a = "-238768787678287e-214"; + int aScale = 214; + BigInteger bA = new BigInteger("-238768787678287"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value); value contains exponent + * and does not contain decimal point + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringWithExponentWithoutPoint3() { + String a = "238768787678287e-214"; + int aScale = 214; + BigInteger bA = new BigInteger("238768787678287"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value); value contains exponent + * and does not contain decimal point + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringWithExponentWithoutPoint4() { + String a = "238768787678287e+214"; + int aScale = -214; + BigInteger bA = new BigInteger("238768787678287"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value); value contains exponent + * and does not contain decimal point + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringWithExponentWithoutPoint5() { + String a = "238768787678287E214"; + int aScale = -214; + BigInteger bA = new BigInteger("238768787678287"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value); + * value contains both exponent and decimal point + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringWithExponentWithPoint1() { + String a = "23985439837984782435652424523876878.7678287e+214"; + int aScale = -207; + BigInteger bA = new BigInteger("239854398379847824356524245238768787678287"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value); + * value contains both exponent and decimal point + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringWithExponentWithPoint2() { + String a = "238096483923847545735673567457356356789029578490276878.7678287e-214"; + int aScale = 221; + BigInteger bA = new BigInteger("2380964839238475457356735674573563567890295784902768787678287"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value); + * value contains both exponent and decimal point + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringWithExponentWithPoint3() { + String a = "2380964839238475457356735674573563567890.295784902768787678287E+21"; + int aScale = 0; + BigInteger bA = new BigInteger("2380964839238475457356735674573563567890295784902768787678287"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value); + * value contains both exponent and decimal point + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringWithExponentWithPoint4() { + String a = "23809648392384754573567356745735635678.90295784902768787678287E+21"; + int aScale = 2; + BigInteger bA = new BigInteger("2380964839238475457356735674573563567890295784902768787678287"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value); + * value contains both exponent and decimal point + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigDecimal(String) constructor.", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void testConstrStringWithExponentWithPoint5() { + String a = "238096483923847545735673567457356356789029.5784902768787678287E+21"; + int aScale = -2; + BigInteger bA = new BigInteger("2380964839238475457356735674573563567890295784902768787678287"); + BigDecimal aNumber = new BigDecimal(a); + assertEquals("incorrect value", bA, aNumber.unscaledValue()); + assertEquals("incorrect scale", aScale, aNumber.scale()); + } + + /** + * new BigDecimal(String value, MathContext) + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {java.lang.String.class, java.math.MathContext.class} + ) + public void testConstrStringMathContext() { + String a = "-238768787678287e214"; + int precision = 5; + RoundingMode rm = RoundingMode.CEILING; + MathContext mc = new MathContext(precision, rm); + String res = "-23876"; + int resScale = -224; + BigDecimal result = new BigDecimal(a, mc); + assertEquals("incorrect value", res, result.unscaledValue().toString()); + assertEquals("incorrect scale", resScale, result.scale()); + + // Now test more than just RoundingMode.CEILING: + // + String biStr = new String( "12345678901234567890123456789012345.0E+10"); + String nbiStr = new String("-12345678901234567890123456789012345.E+10"); + BigDecimal bd; + + mc = new MathContext(31, RoundingMode.UP); + bd = new BigDecimal(biStr, mc); + assertEquals("incorrect value", "1.234567890123456789012345678902E+44", bd.toString()); + bd = new BigDecimal(nbiStr, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678902E+44", bd.toString()); + + mc = new MathContext(28, RoundingMode.DOWN); + bd = new BigDecimal(biStr, mc); + assertEquals("incorrect value", "1.234567890123456789012345678E+44", bd.toString()); + bd = new BigDecimal(nbiStr, mc); + assertEquals("incorrect value", "-1.234567890123456789012345678E+44", bd.toString()); + + mc = new MathContext(33, RoundingMode.CEILING); + bd = new BigDecimal(biStr, mc); + assertEquals("incorrect value", "1.23456789012345678901234567890124E+44", bd.toString()); + bd = new BigDecimal(nbiStr, mc); + assertEquals("incorrect value", "-1.23456789012345678901234567890123E+44", bd.toString()); + + mc = new MathContext(34, RoundingMode.UNNECESSARY); + try { + bd = new BigDecimal(biStr, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + try { + bd = new BigDecimal(nbiStr, mc); + fail("No ArithmeticException for RoundingMode.UNNECESSARY"); + } catch (ArithmeticException e) { + // expected + } + + mc = new MathContext(7, RoundingMode.FLOOR); + bd = new BigDecimal("1000000.9", mc); + assertEquals("incorrect value", "1000000", bd.toString()); + } + +// ANDROID ADDED + + /** + * @tests java.math.BigDecimal#BigDecimal(java.math.BigInteger, int) + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {java.math.BigInteger.class, int.class} + ) + public void test_Constructor_java_math_BigInteger_int() { + BigInteger value = new BigInteger("12345908"); + BigDecimal big = new BigDecimal(value); + assertTrue("the BigDecimal value is not initialized properly", + big.unscaledValue().equals(value) + && big.scale() == 0); + + BigInteger value2 = new BigInteger("12334560000"); + BigDecimal big2 = new BigDecimal(value2, 5); + assertTrue("the BigDecimal value is not initialized properly", + big2.unscaledValue().equals(value2) + && big2.scale() == 5); + assertTrue("the BigDecimal value is not represented properly", big2.toString().equals( + "123345.60000")); + } + + /** + * @tests java.math.BigDecimal#BigDecimal(double) + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "BigDecimal", + args = {double.class} + ) + public void test_Constructor_Double() { + BigDecimal big = new BigDecimal(123E04); + assertTrue("the BigDecimal value taking a double argument is not initialized properly", big + .toString().equals("1230000")); + big = new BigDecimal(1.2345E-12); + assertTrue("the double representation is not correct for 1.2345E-12", + big.doubleValue() == 1.2345E-12); + big = new BigDecimal(-12345E-3); + assertTrue("the double representation is not correct for -12345E-3", + big.doubleValue() == -12.345); + big = new BigDecimal(5.1234567897654321e138); + assertTrue("the double representation is not correct for 5.1234567897654321e138", big + .doubleValue() == 5.1234567897654321E138 + && big.scale() == 0); + big = new BigDecimal(0.1); + assertTrue("the double representation of 0.1 bigDecimal is not correct", + big.doubleValue() == 0.1); + big = new BigDecimal(0.00345); + assertTrue("the double representation of 0.00345 bigDecimal is not correct", big + .doubleValue() == 0.00345); + // regression test for HARMONY-2429 + big = new BigDecimal(-0.0); + assertTrue("the double representation of -0.0 bigDecimal is not correct", big.scale() == 0); + } + + /** + * @tests java.math.BigDecimal#BigDecimal(java.lang.String) + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {java.lang.String.class} + ) + public void test_Constructor_java_lang_String() throws NumberFormatException { + BigDecimal big = new BigDecimal("345.23499600293850"); + assertTrue("the BigDecimal value is not initialized properly", big.toString().equals( + "345.23499600293850") + && big.scale() == 14); + big = new BigDecimal("-12345"); + assertTrue("the BigDecimal value is not initialized properly", big.toString().equals( + "-12345") + && big.scale() == 0); + big = new BigDecimal("123."); + assertTrue("the BigDecimal value is not initialized properly", big.toString().equals("123") + && big.scale() == 0); + + } + +} diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConvertTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalConvertTest.java index 9fb353f..5015ae0 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConvertTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalConvertTest.java @@ -19,12 +19,12 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.math.BigDecimal; import java.math.BigInteger; @@ -42,15 +42,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Double value of a negative BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValueNeg() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -61,15 +58,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Double value of a positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValuePos() { String a = "123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -80,15 +74,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Double value of a large positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValuePosInfinity() { String a = "123809648392384754573567356745735.63567890295784902768787678287E+400"; BigDecimal aNumber = new BigDecimal(a); @@ -99,15 +90,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Double value of a large negative BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValueNegInfinity() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E+400"; BigDecimal aNumber = new BigDecimal(a); @@ -118,15 +106,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Double value of a small negative BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValueMinusZero() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E-400"; BigDecimal aNumber = new BigDecimal(a); @@ -138,15 +123,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Double value of a small positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValuePlusZero() { String a = "123809648392384754573567356745735.63567890295784902768787678287E-400"; BigDecimal aNumber = new BigDecimal(a); @@ -158,15 +140,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Float value of a negative BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValueNeg() { String a = "-1238096483923847.6356789029578E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -177,15 +156,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Float value of a positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValuePos() { String a = "1238096483923847.6356789029578E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -196,15 +172,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Float value of a large positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValuePosInfinity() { String a = "123809648373567356745735.6356789787678287E+200"; BigDecimal aNumber = new BigDecimal(a); @@ -215,15 +188,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Float value of a large negative BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValueNegInfinity() { String a = "-123809648392384755735.63567887678287E+200"; BigDecimal aNumber = new BigDecimal(a); @@ -234,15 +204,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Float value of a small negative BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValueMinusZero() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E-400"; BigDecimal aNumber = new BigDecimal(a); @@ -254,15 +221,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Float value of a small positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValuePlusZero() { String a = "123809648392384754573567356745735.63567890295784902768787678287E-400"; BigDecimal aNumber = new BigDecimal(a); @@ -274,15 +238,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Integer value of a negative BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for intValue method.", - targets = { - @TestTarget( - methodName = "intValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for intValue method.", + method = "intValue", + args = {} + ) public void testIntValueNeg() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -293,15 +254,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Integer value of a positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for intValue method.", - targets = { - @TestTarget( - methodName = "intValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for intValue method.", + method = "intValue", + args = {} + ) public void testIntValuePos() { String a = "123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -312,15 +270,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Long value of a negative BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for longValue method", - targets = { - @TestTarget( - methodName = "longValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for longValue method", + method = "longValue", + args = {} + ) public void testLongValueNeg() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -331,15 +286,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Long value of a positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for longValue method", - targets = { - @TestTarget( - methodName = "longValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for longValue method", + method = "longValue", + args = {} + ) public void testLongValuePos() { String a = "123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -350,15 +302,12 @@ public class BigDecimalConvertTest extends TestCase { /** * scaleByPowerOfTen(int n) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed", - targets = { - @TestTarget( - methodName = "scaleByPowerOfTen", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed", + method = "scaleByPowerOfTen", + args = {int.class} + ) public void testScaleByPowerOfTen1() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 13; @@ -373,15 +322,12 @@ public class BigDecimalConvertTest extends TestCase { /** * scaleByPowerOfTen(int n) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed", - targets = { - @TestTarget( - methodName = "scaleByPowerOfTen", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed", + method = "scaleByPowerOfTen", + args = {int.class} + ) public void testScaleByPowerOfTen2() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = -13; @@ -396,15 +342,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Convert a positive BigDecimal to BigInteger */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toBigInteger method", - targets = { - @TestTarget( - methodName = "toBigInteger", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toBigInteger method", + method = "toBigInteger", + args = {} + ) public void testToBigIntegerPos1() { String a = "123809648392384754573567356745735.63567890295784902768787678287E+21"; BigInteger bNumber = new BigInteger("123809648392384754573567356745735635678902957849027687"); @@ -416,15 +359,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Convert a positive BigDecimal to BigInteger */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toBigInteger method", - targets = { - @TestTarget( - methodName = "toBigInteger", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toBigInteger method", + method = "toBigInteger", + args = {} + ) public void testToBigIntegerPos2() { String a = "123809648392384754573567356745735.63567890295784902768787678287E+15"; BigInteger bNumber = new BigInteger("123809648392384754573567356745735635678902957849"); @@ -436,15 +376,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Convert a positive BigDecimal to BigInteger */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toBigInteger method", - targets = { - @TestTarget( - methodName = "toBigInteger", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toBigInteger method", + method = "toBigInteger", + args = {} + ) public void testToBigIntegerPos3() { String a = "123809648392384754573567356745735.63567890295784902768787678287E+45"; BigInteger bNumber = new BigInteger("123809648392384754573567356745735635678902957849027687876782870000000000000000"); @@ -456,15 +393,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Convert a negative BigDecimal to BigInteger */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toBigInteger method", - targets = { - @TestTarget( - methodName = "toBigInteger", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toBigInteger method", + method = "toBigInteger", + args = {} + ) public void testToBigIntegerNeg1() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21"; BigInteger bNumber = new BigInteger("-123809648392384754573567356745735635678902957849027687"); @@ -476,15 +410,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Convert a negative BigDecimal to BigInteger */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toBigInteger method", - targets = { - @TestTarget( - methodName = "toBigInteger", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toBigInteger method", + method = "toBigInteger", + args = {} + ) public void testToBigIntegerNeg2() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E+15"; BigInteger bNumber = new BigInteger("-123809648392384754573567356745735635678902957849"); @@ -496,15 +427,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Convert a negative BigDecimal to BigInteger */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toBigInteger method", - targets = { - @TestTarget( - methodName = "toBigInteger", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toBigInteger method", + method = "toBigInteger", + args = {} + ) public void testToBigIntegerNeg3() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E+45"; BigInteger bNumber = new BigInteger("-123809648392384754573567356745735635678902957849027687876782870000000000000000"); @@ -516,15 +444,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Convert a small BigDecimal to BigInteger */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toBigInteger method", - targets = { - @TestTarget( - methodName = "toBigInteger", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toBigInteger method", + method = "toBigInteger", + args = {} + ) public void testToBigIntegerZero() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E-500"; BigInteger bNumber = new BigInteger("0"); @@ -536,15 +461,12 @@ public class BigDecimalConvertTest extends TestCase { /** * toBigIntegerExact() */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toBigIntegerExact method", - targets = { - @TestTarget( - methodName = "toBigIntegerExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toBigIntegerExact method", + method = "toBigIntegerExact", + args = {} + ) public void testToBigIntegerExact1() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E+45"; BigDecimal aNumber = new BigDecimal(a); @@ -556,15 +478,12 @@ public class BigDecimalConvertTest extends TestCase { /** * toBigIntegerExact() */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toBigIntegerExact method", - targets = { - @TestTarget( - methodName = "toBigIntegerExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toBigIntegerExact method", + method = "toBigIntegerExact", + args = {} + ) public void testToBigIntegerExactException() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E-10"; BigDecimal aNumber = new BigDecimal(a); @@ -579,15 +498,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Convert a positive BigDecimal to an engineering string representation */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toEngineeringString method", - targets = { - @TestTarget( - methodName = "toEngineeringString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toEngineeringString method", + method = "toEngineeringString", + args = {} + ) public void testToEngineeringStringPos() { String a = "123809648392384754573567356745735.63567890295784902768787678287E-501"; BigDecimal aNumber = new BigDecimal(a); @@ -598,15 +514,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Convert a negative BigDecimal to an engineering string representation */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toEngineeringString method", - targets = { - @TestTarget( - methodName = "toEngineeringString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toEngineeringString method", + method = "toEngineeringString", + args = {} + ) public void testToEngineeringStringNeg() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E-501"; BigDecimal aNumber = new BigDecimal(a); @@ -617,15 +530,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Convert a negative BigDecimal to an engineering string representation */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toEngineeringString method", - targets = { - @TestTarget( - methodName = "toEngineeringString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toEngineeringString method", + method = "toEngineeringString", + args = {} + ) public void testToEngineeringStringZeroPosExponent() { String a = "0.0E+16"; BigDecimal aNumber = new BigDecimal(a); @@ -636,15 +546,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Convert a negative BigDecimal to an engineering string representation */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toEngineeringString method", - targets = { - @TestTarget( - methodName = "toEngineeringString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toEngineeringString method", + method = "toEngineeringString", + args = {} + ) public void testToEngineeringStringZeroNegExponent() { String a = "0.0E-16"; BigDecimal aNumber = new BigDecimal(a); @@ -656,15 +563,12 @@ public class BigDecimalConvertTest extends TestCase { * Convert a negative BigDecimal with a negative exponent to a plain string * representation; scale == 0. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toPlainString method", - targets = { - @TestTarget( - methodName = "toPlainString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toPlainString method", + method = "toPlainString", + args = {} + ) public void testToPlainStringNegNegExp() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E-100"; BigDecimal aNumber = new BigDecimal(a); @@ -677,15 +581,12 @@ public class BigDecimalConvertTest extends TestCase { * to a plain string representation; * scale == 0. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toPlainString method", - targets = { - @TestTarget( - methodName = "toPlainString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toPlainString method", + method = "toPlainString", + args = {} + ) public void testToPlainStringNegPosExp() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E100"; BigDecimal aNumber = new BigDecimal(a); @@ -698,15 +599,12 @@ public class BigDecimalConvertTest extends TestCase { * to a plain string representation; * scale == 0. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toPlainString method", - targets = { - @TestTarget( - methodName = "toPlainString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toPlainString method", + method = "toPlainString", + args = {} + ) public void testToPlainStringPosNegExp() { String a = "123809648392384754573567356745735.63567890295784902768787678287E-100"; BigDecimal aNumber = new BigDecimal(a); @@ -719,15 +617,12 @@ public class BigDecimalConvertTest extends TestCase { * to a plain string representation; * scale == 0. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toPlainString method", - targets = { - @TestTarget( - methodName = "toPlainString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toPlainString method", + method = "toPlainString", + args = {} + ) public void testToPlainStringPosPosExp() { String a = "123809648392384754573567356745735.63567890295784902768787678287E+100"; BigDecimal aNumber = new BigDecimal(a); @@ -739,15 +634,12 @@ public class BigDecimalConvertTest extends TestCase { * Convert a BigDecimal to a string representation; * scale == 0. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {} + ) public void testToStringZeroScale() { String a = "-123809648392384754573567356745735635678902957849027687876782870"; BigDecimal aNumber = new BigDecimal(new BigInteger(a)); @@ -758,15 +650,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Convert a positive BigDecimal to a string representation */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {} + ) public void testToStringPos() { String a = "123809648392384754573567356745735.63567890295784902768787678287E-500"; BigDecimal aNumber = new BigDecimal(a); @@ -777,15 +666,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Convert a negative BigDecimal to a string representation */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {} + ) public void testToStringNeg() { String a = "-123.4564563673567380964839238475457356735674573563567890295784902768787678287E-5"; BigDecimal aNumber = new BigDecimal(a); @@ -796,15 +682,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Create a BigDecimal from a positive long value; scale == 0 */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf(long) method", + method = "valueOf", + args = {long.class} + ) public void testValueOfPosZeroScale() { long a = 98374823947823578L; BigDecimal aNumber = BigDecimal.valueOf(a); @@ -815,15 +698,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Create a BigDecimal from a negative long value; scale is 0 */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf(long) method", + method = "valueOf", + args = {long.class} + ) public void testValueOfNegZeroScale() { long a = -98374823947823578L; BigDecimal aNumber = BigDecimal.valueOf(a); @@ -834,15 +714,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Create a BigDecimal from a negative long value; scale is positive */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf(long) method", + method = "valueOf", + args = {long.class} + ) public void testValueOfNegScalePos() { long a = -98374823947823578L; int scale = 12; @@ -854,15 +731,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Create a BigDecimal from a negative long value; scale is negative */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf(long) method", + method = "valueOf", + args = {long.class} + ) public void testValueOfNegScaleNeg() { long a = -98374823947823578L; int scale = -12; @@ -874,15 +748,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Create a BigDecimal from a negative long value; scale is positive */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf(long) method", + method = "valueOf", + args = {long.class} + ) public void testValueOfPosScalePos() { long a = 98374823947823578L; int scale = 12; @@ -894,15 +765,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Create a BigDecimal from a negative long value; scale is negative */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf(long) method", + method = "valueOf", + args = {long.class} + ) public void testValueOfPosScaleNeg() { long a = 98374823947823578L; int scale = -12; @@ -914,15 +782,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Create a BigDecimal from a negative double value */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf(double) method", + method = "valueOf", + args = {double.class} + ) public void testValueOfDoubleNeg() { double a = -65678765876567576.98788767; BigDecimal result = BigDecimal.valueOf(a); @@ -935,15 +800,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Create a BigDecimal from a positive double value */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf(double) method", + method = "valueOf", + args = {double.class} + ) public void testValueOfDoublePos1() { double a = 65678765876567576.98788767; BigDecimal result = BigDecimal.valueOf(a); @@ -956,15 +818,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Create a BigDecimal from a positive double value */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf(double) method", + method = "valueOf", + args = {double.class} + ) public void testValueOfDoublePos2() { double a = 12321237576.98788767; BigDecimal result = BigDecimal.valueOf(a); @@ -977,15 +836,12 @@ public class BigDecimalConvertTest extends TestCase { /** * Create a BigDecimal from a positive double value */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf(double) method", + method = "valueOf", + args = {double.class} + ) public void testValueOfDoublePos3() { double a = 12321237576.9878838; BigDecimal result = BigDecimal.valueOf(a); @@ -998,15 +854,12 @@ public class BigDecimalConvertTest extends TestCase { /** * valueOf(Double.NaN) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Checks NumberFormatException", - targets = { - @TestTarget( - methodName = "valueOf", - methodArgs = {double.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf(double) method", + method = "valueOf", + args = {double.class} + ) public void testValueOfDoubleNaN() { double a = Double.NaN; try { @@ -1023,15 +876,12 @@ public class BigDecimalConvertTest extends TestCase { * @tests java.math.BigDecimal#intValueExact() Integer value of a negative * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for intValueExact method", - targets = { - @TestTarget( - methodName = "intValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for intValueExact method", + method = "intValueExact", + args = {} + ) public void test_IntValueExactNeg() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -1047,15 +897,12 @@ public class BigDecimalConvertTest extends TestCase { * @tests java.math.BigDecimal#intValueExact() Integer value of a positive * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for intValueExact method", - targets = { - @TestTarget( - methodName = "intValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for intValueExact method", + method = "intValueExact", + args = {} + ) public void test_IntValueExactPos() { String a = "123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -1071,15 +918,12 @@ public class BigDecimalConvertTest extends TestCase { * @tests java.math.BigDecimal#intValueExact() Integer value of a negative * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for intValueExact method", - targets = { - @TestTarget( - methodName = "intValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for intValueExact method", + method = "intValueExact", + args = {} + ) public void test_IntValueExactFloatNeg() { BigDecimal aNumber = new BigDecimal("-2147483647.999"); try { @@ -1094,15 +938,12 @@ public class BigDecimalConvertTest extends TestCase { * @tests java.math.BigDecimal#intValueExact() Integer value of a positive * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for intValueExact method", - targets = { - @TestTarget( - methodName = "intValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for intValueExact method", + method = "intValueExact", + args = {} + ) public void test_IntValueExactFloatPos() { float a = 2147483646.99999F; BigDecimal aNumber = new BigDecimal(a); @@ -1118,15 +959,12 @@ public class BigDecimalConvertTest extends TestCase { * @tests java.math.BigDecimal#intValueExact() Integer value of a positive * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for intValueExact method", - targets = { - @TestTarget( - methodName = "intValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for intValueExact method", + method = "intValueExact", + args = {} + ) public void test_IntValueExactLongPos() { long a = 2147483647L; BigDecimal aNumber = new BigDecimal(a); @@ -1138,15 +976,12 @@ public class BigDecimalConvertTest extends TestCase { * @tests java.math.BigDecimal#intValueExact() Integer value of a positive * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for intValueExact method", - targets = { - @TestTarget( - methodName = "intValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for intValueExact method", + method = "intValueExact", + args = {} + ) public void test_IntValueExactLongNeg() { long a = -2147483648L; BigDecimal aNumber = new BigDecimal(a); @@ -1158,15 +993,12 @@ public class BigDecimalConvertTest extends TestCase { * @tests java.math.BigDecimal#longValueExact() Long value of a negative * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checked", - targets = { - @TestTarget( - methodName = "longValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checked", + method = "longValueExact", + args = {} + ) public void test_LongValueExactNeg() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -1182,15 +1014,12 @@ public class BigDecimalConvertTest extends TestCase { * @tests java.math.BigDecimal#longValueExact() Long value of a positive * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "ArithmeticException checked", - targets = { - @TestTarget( - methodName = "longValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "ArithmeticException checked", + method = "longValueExact", + args = {} + ) public void test_LongValueExactPos() { String a = "123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -1206,15 +1035,12 @@ public class BigDecimalConvertTest extends TestCase { * @tests java.math.BigDecimal#longValueExact() Long value of a negative * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "ArithmeticException checked", - targets = { - @TestTarget( - methodName = "longValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "ArithmeticException checked", + method = "longValueExact", + args = {} + ) public void test_LongValueExactFloatNeg() { BigDecimal aNumber = new BigDecimal("-9223372036854775807.99999"); try { @@ -1229,15 +1055,12 @@ public class BigDecimalConvertTest extends TestCase { * @tests java.math.BigDecimal#longValueExact() Long value of a positive * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "ArithmeticException checked", - targets = { - @TestTarget( - methodName = "longValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "ArithmeticException checked", + method = "longValueExact", + args = {} + ) public void test_LongValueExactFloatPos() { float a = 9223372036854775806.99999F; BigDecimal aNumber = new BigDecimal(a); @@ -1253,15 +1076,12 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#byteValueExact() Convert pisitive BigDesimal * to byte type */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for byteValueExact method", - targets = { - @TestTarget( - methodName = "byteValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for byteValueExact method", + method = "byteValueExact", + args = {} + ) public void test_ByteValueExactPos() { int i = 127; BigDecimal bdNumber = new BigDecimal(i); @@ -1273,15 +1093,12 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#byteValueExact() Convert negative BigDesimal * to byte type */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for byteValueExact method", - targets = { - @TestTarget( - methodName = "byteValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for byteValueExact method", + method = "byteValueExact", + args = {} + ) public void test_ByteValueExactNeg() { String sNumber = "-127.56789"; int iNumber = -128; @@ -1297,15 +1114,12 @@ public class BigDecimalConvertTest extends TestCase { * from char array to byte type */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for byteValueExact method", - targets = { - @TestTarget( - methodName = "byteValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for byteValueExact method", + method = "byteValueExact", + args = {} + ) public void test_ByteValueExactCharZero() { char[] cNumber = { '-', '0', '.', '0' @@ -1323,15 +1137,12 @@ public class BigDecimalConvertTest extends TestCase { * from String to byte type */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for byteValueExact method", - targets = { - @TestTarget( - methodName = "byteValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for byteValueExact method", + method = "byteValueExact", + args = {} + ) public void test_ByteValueExactStringZero() { String sNumber = "00000000000000"; int iNumber = 0; @@ -1347,15 +1158,12 @@ public class BigDecimalConvertTest extends TestCase { * from double to byte type */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for byteValueExact method", - targets = { - @TestTarget( - methodName = "byteValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for byteValueExact method", + method = "byteValueExact", + args = {} + ) public void test_ByteValueExactDoubleMax() { double dNumber = Double.MAX_VALUE; BigDecimal bdNumber = new BigDecimal(dNumber); @@ -1372,15 +1180,12 @@ public class BigDecimalConvertTest extends TestCase { * from double to byte type */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for byteValueExact method", - targets = { - @TestTarget( - methodName = "byteValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for byteValueExact method", + method = "byteValueExact", + args = {} + ) public void test_ByteValueExactDoubleMin() { double dNumber = Double.MIN_VALUE; BigDecimal bdNumber = new BigDecimal(dNumber); @@ -1397,15 +1202,12 @@ public class BigDecimalConvertTest extends TestCase { * from float to byte type */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for byteValueExact method", - targets = { - @TestTarget( - methodName = "byteValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for byteValueExact method", + method = "byteValueExact", + args = {} + ) public void test_ByteValueExactFloatPos() { float fNumber = 123.5445F; BigDecimal bdNumber = new BigDecimal(fNumber); @@ -1422,15 +1224,12 @@ public class BigDecimalConvertTest extends TestCase { * from float to byte type */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for byteValueExact method", - targets = { - @TestTarget( - methodName = "byteValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for byteValueExact method", + method = "byteValueExact", + args = {} + ) public void test_ByteValueExactFloatNeg() { float fNumber = -12.987654321F; BigDecimal bdNumber = new BigDecimal(fNumber); @@ -1447,15 +1246,12 @@ public class BigDecimalConvertTest extends TestCase { * from double to byte type */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for byteValueExact method", - targets = { - @TestTarget( - methodName = "byteValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for byteValueExact method", + method = "byteValueExact", + args = {} + ) public void test_ByteValueExactDouble() { double dNumber = 123.0000D; BigDecimal bdNumber = new BigDecimal(dNumber); @@ -1468,15 +1264,12 @@ public class BigDecimalConvertTest extends TestCase { * from long to byte type */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for byteValueExact method", - targets = { - @TestTarget( - methodName = "byteValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for byteValueExact method", + method = "byteValueExact", + args = {} + ) public void test_ByteValueExactLongMin() { long lNumber = Long.MIN_VALUE; BigDecimal bdNumber = new BigDecimal(lNumber); @@ -1493,15 +1286,12 @@ public class BigDecimalConvertTest extends TestCase { * from int to byte type */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for byteValueExact method", - targets = { - @TestTarget( - methodName = "byteValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for byteValueExact method", + method = "byteValueExact", + args = {} + ) public void test_ByteValueExactIntMax() { int iNumber = Integer.MAX_VALUE; BigDecimal bdNumber = new BigDecimal(iNumber); @@ -1517,6 +1307,11 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#byteValue() Convert pisitive BigDesimal to * byte type */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "byteValue", + args = {} + ) public void test_ByteValuePos() { int i = 127; BigDecimal bdNumber = new BigDecimal(i); @@ -1528,6 +1323,11 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#byteValue() Convert negative BigDesimal to * byte type */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "byteValue", + args = {} + ) public void test_ByteValueNeg() { String sNumber = "-127.56789"; int iNumber = -128; @@ -1542,7 +1342,11 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#byteValue() Convert BigDesimal created from * char array to byte type */ - + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "byteValue", + args = {} + ) public void test_ByteValueCharZero() { char[] cNumber = { '-', '0', '.', '0' @@ -1559,7 +1363,11 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#byteValue() Convert BigDesimal created from * String to byte type */ - + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "byteValue", + args = {} + ) public void test_ByteValueStringZero() { String sNumber = "00000"; int iNumber = 0; @@ -1574,7 +1382,11 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#byteValue() Convert BigDesimal created from * double to byte type */ - + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "byteValue", + args = {} + ) public void test_ByteValueDoubleMax() { double dNumber = Double.MAX_VALUE; BigDecimal bdNumber = new BigDecimal(dNumber); @@ -1587,7 +1399,11 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#byteValue() Convert BigDesimal created from * double to byte type */ - + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "byteValue", + args = {} + ) public void test_ByteValueDoubleMin() { double dNumber = Double.MIN_VALUE; BigDecimal bdNumber = new BigDecimal(dNumber); @@ -1600,7 +1416,11 @@ public class BigDecimalConvertTest extends TestCase { * @test_ java.math.BigDecimal#byteValue() Convert BigDesimal created from * float to byte type */ - + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "byteValue", + args = {} + ) public void test_ByteValueFloatNeg() { float fNumber = -12.987654321F; byte bValue = -12; @@ -1613,7 +1433,11 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#byteValue() Convert BigDesimal created from * double to byte type */ - + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "byteValue", + args = {} + ) public void test_ByteValueDouble() { double dNumber = 123.0000D; BigDecimal bdNumber = new BigDecimal(dNumber); @@ -1625,7 +1449,11 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#byteValue() Convert BigDesimal created from * long to byte type */ - + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "byteValue", + args = {} + ) public void test_ByteValueLongMin() { long lNumber = Long.MIN_VALUE; int result = 0; @@ -1638,7 +1466,11 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#byteValue() Convert BigDesimal created from * int to byte type */ - + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "byteValue", + args = {} + ) public void test_ByteValueIntMin() { int iNumber = Integer.MIN_VALUE; int result = 0; @@ -1651,7 +1483,11 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#byteValue() Convert BigDesimal created from * int to byte type */ - + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "byteValue", + args = {} + ) public void test_ByteValueIntMax() { int iNumber = Integer.MAX_VALUE; int result = -1; @@ -1664,6 +1500,11 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#shortValue() Short value of a negative * BigDecimal */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "shortValue", + args = {} + ) public void test_ShortValueNeg() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -1675,6 +1516,11 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#shortValue() Short value of a positive * BigDecimal */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "shortValue", + args = {} + ) public void test_ShortValuePos() { String a = "123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -1686,15 +1532,12 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#shortValueExact() Short value of a negative * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shortValueExact method", - targets = { - @TestTarget( - methodName = "shortValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shortValueExact method", + method = "shortValueExact", + args = {} + ) public void test_ShortValueExactNeg() { String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -1710,15 +1553,12 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#shortValueExact() Short value of a positive * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shortValueExact method", - targets = { - @TestTarget( - methodName = "shortValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shortValueExact method", + method = "shortValueExact", + args = {} + ) public void test_ShortValueExactPos() { String a = "123809648392384754573567356745735.63567890295784902768787678287E+21"; BigDecimal aNumber = new BigDecimal(a); @@ -1734,15 +1574,12 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#shortValueExact() Short value of a negative * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shortValueExact method", - targets = { - @TestTarget( - methodName = "shortValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shortValueExact method", + method = "shortValueExact", + args = {} + ) public void test_ShortValueExactFloatNeg() { BigDecimal aNumber = new BigDecimal("-32766.99999"); try { @@ -1757,15 +1594,12 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#shortValueExact() Short value of a positive * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shortValueExact method", - targets = { - @TestTarget( - methodName = "shortValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shortValueExact method", + method = "shortValueExact", + args = {} + ) public void test_ShortValueExactFloatPos() { float a = 32767.99999F; BigDecimal aNumber = new BigDecimal(a); @@ -1781,15 +1615,12 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#shortValueExact() Short value of a positive * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shortValueExact method", - targets = { - @TestTarget( - methodName = "shortValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shortValueExact method", + method = "shortValueExact", + args = {} + ) public void test_ShortValueExactLongPos() { long a = 12345L; BigDecimal aNumber = new BigDecimal(a); @@ -1801,15 +1632,12 @@ public class BigDecimalConvertTest extends TestCase { * @test java.math.BigDecimal#shortValueExact() Short value of a positive * BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shortValueExact method", - targets = { - @TestTarget( - methodName = "shortValueExact", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shortValueExact method", + method = "shortValueExact", + args = {} + ) public void test_ShortValueExactLongNeg() { long a = -12345L; BigDecimal aNumber = new BigDecimal(a); @@ -1821,15 +1649,12 @@ public class BigDecimalConvertTest extends TestCase { * @tests java.math.BigDecimal#stripTrailingZeros() stripTrailingZeros() for * BigDecimal with zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for stripTrailingZeros method", - targets = { - @TestTarget( - methodName = "stripTrailingZeros", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for stripTrailingZeros method", + method = "stripTrailingZeros", + args = {} + ) public void test_stripTrailingZerosZeros() { BigDecimal bdNumber = new BigDecimal("0000000"); @@ -1852,15 +1677,12 @@ public class BigDecimalConvertTest extends TestCase { * @tests java.math.BigDecimal#stripTrailingZeros() stripTrailingZeros() for * positive BigDecimal */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for stripTrailingZeros method", - targets = { - @TestTarget( - methodName = "stripTrailingZeros", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for stripTrailingZeros method", + method = "stripTrailingZeros", + args = {} + ) public void test_stripTrailingZeros() { String s = "00000000100000000100000000.000000000100000000"; diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalScaleOperationsTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalScaleOperationsTest.java index 4c618df..3444a27 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalScaleOperationsTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigDecimalScaleOperationsTest.java @@ -19,16 +19,18 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; -import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.KnownFailure; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; - -import java.math.*; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; import junit.framework.TestCase; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.math.RoundingMode; @TestTargetClass(BigDecimal.class) /** * Class: java.math.BigDecimal @@ -38,15 +40,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Check the default scale */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for scale method.", - targets = { - @TestTarget( - methodName = "scale", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for scale method.", + method = "scale", + args = {} + ) public void testScaleDefault() { String a = "1231212478987482988429808779810457634781384756794987"; int cScale = 0; @@ -57,15 +56,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Check a negative scale */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for scale method.", - targets = { - @TestTarget( - methodName = "scale", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for scale method.", + method = "scale", + args = {} + ) public void testScaleNeg() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = -10; @@ -77,15 +73,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Check a positive scale */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for scale method.", - targets = { - @TestTarget( - methodName = "scale", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for scale method.", + method = "scale", + args = {} + ) public void testScalePos() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 10; @@ -97,15 +90,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Check the zero scale */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for scale method.", - targets = { - @TestTarget( - methodName = "scale", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for scale method.", + method = "scale", + args = {} + ) public void testScaleZero() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 0; @@ -117,15 +107,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Check the unscaled value */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "unscaledValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "unscaledValue", + args = {} + ) public void testUnscaledValue() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 100; @@ -137,15 +124,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Set a greater new scale */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setScale method.", - targets = { - @TestTarget( - methodName = "setScale", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setScale method.", + method = "setScale", + args = {int.class} + ) public void testSetScaleGreater() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 18; @@ -159,15 +143,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Set a less new scale; this.scale == 8; newScale == 5. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setScale method.", - targets = { - @TestTarget( - methodName = "setScale", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setScale method.", + method = "setScale", + args = {int.class} + ) public void testSetScaleLess() { String a = "2.345726458768760000E+10"; int newScale = 5; @@ -180,15 +161,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Verify an exception when setting a new scale */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setScale method.", - targets = { - @TestTarget( - methodName = "setScale", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setScale method.", + method = "setScale", + args = {int.class} + ) public void testSetScaleException() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 28; @@ -205,15 +183,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Set the same new scale */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setScale method.", - targets = { - @TestTarget( - methodName = "setScale", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setScale method.", + method = "setScale", + args = {int.class} + ) public void testSetScaleSame() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 18; @@ -227,15 +202,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Set a new scale */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Exception checking missed.", - targets = { - @TestTarget( - methodName = "setScale", - methodArgs = {int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Exception checking missed.", + method = "setScale", + args = {int.class, int.class} + ) public void testSetScaleRoundUp() { String a = "1231212478987482988429808779810457634781384756794987"; String b = "123121247898748298842980877981045763478139"; @@ -250,15 +222,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Set a new scale */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Exception checking missed.", - targets = { - @TestTarget( - methodName = "setScale", - methodArgs = {int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Exception checking missed.", + method = "setScale", + args = {int.class, int.class} + ) public void testSetScaleRoundDown() { String a = "1231212478987482988429808779810457634781384756794987"; String b = "123121247898748298842980877981045763478138"; @@ -273,15 +242,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Set a new scale */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Exception checking missed.", - targets = { - @TestTarget( - methodName = "setScale", - methodArgs = {int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Exception checking missed.", + method = "setScale", + args = {int.class, int.class} + ) public void testSetScaleRoundCeiling() { String a = "1231212478987482988429808779810457634781384756794987"; String b = "123121247898748298842980877981045763478139"; @@ -296,15 +262,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Set a new scale */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Exception checking missed.", - targets = { - @TestTarget( - methodName = "setScale", - methodArgs = {int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Exception checking missed.", + method = "setScale", + args = {int.class, int.class} + ) public void testSetScaleRoundFloor() { String a = "1231212478987482988429808779810457634781384756794987"; String b = "123121247898748298842980877981045763478138"; @@ -319,15 +282,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Set a new scale */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Exception checking missed.", - targets = { - @TestTarget( - methodName = "setScale", - methodArgs = {int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Exception checking missed.", + method = "setScale", + args = {int.class, int.class} + ) public void testSetScaleRoundHalfUp() { String a = "1231212478987482988429808779810457634781384756794987"; String b = "123121247898748298842980877981045763478138"; @@ -342,15 +302,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Set a new scale */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Exception checking missed.", - targets = { - @TestTarget( - methodName = "setScale", - methodArgs = {int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Exception checking missed.", + method = "setScale", + args = {int.class, int.class} + ) public void testSetScaleRoundHalfDown() { String a = "1231212478987482988429808779810457634781384756794987"; String b = "123121247898748298842980877981045763478138"; @@ -365,15 +322,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Set a new scale */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Exception checking missed.", - targets = { - @TestTarget( - methodName = "setScale", - methodArgs = {int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Exception checking missed.", + method = "setScale", + args = {int.class, int.class} + ) public void testSetScaleRoundHalfEven() { String a = "1231212478987482988429808779810457634781384756794987"; String b = "123121247898748298842980877981045763478138"; @@ -388,15 +342,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * SetScale(int, RoundingMode) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Exception checking missed.", - targets = { - @TestTarget( - methodName = "setScale", - methodArgs = {int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Exception checking missed.", + method = "setScale", + args = {int.class, int.class} + ) public void testSetScaleIntRoundingMode() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 28; @@ -412,15 +363,11 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Move the decimal point to the left; the shift value is positive */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed", - targets = { - @TestTarget( - methodName = "movePointLeft", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "movePointLeft", + args = {int.class} + ) public void testMovePointLeftPos() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 28; @@ -435,15 +382,11 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Move the decimal point to the left; the shift value is positive */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed", - targets = { - @TestTarget( - methodName = "movePointLeft", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "movePointLeft", + args = {int.class} + ) public void testMovePointLeftNeg() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 28; @@ -455,18 +398,37 @@ public class BigDecimalScaleOperationsTest extends TestCase { assertTrue("incorrect value", bNumber.unscaledValue().toString().equals(a)); } + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "movePointLeft", + args = {int.class} + ) + public void testMovePointLeftEx() { + BigDecimal a = new BigDecimal("12345.6789012345678901234567890123456789"); + BigDecimal res = a.movePointLeft(10); + assertEquals("incorrect scale", 44, res.scale()); + assertEquals("incorrect value", "0.00000123456789012345678901234567890123456789", res.toString()); + res = a.movePointLeft(-50); + assertEquals("incorrect scale", 0, res.scale()); + assertEquals("incorrect value", "1234567890123456789012345678901234567890000000000000000", res.toString()); + try { + res = a.movePointLeft(Integer.MAX_VALUE - 2); +// assertEquals("incorrect value", "0.0938025", res[1].toString()); + fail("ArithmeticException is not thrown"); + } catch (ArithmeticException e) { + // expected + } + } + /** * Move the decimal point to the right; the shift value is positive */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for movePointRight method.", - targets = { - @TestTarget( - methodName = "movePointRight", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for movePointRight method.", + method = "movePointRight", + args = {int.class} + ) public void testMovePointRightPosGreater() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 28; @@ -481,15 +443,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Move the decimal point to the right; the shift value is positive */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for movePointRight method.", - targets = { - @TestTarget( - methodName = "movePointRight", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for movePointRight method.", + method = "movePointRight", + args = {int.class} + ) public void testMovePointRightPosLess() { String a = "1231212478987482988429808779810457634781384756794987"; String b = "123121247898748298842980877981045763478138475679498700"; @@ -505,15 +464,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Move the decimal point to the right; the shift value is positive */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for movePointRight method.", - targets = { - @TestTarget( - methodName = "movePointRight", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for movePointRight method.", + method = "movePointRight", + args = {int.class} + ) public void testMovePointRightNeg() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 28; @@ -528,15 +484,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { /** * Move the decimal point to the right when the scale overflows */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for movePointRight method.", - targets = { - @TestTarget( - methodName = "movePointRight", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for movePointRight method.", + method = "movePointRight", + args = {int.class} + ) public void testMovePointRightException() { String a = "12312124789874829887348723648726347429808779810457634781384756794987"; int aScale = Integer.MAX_VALUE; //2147483647 @@ -550,18 +503,86 @@ public class BigDecimalScaleOperationsTest extends TestCase { } } + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "movePointRight", + args = {int.class} + ) + public void testMovePointRightEx() { + BigDecimal a = new BigDecimal("12345.6789012345678901234567890123456789"); + BigDecimal res = a.movePointRight(10); + assertEquals("incorrect scale", 24, res.scale()); + assertEquals("incorrect value", "123456789012345.678901234567890123456789", res.toString()); + res = a.movePointRight(-50); + assertEquals("incorrect scale", 84, res.scale()); + assertEquals("incorrect value", "1.23456789012345678901234567890123456789E-46", res.toString()); + try { + res = a.movePointRight(Integer.MIN_VALUE + 2); + fail("ArithmeticException is not thrown"); + } catch (ArithmeticException e) { + // expected + } + } + + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "movePointRight", + args = {int.class} + ) + @KnownFailure("Throws ArrayIndexOutOfBoundsException instead of ArithmeticException!") + public void testMovePointRightEx2() { + BigDecimal a = new BigDecimal("123456789012345678901234567890123456789E25"); + try { + BigDecimal res = a.movePointRight(Integer.MAX_VALUE - 2); + fail("ArithmeticException is not thrown"); + } catch (ArithmeticException e) { + // expected + } + } + + /** + * scaleByPowerOfTen(int n) + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "scaleByPowerOfTen", + args = {int.class} + ) + public void testScaleByPowerOfTenEx() { + BigDecimal a = new BigDecimal("12345.6789012345678901234567890123456789"); + BigDecimal res = a.movePointRight(10); + assertEquals("incorrect scale", 24, res.scale()); + assertEquals("incorrect value", "123456789012345.678901234567890123456789", res.toString()); + res = a.scaleByPowerOfTen(-50); + assertEquals("incorrect scale", 84, res.scale()); + assertEquals("incorrect value", "1.23456789012345678901234567890123456789E-46", res.toString()); + res = a.scaleByPowerOfTen(50); + assertEquals("incorrect scale", -16, res.scale()); + assertEquals("incorrect value", "1.23456789012345678901234567890123456789E+54", res.toString()); + try { + res = a.scaleByPowerOfTen(Integer.MIN_VALUE + 2); + fail("ArithmeticException is not thrown"); + } catch (ArithmeticException e) { + // expected + } + a = new BigDecimal("123456789012345678901234567890123456789E25"); + try { + res = a.scaleByPowerOfTen(Integer.MAX_VALUE - 2); + fail("ArithmeticException is not thrown"); + } catch (ArithmeticException e) { + // expected + } + } + /** * precision() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "precision", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "precision", + args = {} + ) public void testPrecision() { String a = "12312124789874829887348723648726347429808779810457634781384756794987"; int aScale = 14; @@ -576,15 +597,12 @@ public class BigDecimalScaleOperationsTest extends TestCase { * check that setScale with a scale greater to the existing scale does not * change the value. */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "precision", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "precision", + args = {} + ) public void testSetScale() { BigDecimal x1 = new BigDecimal(1.23400); BigDecimal x2 = x1.setScale(75); diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAddTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerAddTest.java index b67389f..e7041fc 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAddTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerAddTest.java @@ -19,11 +19,11 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.math.BigInteger; @@ -38,15 +38,12 @@ public class BigIntegerAddTest extends TestCase { /** * Add two positive numbers of the same length */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase1() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -67,15 +64,12 @@ public class BigIntegerAddTest extends TestCase { /** * Add two negative numbers of the same length */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase2() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -98,15 +92,12 @@ public class BigIntegerAddTest extends TestCase { * The first one is positive and the second is negative. * The first one is greater in absolute value. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase3() { byte aBytes[] = {3, 4, 5, 6, 7, 8, 9}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7}; @@ -129,15 +120,12 @@ public class BigIntegerAddTest extends TestCase { * The first one is negative and the second is positive. * The first one is greater in absolute value. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase4() { byte aBytes[] = {3, 4, 5, 6, 7, 8, 9}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7}; @@ -160,15 +148,12 @@ public class BigIntegerAddTest extends TestCase { * The first is positive and the second is negative. * The first is less in absolute value. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase5() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {3, 4, 5, 6, 7, 8, 9}; @@ -191,15 +176,12 @@ public class BigIntegerAddTest extends TestCase { * The first one is negative and the second is positive. * The first one is less in absolute value. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase6() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {3, 4, 5, 6, 7, 8, 9}; @@ -221,15 +203,12 @@ public class BigIntegerAddTest extends TestCase { * Add two positive numbers of different length. * The first is longer. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase7() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -251,15 +230,12 @@ public class BigIntegerAddTest extends TestCase { * Add two positive numbers of different length. * The second is longer. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase8() { byte aBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; @@ -279,15 +255,12 @@ public class BigIntegerAddTest extends TestCase { * Add two negative numbers of different length. * The first is longer. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase9() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -309,15 +282,12 @@ public class BigIntegerAddTest extends TestCase { * Add two negative numbers of different length. * The second is longer. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase10() { byte aBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; @@ -340,15 +310,12 @@ public class BigIntegerAddTest extends TestCase { * The first is positive. * The first is longer. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase11() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -371,15 +338,12 @@ public class BigIntegerAddTest extends TestCase { * The first is positive. * The second is longer. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase12() { byte aBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; @@ -402,15 +366,12 @@ public class BigIntegerAddTest extends TestCase { * The first is negative. * The first is longer. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase13() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -433,15 +394,12 @@ public class BigIntegerAddTest extends TestCase { * The first is negative. * The second is longer. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase14() { byte aBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; @@ -462,15 +420,12 @@ public class BigIntegerAddTest extends TestCase { /** * Add two equal numbers of different signs */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase15() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7}; @@ -490,15 +445,12 @@ public class BigIntegerAddTest extends TestCase { /** * Add zero to a number */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase16() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {0}; @@ -519,15 +471,12 @@ public class BigIntegerAddTest extends TestCase { /** * Add a number to zero */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase17() { byte aBytes[] = {0}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7}; @@ -548,15 +497,12 @@ public class BigIntegerAddTest extends TestCase { /** * Add zero to zero */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase18() { byte aBytes[] = {0}; byte bBytes[] = {0}; @@ -577,15 +523,12 @@ public class BigIntegerAddTest extends TestCase { /** * Add ZERO to a number */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase19() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7}; byte rBytes[] = {1, 2, 3, 4, 5, 6, 7}; @@ -604,15 +547,12 @@ public class BigIntegerAddTest extends TestCase { /** * Add a number to zero */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase20() { byte bBytes[] = {1, 2, 3, 4, 5, 6, 7}; byte rBytes[] = {1, 2, 3, 4, 5, 6, 7}; @@ -631,15 +571,12 @@ public class BigIntegerAddTest extends TestCase { /** * Add ZERO to ZERO */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase21() { byte rBytes[] = {0}; BigInteger aNumber = BigInteger.ZERO; @@ -656,15 +593,12 @@ public class BigIntegerAddTest extends TestCase { /** * Add ONE to ONE */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase22() { byte rBytes[] = {2}; BigInteger aNumber = BigInteger.ONE; @@ -681,15 +615,12 @@ public class BigIntegerAddTest extends TestCase { /** * Add two numbers so that carry is 1 */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for add method.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for add method.", + method = "add", + args = {java.math.BigInteger.class} + ) public void testCase23() { byte aBytes[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; byte bBytes[] = {-1, -1, -1, -1, -1, -1, -1, -1}; diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAndTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerAndTest.java index f25dd6d..6dc96e9 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAndTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerAndTest.java @@ -19,12 +19,12 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.math.BigInteger; @@ -38,15 +38,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for zero and a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testZeroPos() { byte aBytes[] = {0}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -67,15 +64,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for zero and a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testZeroNeg() { byte aBytes[] = {0}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -96,15 +90,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for a positive number and zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testPosZero() { byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; byte bBytes[] = {0}; @@ -125,15 +116,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for a negative number and zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testNegPos() { byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; byte bBytes[] = {0}; @@ -154,15 +142,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for zero and zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testZeroZero() { byte aBytes[] = {0}; byte bBytes[] = {0}; @@ -183,15 +168,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for zero and one */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testZeroOne() { BigInteger aNumber = BigInteger.ZERO; BigInteger bNumber = BigInteger.ONE; @@ -203,15 +185,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for one and one */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testOneOne() { BigInteger aNumber = BigInteger.ONE; BigInteger bNumber = BigInteger.ONE; @@ -223,15 +202,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for two positive numbers of the same length */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testPosPosSameLength() { byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -252,15 +228,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for two positive numbers; the first is longer */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testPosPosFirstLonger() { byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -281,15 +254,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for two positive numbers; the first is shorter */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testPosPosFirstShorter() { byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; byte bBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; @@ -310,15 +280,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for two negative numbers of the same length */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testNegNegSameLength() { byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -339,15 +306,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for two negative numbers; the first is longer */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testNegNegFirstLonger() { byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -368,15 +332,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for two negative numbers; the first is shorter */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testNegNegFirstShorter() { byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; byte bBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; @@ -397,15 +358,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for two numbers of different signs and the same length */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testPosNegSameLength() { byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -426,15 +384,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for two numbers of different signs and the same length */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testNegPosSameLength() { byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -455,15 +410,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for a negative and a positive numbers; the first is longer */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testNegPosFirstLonger() { byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -484,15 +436,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for a negative and a positive numbers; the first is shorter */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testNegPosFirstShorter() { byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; byte bBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; @@ -513,15 +462,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for a positive and a negative numbers; the first is longer */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testPosNegFirstLonger() { byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -542,15 +488,12 @@ public class BigIntegerAndTest extends TestCase { /** * And for a positive and a negative numbers; the first is shorter */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testPosNegFirstShorter() { byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; byte bBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; @@ -571,15 +514,12 @@ public class BigIntegerAndTest extends TestCase { /** * Test for a special case */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testSpecialCase1() { byte aBytes[] = {-1, -1, -1, -1}; byte bBytes[] = {5, -4, -3, -2}; @@ -600,15 +540,12 @@ public class BigIntegerAndTest extends TestCase { /** * Test for a special case */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for and method.", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for and method.", + method = "and", + args = {java.math.BigInteger.class} + ) public void testSpecialCase2() { byte aBytes[] = {-51}; byte bBytes[] = {-52, -51, -50, -49, -48}; diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerCompareTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerCompareTest.java index 153a002..ef982cb 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerCompareTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerCompareTest.java @@ -19,12 +19,12 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.math.BigInteger; @@ -38,15 +38,12 @@ public class BigIntegerCompareTest extends TestCase { /** * abs() for a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for abs method.", - targets = { - @TestTarget( - methodName = "abs", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for abs method.", + method = "abs", + args = {} + ) public void testAbsPositive() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7}; int aSign = 1; @@ -64,15 +61,12 @@ public class BigIntegerCompareTest extends TestCase { /** * abs() for a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for abs method.", - targets = { - @TestTarget( - methodName = "abs", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for abs method.", + method = "abs", + args = {} + ) public void testAbsNegative() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7}; int aSign = -1; @@ -92,15 +86,12 @@ public class BigIntegerCompareTest extends TestCase { * Compare two positive numbers. * The first is greater. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigInteger.class} + ) public void testCompareToPosPos1() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -116,15 +107,12 @@ public class BigIntegerCompareTest extends TestCase { * Compare two positive numbers. * The first is less. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigInteger.class} + ) public void testCompareToPosPos2() { byte aBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; byte bBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; @@ -139,15 +127,12 @@ public class BigIntegerCompareTest extends TestCase { * compareTo(BigInteger a). * Compare two equal positive numbers. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigInteger.class} + ) public void testCompareToEqualPos() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; @@ -163,15 +148,12 @@ public class BigIntegerCompareTest extends TestCase { * Compare two negative numbers. * The first is greater in absolute value. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigInteger.class} + ) public void testCompareToNegNeg1() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -187,15 +169,12 @@ public class BigIntegerCompareTest extends TestCase { * Compare two negative numbers. * The first is less in absolute value. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigInteger.class} + ) public void testCompareNegNeg2() { byte aBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; byte bBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; @@ -210,15 +189,12 @@ public class BigIntegerCompareTest extends TestCase { * compareTo(BigInteger a). * Compare two equal negative numbers. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigInteger.class} + ) public void testCompareToEqualNeg() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; @@ -234,15 +210,12 @@ public class BigIntegerCompareTest extends TestCase { * Compare two numbers of different signs. * The first is positive. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigInteger.class} + ) public void testCompareToDiffSigns1() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -258,15 +231,12 @@ public class BigIntegerCompareTest extends TestCase { * Compare two numbers of different signs. * The first is negative. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigInteger.class} + ) public void testCompareToDiffSigns2() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -281,15 +251,12 @@ public class BigIntegerCompareTest extends TestCase { * compareTo(BigInteger a). * Compare a positive number to ZERO. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigInteger.class} + ) public void testCompareToPosZero() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int aSign = 1; @@ -302,15 +269,12 @@ public class BigIntegerCompareTest extends TestCase { * compareTo(BigInteger a). * Compare ZERO to a positive number. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigInteger.class} + ) public void testCompareToZeroPos() { byte bBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int bSign = 1; @@ -323,15 +287,12 @@ public class BigIntegerCompareTest extends TestCase { * compareTo(BigInteger a). * Compare a negative number to ZERO. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigInteger.class} + ) public void testCompareToNegZero() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int aSign = -1; @@ -344,15 +305,12 @@ public class BigIntegerCompareTest extends TestCase { * compareTo(BigInteger a). * Compare ZERO to a negative number. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigInteger.class} + ) public void testCompareToZeroNeg() { byte bBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int bSign = -1; @@ -365,15 +323,12 @@ public class BigIntegerCompareTest extends TestCase { * compareTo(BigInteger a). * Compare ZERO to ZERO. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for compareTo method.", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for compareTo method.", + method = "compareTo", + args = {java.math.BigInteger.class} + ) public void testCompareToZeroZero() { BigInteger aNumber = BigInteger.ZERO; BigInteger bNumber = BigInteger.ZERO; @@ -384,15 +339,12 @@ public class BigIntegerCompareTest extends TestCase { * equals(Object obj). * obj is not a BigInteger */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for equals method.", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for equals method.", + method = "equals", + args = {java.lang.Object.class} + ) public void testEqualsObject() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int aSign = 1; @@ -404,15 +356,12 @@ public class BigIntegerCompareTest extends TestCase { /** * equals(null). */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for equals method.", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for equals method.", + method = "equals", + args = {java.lang.Object.class} + ) public void testEqualsNull() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int aSign = 1; @@ -425,15 +374,12 @@ public class BigIntegerCompareTest extends TestCase { * obj is a BigInteger. * numbers are equal. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for equals method.", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for equals method.", + method = "equals", + args = {java.lang.Object.class} + ) public void testEqualsBigIntegerTrue() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; @@ -449,15 +395,12 @@ public class BigIntegerCompareTest extends TestCase { * obj is a BigInteger. * numbers are not equal. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for equals method.", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for equals method.", + method = "equals", + args = {java.lang.Object.class} + ) public void testEqualsBigIntegerFalse() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; @@ -472,15 +415,12 @@ public class BigIntegerCompareTest extends TestCase { * max(BigInteger val). * the first is greater. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for max method.", - targets = { - @TestTarget( - methodName = "max", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for max method.", + method = "max", + args = {java.math.BigInteger.class} + ) public void testMaxGreater() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; @@ -502,15 +442,12 @@ public class BigIntegerCompareTest extends TestCase { * max(BigInteger val). * the first is less. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for max method.", - targets = { - @TestTarget( - methodName = "max", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for max method.", + method = "max", + args = {java.math.BigInteger.class} + ) public void testMaxLess() { byte aBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; @@ -532,15 +469,12 @@ public class BigIntegerCompareTest extends TestCase { * max(BigInteger val). * numbers are equal. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for max method.", - targets = { - @TestTarget( - methodName = "max", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for max method.", + method = "max", + args = {java.math.BigInteger.class} + ) public void testMaxEqual() { byte aBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; @@ -562,15 +496,12 @@ public class BigIntegerCompareTest extends TestCase { * max(BigInteger val). * max of negative and ZERO. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for max method.", - targets = { - @TestTarget( - methodName = "max", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for max method.", + method = "max", + args = {java.math.BigInteger.class} + ) public void testMaxNegZero() { byte aBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; int aSign = -1; @@ -590,15 +521,12 @@ public class BigIntegerCompareTest extends TestCase { * min(BigInteger val). * the first is greater. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for mix method.", - targets = { - @TestTarget( - methodName = "min", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for mix method.", + method = "min", + args = {java.math.BigInteger.class} + ) public void testMinGreater() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; @@ -620,15 +548,12 @@ public class BigIntegerCompareTest extends TestCase { * min(BigInteger val). * the first is less. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for mix method.", - targets = { - @TestTarget( - methodName = "min", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for mix method.", + method = "min", + args = {java.math.BigInteger.class} + ) public void testMinLess() { byte aBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; @@ -650,15 +575,12 @@ public class BigIntegerCompareTest extends TestCase { * min(BigInteger val). * numbers are equal. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for mix method.", - targets = { - @TestTarget( - methodName = "min", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for mix method.", + method = "min", + args = {java.math.BigInteger.class} + ) public void testMinEqual() { byte aBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; @@ -680,15 +602,12 @@ public class BigIntegerCompareTest extends TestCase { * max(BigInteger val). * min of positive and ZERO. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for mix method.", - targets = { - @TestTarget( - methodName = "min", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for mix method.", + method = "min", + args = {java.math.BigInteger.class} + ) public void testMinPosZero() { byte aBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; int aSign = 1; @@ -707,15 +626,12 @@ public class BigIntegerCompareTest extends TestCase { /** * negate() a positive number. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for negate method.", - targets = { - @TestTarget( - methodName = "negate", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for negate method.", + method = "negate", + args = {} + ) public void testNegatePositive() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int aSign = 1; @@ -733,15 +649,12 @@ public class BigIntegerCompareTest extends TestCase { /** * negate() a negative number. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for negate method.", - targets = { - @TestTarget( - methodName = "negate", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for negate method.", + method = "negate", + args = {} + ) public void testNegateNegative() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int aSign = -1; @@ -759,15 +672,12 @@ public class BigIntegerCompareTest extends TestCase { /** * negate() ZERO. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for negate method.", - targets = { - @TestTarget( - methodName = "negate", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for negate method.", + method = "negate", + args = {} + ) public void testNegateZero() { byte rBytes[] = {0}; BigInteger aNumber = BigInteger.ZERO; @@ -783,15 +693,12 @@ public class BigIntegerCompareTest extends TestCase { /** * signum() of a positive number. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for signum method.", - targets = { - @TestTarget( - methodName = "signum", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for signum method.", + method = "signum", + args = {} + ) public void testSignumPositive() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int aSign = 1; @@ -802,15 +709,12 @@ public class BigIntegerCompareTest extends TestCase { /** * signum() of a negative number. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for signum method.", - targets = { - @TestTarget( - methodName = "signum", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for signum method.", + method = "signum", + args = {} + ) public void testSignumNegative() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int aSign = -1; @@ -821,15 +725,12 @@ public class BigIntegerCompareTest extends TestCase { /** * signum() of ZERO. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for signum method.", - targets = { - @TestTarget( - methodName = "signum", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for signum method.", + method = "signum", + args = {} + ) public void testSignumZero() { BigInteger aNumber = BigInteger.ZERO; assertEquals("incorrect sign", 0, aNumber.signum()); diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConstructorsTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerConstructorsTest.java index 3a7d081..043d278 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConstructorsTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerConstructorsTest.java @@ -19,12 +19,12 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.math.BigInteger; import java.util.Random; @@ -41,15 +41,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a number from an array of bytes. * Verify an exception thrown if an array is zero bytes long */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(byte[]) constructor.", + method = "BigInteger", + args = {byte[].class} + ) public void testConstructorBytesException() { byte aBytes[] = {}; try { @@ -64,15 +61,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a positive number from an array of bytes. * The number fits in an array of integers. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(byte[]) constructor.", + method = "BigInteger", + args = {byte[].class} + ) public void testConstructorBytesPositive1() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; byte rBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; @@ -89,15 +83,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a positive number from an array of bytes. * The number fits in an integer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(byte[]) constructor.", + method = "BigInteger", + args = {byte[].class} + ) public void testConstructorBytesPositive2() { byte aBytes[] = {12, 56, 100}; byte rBytes[] = {12, 56, 100}; @@ -114,15 +105,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a positive number from an array of bytes. * The number of bytes is 4. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(byte[]) constructor.", + method = "BigInteger", + args = {byte[].class} + ) public void testConstructorBytesPositive3() { byte aBytes[] = {127, 56, 100, -1}; byte rBytes[] = {127, 56, 100, -1}; @@ -139,15 +127,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a positive number from an array of bytes. * The number of bytes is multiple of 4. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(byte[]) constructor.", + method = "BigInteger", + args = {byte[].class} + ) public void testConstructorBytesPositive() { byte aBytes[] = {127, 56, 100, -1, 14, 75, -24, -100}; byte rBytes[] = {127, 56, 100, -1, 14, 75, -24, -100}; @@ -164,15 +149,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a negative number from an array of bytes. * The number fits in an array of integers. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(byte[]) constructor.", + method = "BigInteger", + args = {byte[].class} + ) public void testConstructorBytesNegative1() { byte aBytes[] = {-12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; byte rBytes[] = {-12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; @@ -189,15 +171,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a negative number from an array of bytes. * The number fits in an integer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(byte[]) constructor.", + method = "BigInteger", + args = {byte[].class} + ) public void testConstructorBytesNegative2() { byte aBytes[] = {-12, 56, 100}; byte rBytes[] = {-12, 56, 100}; @@ -214,15 +193,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a negative number from an array of bytes. * The number of bytes is 4. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(byte[]) constructor.", + method = "BigInteger", + args = {byte[].class} + ) public void testConstructorBytesNegative3() { byte aBytes[] = {-128, -12, 56, 100}; byte rBytes[] = {-128, -12, 56, 100}; @@ -239,15 +215,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a negative number from an array of bytes. * The number of bytes is multiple of 4. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(byte[]) constructor.", + method = "BigInteger", + args = {byte[].class} + ) public void testConstructorBytesNegative4() { byte aBytes[] = {-128, -12, 56, 100, -13, 56, 93, -78}; byte rBytes[] = {-128, -12, 56, 100, -13, 56, 93, -78}; @@ -263,15 +236,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * Create a zero number from an array of zero bytes. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(byte[]) constructor.", + method = "BigInteger", + args = {byte[].class} + ) public void testConstructorBytesZero() { byte aBytes[] = {0, 0, 0, -0, +0, 0, -0}; byte rBytes[] = {0}; @@ -288,15 +258,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a number from a sign and an array of bytes. * Verify an exception thrown if a sign has improper value. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesException1() { byte aBytes[] = {123, 45, -3, -76}; int aSign = 3; @@ -312,15 +279,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a number from a sign and an array of bytes. * Verify an exception thrown if the array contains non-zero bytes while the sign is 0. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesException2() { byte aBytes[] = {123, 45, -3, -76}; int aSign = 0; @@ -337,15 +301,12 @@ public class BigIntegerConstructorsTest extends TestCase { * The number fits in an array of integers. * The most significant byte is positive. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesPositive1() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15}; int aSign = 1; @@ -364,15 +325,12 @@ public class BigIntegerConstructorsTest extends TestCase { * The number fits in an array of integers. * The most significant byte is negative. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesPositive2() { byte aBytes[] = {-12, 56, 100, -2, -76, 89, 45, 91, 3, -15}; int aSign = 1; @@ -390,15 +348,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a positive number from a sign and an array of bytes. * The number fits in an integer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesPositive3() { byte aBytes[] = {-12, 56, 100}; int aSign = 1; @@ -417,15 +372,12 @@ public class BigIntegerConstructorsTest extends TestCase { * The number of bytes is 4. * The most significant byte is positive. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesPositive4() { byte aBytes[] = {127, 56, 100, -2}; int aSign = 1; @@ -444,15 +396,12 @@ public class BigIntegerConstructorsTest extends TestCase { * The number of bytes is 4. * The most significant byte is negative. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesPositive5() { byte aBytes[] = {-127, 56, 100, -2}; int aSign = 1; @@ -471,15 +420,12 @@ public class BigIntegerConstructorsTest extends TestCase { * The number of bytes is multiple of 4. * The most significant byte is positive. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesPositive6() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 23, -101}; int aSign = 1; @@ -498,15 +444,12 @@ public class BigIntegerConstructorsTest extends TestCase { * The number of bytes is multiple of 4. * The most significant byte is negative. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesPositive7() { byte aBytes[] = {-12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 23, -101}; int aSign = 1; @@ -525,15 +468,12 @@ public class BigIntegerConstructorsTest extends TestCase { * The number fits in an array of integers. * The most significant byte is positive. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesNegative1() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15}; int aSign = -1; @@ -552,15 +492,12 @@ public class BigIntegerConstructorsTest extends TestCase { * The number fits in an array of integers. * The most significant byte is negative. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesNegative2() { byte aBytes[] = {-12, 56, 100, -2, -76, 89, 45, 91, 3, -15}; int aSign = -1; @@ -578,15 +515,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a negative number from a sign and an array of bytes. * The number fits in an integer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesNegative3() { byte aBytes[] = {-12, 56, 100}; int aSign = -1; @@ -605,15 +539,12 @@ public class BigIntegerConstructorsTest extends TestCase { * The number of bytes is 4. * The most significant byte is positive. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesNegative4() { byte aBytes[] = {127, 56, 100, -2}; int aSign = -1; @@ -632,15 +563,12 @@ public class BigIntegerConstructorsTest extends TestCase { * The number of bytes is 4. * The most significant byte is negative. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesNegative5() { byte aBytes[] = {-127, 56, 100, -2}; int aSign = -1; @@ -659,15 +587,12 @@ public class BigIntegerConstructorsTest extends TestCase { * The number of bytes is multiple of 4. * The most significant byte is positive. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesNegative6() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 23, -101}; int aSign = -1; @@ -686,15 +611,12 @@ public class BigIntegerConstructorsTest extends TestCase { * The number of bytes is multiple of 4. * The most significant byte is negative. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesNegative7() { byte aBytes[] = {-12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 23, -101}; int aSign = -1; @@ -712,15 +634,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a zero number from a sign and an array of zero bytes. * The sign is -1. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesZero1() { byte aBytes[] = {-0, 0, +0, 0, 0, 00, 000}; int aSign = -1; @@ -738,15 +657,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a zero number from a sign and an array of zero bytes. * The sign is 0. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesZero2() { byte aBytes[] = {-0, 0, +0, 0, 0, 00, 000}; int aSign = 0; @@ -764,15 +680,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a zero number from a sign and an array of zero bytes. * The sign is 1. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesZero3() { byte aBytes[] = {-0, 0, +0, 0, 0, 00, 000}; int aSign = 1; @@ -790,15 +703,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a zero number from a sign and an array of zero length. * The sign is -1. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesZeroNull1() { byte aBytes[] = {}; int aSign = -1; @@ -816,15 +726,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a zero number from a sign and an array of zero length. * The sign is 0. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesZeroNull2() { byte aBytes[] = {}; int aSign = 0; @@ -842,15 +749,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a zero number from a sign and an array of zero length. * The sign is 1. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(int, byte[]) constructor.", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void testConstructorSignBytesZeroNull3() { byte aBytes[] = {}; int aSign = 1; @@ -868,15 +772,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a number from a string value and radix. * Verify an exception thrown if a radix is out of range */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String, int) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String, int) constructor.", + method = "BigInteger", + args = {java.lang.String.class, int.class} + ) public void testConstructorStringException1() { String value = "9234853876401"; int radix = 45; @@ -892,15 +793,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a number from a string value and radix. * Verify an exception thrown if the string starts with a space. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String, int) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String, int) constructor.", + method = "BigInteger", + args = {java.lang.String.class, int.class} + ) public void testConstructorStringException2() { String value = " 9234853876401"; int radix = 10; @@ -915,15 +813,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a number from a string value and radix. * Verify an exception thrown if the string contains improper characters. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String, int) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String, int) constructor.", + method = "BigInteger", + args = {java.lang.String.class, int.class} + ) public void testConstructorStringException3() { String value = "92348$*#78987"; int radix = 34; @@ -938,15 +833,12 @@ public class BigIntegerConstructorsTest extends TestCase { * Create a number from a string value and radix. * Verify an exception thrown if some digits are greater than radix. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String, int) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String, int) constructor.", + method = "BigInteger", + args = {java.lang.String.class, int.class} + ) public void testConstructorStringException4() { String value = "98zv765hdsaiy"; int radix = 20; @@ -960,15 +852,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * Create a positive number from a string value and radix 2. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String, int) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String, int) constructor.", + method = "BigInteger", + args = {java.lang.String.class, int.class} + ) public void testConstructorStringRadix2() { String value = "10101010101010101"; int radix = 2; @@ -985,15 +874,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * Create a positive number from a string value and radix 8. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String, int) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String, int) constructor.", + method = "BigInteger", + args = {java.lang.String.class, int.class} + ) public void testConstructorStringRadix8() { String value = "76356237071623450"; int radix = 8; @@ -1010,15 +896,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * Create a positive number from a string value and radix 10. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String, int) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String, int) constructor.", + method = "BigInteger", + args = {java.lang.String.class, int.class} + ) public void testConstructorStringRadix10() { String value = "987328901348934898"; int radix = 10; @@ -1035,15 +918,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * Create a positive number from a string value and radix 16. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String, int) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String, int) constructor.", + method = "BigInteger", + args = {java.lang.String.class, int.class} + ) public void testConstructorStringRadix16() { String value = "fe2340a8b5ce790"; int radix = 16; @@ -1060,15 +940,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * Create a positive number from a string value and radix 36. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String, int) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String, int) constructor.", + method = "BigInteger", + args = {java.lang.String.class, int.class} + ) public void testConstructorStringRadix36() { String value = "skdjgocvhdjfkl20jndjkf347ejg457"; int radix = 36; @@ -1085,15 +962,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * Create a negative number from a string value and radix 10. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String, int) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String, int) constructor.", + method = "BigInteger", + args = {java.lang.String.class, int.class} + ) public void testConstructorStringRadix10Negative() { String value = "-234871376037"; int radix = 36; @@ -1110,15 +984,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * Create a zero number from a string value and radix 36. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String, int) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String, int) constructor.", + method = "BigInteger", + args = {java.lang.String.class, int.class} + ) public void testConstructorStringRadix10Zero() { String value = "-00000000000000"; int radix = 10; @@ -1135,15 +1006,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * Create a random number of 75 bits length. */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "IllegalArgumentException checking missed for negative number of bits.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, java.util.Random.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "IllegalArgumentException checking missed for negative number of bits.", + method = "BigInteger", + args = {int.class, java.util.Random.class} + ) public void testConstructorRandom() { int bitLen = 75; Random rnd = new Random(); @@ -1154,15 +1022,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * Create a prime number of 25 bits length. */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed for incorrect bitLength parameter.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, int.class, java.util.Random.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed for incorrect bitLength parameter.", + method = "BigInteger", + args = {int.class, int.class, java.util.Random.class} + ) public void testConstructorPrime() { int bitLen = 25; Random rnd = new Random(); @@ -1193,15 +1058,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * @tests java.math.BigInteger#BigInteger(java.lang.String) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String) constructor.", + method = "BigInteger", + args = {java.lang.String.class} + ) public void test_ConstrString1() { String s = "0"; BigInteger bi_s = new BigInteger(s); @@ -1212,15 +1074,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * @tests java.math.BigInteger#BigInteger(java.lang.String) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String) constructor.", + method = "BigInteger", + args = {java.lang.String.class} + ) public void test_ConstrString2() { String s = "-2147483648"; BigInteger bi_s = new BigInteger(s); @@ -1232,15 +1091,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * @tests java.math.BigInteger#BigInteger(java.lang.String) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "This is a complete subset of tests for BigInteger(String) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger_OK", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "This is a complete subset of tests for BigInteger(String) constructor.", + method = "BigInteger", + args = {java.lang.String.class} + ) public void test_ConstrString3() { String s = "2147483647"; BigInteger bi_s = new BigInteger(s); @@ -1252,15 +1108,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * @tests java.math.BigInteger#BigInteger(java.lang.String) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String) constructor.", + method = "BigInteger", + args = {java.lang.String.class} + ) public void test_ConstrStringExc1() { try { new BigInteger("01234 56"); @@ -1272,15 +1125,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * @tests java.math.BigInteger#BigInteger(java.lang.String) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String) constructor.", + method = "BigInteger", + args = {java.lang.String.class} + ) public void test_ConstrStringExc2() { try { new BigInteger("1234#56"); @@ -1292,15 +1142,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * @tests java.math.BigInteger#BigInteger(java.lang.String) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String) constructor.", + method = "BigInteger", + args = {java.lang.String.class} + ) public void test_ConstrStringExc3() { try { new BigInteger("1234.56"); @@ -1312,15 +1159,12 @@ public class BigIntegerConstructorsTest extends TestCase { /** * @tests java.math.BigInteger#BigInteger(java.lang.String) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigInteger(String) constructor.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for BigInteger(String) constructor.", + method = "BigInteger", + args = {java.lang.String.class} + ) public void test_ConstrStringExc4() { try { new BigInteger("1E+1"); diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConvertTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerConvertTest.java index c784d88..aaef132 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConvertTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerConvertTest.java @@ -19,12 +19,12 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.math.BigInteger; @@ -39,15 +39,12 @@ public class BigIntegerConvertTest extends TestCase { /** * Return the double value of ZERO. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValueZero() { String a = "0"; double result = 0.0; @@ -59,15 +56,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a positive number to a double value. * The number's length is less than 64 bits. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValuePositive1() { String a = "27467238945"; double result = 2.7467238945E10; @@ -79,15 +73,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a positive number to a double value. * The number's bit length is inside [63, 1024]. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValuePositive2() { String a = "2746723894572364578265426346273456972"; double result = 2.7467238945723645E36; @@ -99,15 +90,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a negative number to a double value. * The number's bit length is less than 64 bits. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValueNegative1() { String a = "-27467238945"; double result = -2.7467238945E10; @@ -119,15 +107,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a negative number to a double value. * The number's bit length is inside [63, 1024]. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValueNegative2() { String a = "-2746723894572364578265426346273456972"; double result = -2.7467238945723645E36; @@ -140,15 +125,12 @@ public class BigIntegerConvertTest extends TestCase { * Rounding is needed. * The rounding bit is 1 and the next bit to the left is 1. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValuePosRounded1() { byte[] a = {-128, 1, 2, 3, 4, 5, 60, 23, 1, -3, -5}; int aSign = 1; @@ -163,15 +145,12 @@ public class BigIntegerConvertTest extends TestCase { * The rounding bit is 1 and the next bit to the left is 0 * but some of dropped bits are 1s. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValuePosRounded2() { byte[] a = {-128, 1, 2, 3, 4, 5, 36, 23, 1, -3, -5}; int aSign = 1; @@ -183,15 +162,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a positive number to a double value. * Rounding is NOT needed. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValuePosNotRounded() { byte[] a = {-128, 1, 2, 3, 4, 5, -128, 23, 1, -3, -5}; int aSign = 1; @@ -204,15 +180,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a positive number to a double value. * Rounding is needed. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValueNegRounded1() { byte[] a = {-128, 1, 2, 3, 4, 5, 60, 23, 1, -3, -5}; int aSign = -1; @@ -227,15 +200,12 @@ public class BigIntegerConvertTest extends TestCase { * The rounding bit is 1 and the next bit to the left is 0 * but some of dropped bits are 1s. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValueNegRounded2() { byte[] a = {-128, 1, 2, 3, 4, 5, 36, 23, 1, -3, -5}; int aSign = -1; @@ -248,15 +218,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a positive number to a double value. * Rounding is NOT needed. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValueNegNotRounded() { byte[] a = {-128, 1, 2, 3, 4, 5, -128, 23, 1, -3, -5}; int aSign = -1; @@ -271,15 +238,12 @@ public class BigIntegerConvertTest extends TestCase { * The rounding bit is 0. * The result is Double.MAX_VALUE. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValuePosMaxValue() { byte[] a = {0, -1, -1, -1, -1, -1, -1, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -300,15 +264,12 @@ public class BigIntegerConvertTest extends TestCase { * The exponent is 1023 and the mantissa is all 1s. * The result is -Double.MAX_VALUE. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValueNegMaxValue() { byte[] a = {0, -1, -1, -1, -1, -1, -1, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -330,15 +291,12 @@ public class BigIntegerConvertTest extends TestCase { * The rounding bit is 1. * The result is Double.POSITIVE_INFINITY. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValuePositiveInfinity1() { byte[] a = {-1, -1, -1, -1, -1, -1, -1, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -358,15 +316,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a positive number to a double value. * The number's bit length is greater than 1024. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValuePositiveInfinity2() { String a = "2746723894572364578265426346273456972283746872364768676747462342342342342342342342323423423423423423426767456345745293762384756238475634563456845634568934568347586346578648576478568456457634875673845678456786587345873645767456834756745763457863485768475678465783456702897830296720476846578634576384567845678346573465786457863"; double aNumber = new BigInteger(a).doubleValue(); @@ -377,15 +332,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a negative number to a double value. * The number's bit length is greater than 1024. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValueNegativeInfinity1() { String a = "-2746723894572364578265426346273456972283746872364768676747462342342342342342342342323423423423423423426767456345745293762384756238475634563456845634568934568347586346578648576478568456457634875673845678456786587345873645767456834756745763457863485768475678465783456702897830296720476846578634576384567845678346573465786457863"; double aNumber = new BigInteger(a).doubleValue(); @@ -398,15 +350,12 @@ public class BigIntegerConvertTest extends TestCase { * The rounding bit is 0. * The result is Double.NEGATIVE_INFINITY. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValueNegativeInfinity2() { byte[] a = {-1, -1, -1, -1, -1, -1, -1, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -427,15 +376,12 @@ public class BigIntegerConvertTest extends TestCase { * The exponent is 1023 and the mantissa is all 0s * but the 54th bit (implicit) is 1. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValuePosMantissaIsZero() { byte[] a = {-128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -457,15 +403,12 @@ public class BigIntegerConvertTest extends TestCase { * The exponent is 1023 and the mantissa is all 0s * but the 54th bit (implicit) is 1. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for doubleValue method.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for doubleValue method.", + method = "doubleValue", + args = {} + ) public void testDoubleValueNegMantissaIsZero() { byte[] a = {-128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -484,15 +427,12 @@ public class BigIntegerConvertTest extends TestCase { /** * Return the float value of ZERO. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValueZero() { String a = "0"; float result = 0.0f; @@ -504,15 +444,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a positive number to a float value. * The number's length is less than 32 bits. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValuePositive1() { String a = "27467238"; float result = 2.7467238E7f; @@ -524,15 +461,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a positive number to a float value. * The number's bit length is inside [32, 127]. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValuePositive2() { String a = "27467238945723645782"; float result = 2.7467239E19f; @@ -544,15 +478,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a negative number to a float value. * The number's bit length is less than 32 bits. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValueNegative1() { String a = "-27467238"; float result = -2.7467238E7f; @@ -564,15 +495,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a negative number to a doufloatble value. * The number's bit length is inside [63, 1024]. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValueNegative2() { String a = "-27467238945723645782"; float result = -2.7467239E19f; @@ -585,15 +513,12 @@ public class BigIntegerConvertTest extends TestCase { * Rounding is needed. * The rounding bit is 1 and the next bit to the left is 1. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValuePosRounded1() { byte[] a = {-128, 1, -1, -4, 4, 5, 60, 23, 1, -3, -5}; int aSign = 1; @@ -608,15 +533,12 @@ public class BigIntegerConvertTest extends TestCase { * The rounding bit is 1 and the next bit to the left is 0 * but some of dropped bits are 1s. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValuePosRounded2() { byte[] a = {-128, 1, 2, -128, 4, 5, 60, 23, 1, -3, -5}; int aSign = 1; @@ -628,15 +550,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a positive number to a float value. * Rounding is NOT needed. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValuePosNotRounded() { byte[] a = {-128, 1, 2, 3, 4, 5, 60, 23, 1, -3, -5}; int aSign = 1; @@ -649,15 +568,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a positive number to a float value. * Rounding is needed. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValueNegRounded1() { byte[] a = {-128, 1, -1, -4, 4, 5, 60, 23, 1, -3, -5}; int aSign = -1; @@ -672,15 +588,12 @@ public class BigIntegerConvertTest extends TestCase { * The rounding bit is 1 and the next bit to the left is 0 * but some of dropped bits are 1s. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValueNegRounded2() { byte[] a = {-128, 1, 2, -128, 4, 5, 60, 23, 1, -3, -5}; int aSign = -1; @@ -693,15 +606,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a positive number to a float value. * Rounding is NOT needed. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValueNegNotRounded() { byte[] a = {-128, 1, 2, 3, 4, 5, 60, 23, 1, -3, -5}; int aSign = -1; @@ -716,15 +626,12 @@ public class BigIntegerConvertTest extends TestCase { * The rounding bit is 0. * The result is Float.MAX_VALUE. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValuePosMaxValue() { byte[] a = {0, -1, -1, -1, 0, -1, -1, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1}; int aSign = 1; @@ -738,15 +645,12 @@ public class BigIntegerConvertTest extends TestCase { * The rounding bit is 0. * The result is -Float.MAX_VALUE. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValueNegMaxValue() { byte[] a = {0, -1, -1, -1, 0, -1, -1, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1}; int aSign = -1; @@ -760,15 +664,12 @@ public class BigIntegerConvertTest extends TestCase { * The rounding bit is 1. * The result is Float.POSITIVE_INFINITY. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValuePositiveInfinity1() { byte[] a = {0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; int aSign = 1; @@ -780,15 +681,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a positive number to a float value. * The number's bit length is greater than 127. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValuePositiveInfinity2() { String a = "2746723894572364578265426346273456972283746872364768676747462342342342342342342342323423423423423423426767456345745293762384756238475634563456845634568934568347586346578648576478568456457634875673845678456786587345873645767456834756745763457863485768475678465783456702897830296720476846578634576384567845678346573465786457863"; float aNumber = new BigInteger(a).floatValue(); @@ -799,15 +697,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a negative number to a float value. * The number's bit length is greater than 127. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValueNegativeInfinity1() { String a = "-2746723894572364578265426346273456972283746872364768676747462342342342342342342342323423423423423423426767456345745293762384756238475634563456845634568934568347586346578648576478568456457634875673845678456786587345873645767456834756745763457863485768475678465783456702897830296720476846578634576384567845678346573465786457863"; float aNumber = new BigInteger(a).floatValue(); @@ -820,15 +715,12 @@ public class BigIntegerConvertTest extends TestCase { * The rounding bit is 0. * The result is Float.NEGATIVE_INFINITY. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValueNegativeInfinity2() { byte[] a = {0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; int aSign = -1; @@ -841,15 +733,12 @@ public class BigIntegerConvertTest extends TestCase { * The exponent is 1023 and the mantissa is all 0s * but the 54th bit (implicit) is 1. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValuePosMantissaIsZero() { byte[] a = {-128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int aSign = 1; @@ -863,15 +752,12 @@ public class BigIntegerConvertTest extends TestCase { * The exponent is 1023 and the mantissa is all 0s * but the 54th bit (implicit) is 1. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValueNegMantissaIsZero() { byte[] a = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int aSign = -1; @@ -883,15 +769,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a negative number to a float value. * The number's bit length is less than 32 bits. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for floatValue method.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for floatValue method.", + method = "floatValue", + args = {} + ) public void testFloatValueBug2482() { String a = "2147483649"; float result = 2.14748365E9f; @@ -903,15 +786,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a positive BigInteger to an integer value. * The low digit is positive */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for intValue method.", - targets = { - @TestTarget( - methodName = "intValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for intValue method.", + method = "intValue", + args = {} + ) public void testIntValuePositive1() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3}; int resInt = 1496144643; @@ -923,15 +803,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a positive BigInteger to an integer value. * The low digit is positive */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for intValue method.", - targets = { - @TestTarget( - methodName = "intValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for intValue method.", + method = "intValue", + args = {} + ) public void testIntValuePositive2() { byte aBytes[] = {12, 56, 100}; int resInt = 800868; @@ -943,15 +820,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a positive BigInteger to an integer value. * The low digit is negative. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for intValue method.", - targets = { - @TestTarget( - methodName = "intValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for intValue method.", + method = "intValue", + args = {} + ) public void testIntValuePositive3() { byte aBytes[] = {56, 13, 78, -12, -5, 56, 100}; int sign = 1; @@ -964,15 +838,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a negative BigInteger to an integer value. * The low digit is negative. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for intValue method.", - targets = { - @TestTarget( - methodName = "intValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for intValue method.", + method = "intValue", + args = {} + ) public void testIntValueNegative1() { byte aBytes[] = {12, 56, 100, -2, -76, -128, 45, 91, 3}; int sign = -1; @@ -985,15 +856,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a negative BigInteger to an integer value. * The low digit is negative. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for intValue method.", - targets = { - @TestTarget( - methodName = "intValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for intValue method.", + method = "intValue", + args = {} + ) public void testIntValueNegative2() { byte aBytes[] = {-12, 56, 100}; int result = -771996; @@ -1005,15 +873,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a negative BigInteger to an integer value. * The low digit is positive. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for intValue method.", - targets = { - @TestTarget( - methodName = "intValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for intValue method.", + method = "intValue", + args = {} + ) public void testIntValueNegative3() { byte aBytes[] = {12, 56, 100, -2, -76, 127, 45, 91, 3}; int sign = -1; @@ -1026,15 +891,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a BigInteger to a positive long value * The BigInteger is longer than int. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for longValue method.", - targets = { - @TestTarget( - methodName = "longValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for longValue method.", + method = "longValue", + args = {} + ) public void testLongValuePositive1() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, 120, -34, -12, 45, 98}; long result = 3268209772258930018L; @@ -1046,15 +908,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a number to a positive long value * The number fits in a long. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for longValue method.", - targets = { - @TestTarget( - methodName = "longValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for longValue method.", + method = "longValue", + args = {} + ) public void testLongValuePositive2() { byte aBytes[] = {12, 56, 100, 18, -105, 34, -18, 45}; long result = 880563758158769709L; @@ -1066,15 +925,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a number to a negative long value * The BigInteger is longer than int. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for longValue method.", - targets = { - @TestTarget( - methodName = "longValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for longValue method.", + method = "longValue", + args = {} + ) public void testLongValueNegative1() { byte aBytes[] = {12, -1, 100, -2, -76, -128, 45, 91, 3}; long result = -43630045168837885L; @@ -1086,15 +942,12 @@ public class BigIntegerConvertTest extends TestCase { * Convert a number to a negative long value * The number fits in a long. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for longValue method.", - targets = { - @TestTarget( - methodName = "longValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for longValue method.", + method = "longValue", + args = {} + ) public void testLongValueNegative2() { byte aBytes[] = {-12, 56, 100, 45, -101, 45, 98}; long result = -3315696807498398L; @@ -1105,15 +958,12 @@ public class BigIntegerConvertTest extends TestCase { /** * valueOf (long val): convert Integer.MAX_VALUE to a BigInteger. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for valueOf method.", - targets = { - @TestTarget( - methodName = "valueOf", - methodArgs = {long.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf method.", + method = "valueOf", + args = {long.class} + ) public void testValueOfIntegerMax() { long longVal = Integer.MAX_VALUE; BigInteger aNumber = BigInteger.valueOf(longVal); @@ -1129,15 +979,12 @@ public class BigIntegerConvertTest extends TestCase { /** * valueOf (long val): convert Integer.MIN_VALUE to a BigInteger. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for valueOf method.", - targets = { - @TestTarget( - methodName = "valueOf", - methodArgs = {long.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf method.", + method = "valueOf", + args = {long.class} + ) public void testValueOfIntegerMin() { long longVal = Integer.MIN_VALUE; BigInteger aNumber = BigInteger.valueOf(longVal); @@ -1153,15 +1000,12 @@ public class BigIntegerConvertTest extends TestCase { /** * valueOf (long val): convert Long.MAX_VALUE to a BigInteger. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for valueOf method.", - targets = { - @TestTarget( - methodName = "valueOf", - methodArgs = {long.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf method.", + method = "valueOf", + args = {long.class} + ) public void testValueOfLongMax() { long longVal = Long.MAX_VALUE; BigInteger aNumber = BigInteger.valueOf(longVal); @@ -1177,15 +1021,12 @@ public class BigIntegerConvertTest extends TestCase { /** * valueOf (long val): convert Long.MIN_VALUE to a BigInteger. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for valueOf method.", - targets = { - @TestTarget( - methodName = "valueOf", - methodArgs = {long.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf method.", + method = "valueOf", + args = {long.class} + ) public void testValueOfLongMin() { long longVal = Long.MIN_VALUE; BigInteger aNumber = BigInteger.valueOf(longVal); @@ -1201,15 +1042,12 @@ public class BigIntegerConvertTest extends TestCase { /** * valueOf (long val): convert a positive long value to a BigInteger. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for valueOf method.", - targets = { - @TestTarget( - methodName = "valueOf", - methodArgs = {long.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf method.", + method = "valueOf", + args = {long.class} + ) public void testValueOfLongPositive1() { long longVal = 268209772258930018L; BigInteger aNumber = BigInteger.valueOf(longVal); @@ -1226,15 +1064,12 @@ public class BigIntegerConvertTest extends TestCase { * valueOf (long val): convert a positive long value to a BigInteger. * The long value fits in integer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for valueOf method.", - targets = { - @TestTarget( - methodName = "valueOf", - methodArgs = {long.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf method.", + method = "valueOf", + args = {long.class} + ) public void testValueOfLongPositive2() { long longVal = 58930018L; BigInteger aNumber = BigInteger.valueOf(longVal); @@ -1250,15 +1085,12 @@ public class BigIntegerConvertTest extends TestCase { /** * valueOf (long val): convert a negative long value to a BigInteger. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for valueOf method.", - targets = { - @TestTarget( - methodName = "valueOf", - methodArgs = {long.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf method.", + method = "valueOf", + args = {long.class} + ) public void testValueOfLongNegative1() { long longVal = -268209772258930018L; BigInteger aNumber = BigInteger.valueOf(longVal); @@ -1275,15 +1107,12 @@ public class BigIntegerConvertTest extends TestCase { * valueOf (long val): convert a negative long value to a BigInteger. * The long value fits in integer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for valueOf method.", - targets = { - @TestTarget( - methodName = "valueOf", - methodArgs = {long.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf method.", + method = "valueOf", + args = {long.class} + ) public void testValueOfLongNegative2() { long longVal = -58930018L; BigInteger aNumber = BigInteger.valueOf(longVal); @@ -1298,15 +1127,12 @@ public class BigIntegerConvertTest extends TestCase { /** * valueOf (long val): convert a zero long value to a BigInteger. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for valueOf method.", - targets = { - @TestTarget( - methodName = "valueOf", - methodArgs = {long.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for valueOf method.", + method = "valueOf", + args = {long.class} + ) public void testValueOfLongZero() { long longVal = 0L; BigInteger aNumber = BigInteger.valueOf(longVal); diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerDivideTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerDivideTest.java index 64ca989..f46a6ec 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerDivideTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerDivideTest.java @@ -19,12 +19,12 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.math.BigInteger; @@ -38,15 +38,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide by zero */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testCase1() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {0}; @@ -65,15 +62,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide by ZERO */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testCase2() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7}; int aSign = 1; @@ -90,15 +84,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide two equal positive numbers */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testCase3() { byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127}; byte bBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127}; @@ -119,15 +110,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide two equal in absolute value numbers of different signs. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testCase4() { byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127}; byte bBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127}; @@ -149,15 +137,12 @@ public class BigIntegerDivideTest extends TestCase { * Divide two numbers of different length and different signs. * The second is longer. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testCase5() { byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127}; byte bBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 1, 2, 3, 4, 5}; @@ -179,15 +164,12 @@ public class BigIntegerDivideTest extends TestCase { * Divide two positive numbers of the same length. * The second is greater. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testCase6() { byte aBytes[] = {1, 100, 56, 7, 98, -1, 39, -128, 127}; byte bBytes[] = {15, 100, 56, 7, 98, -1, 39, -128, 127}; @@ -208,15 +190,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide two positive numbers. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testCase7() { byte aBytes[] = {1, 100, 56, 7, 98, -1, 39, -128, 127, 5, 6, 7, 8, 9}; byte bBytes[] = {15, 48, -29, 7, 98, -1, 39, -128}; @@ -237,15 +216,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide a positive number by a negative one. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testCase8() { byte aBytes[] = {1, 100, 56, 7, 98, -1, 39, -128, 127, 5, 6, 7, 8, 9}; byte bBytes[] = {15, 48, -29, 7, 98, -1, 39, -128}; @@ -266,15 +242,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide a negative number by a positive one. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testCase9() { byte aBytes[] = {1, 100, 56, 7, 98, -1, 39, -128, 127, 5, 6, 7, 8, 9}; byte bBytes[] = {15, 48, -29, 7, 98, -1, 39, -128}; @@ -295,15 +268,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide two negative numbers. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testCase10() { byte aBytes[] = {1, 100, 56, 7, 98, -1, 39, -128, 127, 5, 6, 7, 8, 9}; byte bBytes[] = {15, 48, -29, 7, 98, -1, 39, -128}; @@ -324,15 +294,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide zero by a negative number. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testCase11() { byte aBytes[] = {0}; byte bBytes[] = {15, 48, -29, 7, 98, -1, 39, -128}; @@ -353,15 +320,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide ZERO by a negative number. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testCase12() { byte bBytes[] = {15, 48, -29, 7, 98, -1, 39, -128}; int bSign = -1; @@ -380,15 +344,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide a positive number by ONE. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testCase13() { byte aBytes[] = {15, 48, -29, 7, 98, -1, 39, -128}; int aSign = 1; @@ -407,15 +368,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide ONE by ONE. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testCase14() { byte rBytes[] = {1}; BigInteger aNumber = BigInteger.ONE; @@ -432,15 +390,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Verifies the case when borrow != 0 in the private divide method. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testDivisionKnuth1() { byte aBytes[] = {-7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {-3, -3, -3, -3}; @@ -461,15 +416,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Verifies the case when the divisor is already normalized. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testDivisionKnuthIsNormalized() { byte aBytes[] = {-9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5}; byte bBytes[] = {-1, -1, -1, -1, -1, -1, -1, -1}; @@ -491,15 +443,12 @@ public class BigIntegerDivideTest extends TestCase { * Verifies the case when the first digits of the dividend * and divisor equal. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testDivisionKnuthFirstDigitsEqual() { byte aBytes[] = {2, -3, -4, -5, -1, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5}; byte bBytes[] = {2, -3, -4, -5, -1, -1, -1, -1}; @@ -520,15 +469,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide the number of one digit by the number of one digit */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testDivisionKnuthOneDigitByOneDigit() { byte aBytes[] = {113, -83, 123, -5}; byte bBytes[] = {2, -3, -4, -5}; @@ -549,15 +495,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide the number of multi digits by the number of one digit */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for divide method.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for divide method.", + method = "divide", + args = {java.math.BigInteger.class} + ) public void testDivisionKnuthMultiDigitsByOneDigit() { byte aBytes[] = {113, -83, 123, -5, 18, -34, 67, 39, -29}; byte bBytes[] = {2, -3, -4, -5}; @@ -578,15 +521,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Remainder of division by zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for remainder method.", - targets = { - @TestTarget( - methodName = "remainder", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for remainder method.", + method = "remainder", + args = {java.math.BigInteger.class} + ) public void testCase15() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {0}; @@ -605,15 +545,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Remainder of division of equal numbers */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for remainder method.", - targets = { - @TestTarget( - methodName = "remainder", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for remainder method.", + method = "remainder", + args = {java.math.BigInteger.class} + ) public void testCase16() { byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127}; byte bBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127}; @@ -634,15 +571,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Remainder of division of two positive numbers */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for remainder method.", - targets = { - @TestTarget( - methodName = "remainder", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for remainder method.", + method = "remainder", + args = {java.math.BigInteger.class} + ) public void testCase17() { byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75}; byte bBytes[] = {27, -15, 65, 39, 100}; @@ -663,15 +597,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Remainder of division of two negative numbers */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for remainder method.", - targets = { - @TestTarget( - methodName = "remainder", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for remainder method.", + method = "remainder", + args = {java.math.BigInteger.class} + ) public void testCase18() { byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75}; byte bBytes[] = {27, -15, 65, 39, 100}; @@ -693,15 +624,12 @@ public class BigIntegerDivideTest extends TestCase { * Remainder of division of two numbers of different signs. * The first is positive. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for remainder method.", - targets = { - @TestTarget( - methodName = "remainder", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for remainder method.", + method = "remainder", + args = {java.math.BigInteger.class} + ) public void testCase19() { byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75}; byte bBytes[] = {27, -15, 65, 39, 100}; @@ -723,15 +651,12 @@ public class BigIntegerDivideTest extends TestCase { * Remainder of division of two numbers of different signs. * The first is negative. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for remainder method.", - targets = { - @TestTarget( - methodName = "remainder", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for remainder method.", + method = "remainder", + args = {java.math.BigInteger.class} + ) public void testCase20() { byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75}; byte bBytes[] = {27, -15, 65, 39, 100}; @@ -752,15 +677,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Tests the step D6 from the Knuth algorithm */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for remainder method.", - targets = { - @TestTarget( - methodName = "remainder", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for remainder method.", + method = "remainder", + args = {java.math.BigInteger.class} + ) public void testRemainderKnuth1() { byte aBytes[] = {-9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1}; byte bBytes[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; @@ -781,15 +703,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide the number of one digit by the number of one digit */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for remainder method.", - targets = { - @TestTarget( - methodName = "remainder", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for remainder method.", + method = "remainder", + args = {java.math.BigInteger.class} + ) public void testRemainderKnuthOneDigitByOneDigit() { byte aBytes[] = {113, -83, 123, -5}; byte bBytes[] = {2, -3, -4, -50}; @@ -810,15 +729,12 @@ public class BigIntegerDivideTest extends TestCase { /** * Divide the number of multi digits by the number of one digit */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for remainder method.", - targets = { - @TestTarget( - methodName = "remainder", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for remainder method.", + method = "remainder", + args = {java.math.BigInteger.class} + ) public void testRemainderKnuthMultiDigitsByOneDigit() { byte aBytes[] = {113, -83, 123, -5, 18, -34, 67, 39, -29}; byte bBytes[] = {2, -3, -4, -50}; @@ -840,15 +756,11 @@ public class BigIntegerDivideTest extends TestCase { * divideAndRemainder of two numbers of different signs. * The first is negative. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "divideAndRemainder", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "divideAndRemainder", + args = {java.math.BigInteger.class} + ) public void testCase21() { byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75}; byte bBytes[] = {27, -15, 65, 39, 100}; @@ -879,17 +791,37 @@ public class BigIntegerDivideTest extends TestCase { } /** + * divideAndRemainder of division by zero + */ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "divideAndRemainder", + args = {java.math.BigInteger.class} + ) + public void testCase21byZero() { + byte aBytes[] = {1, 2, 3, 4, 5, 6, 7}; + byte bBytes[] = {0}; + int aSign = 1; + int bSign = 0; + BigInteger aNumber = new BigInteger(aSign, aBytes); + BigInteger bNumber = new BigInteger(bSign, bBytes); + try { + aNumber.divideAndRemainder(bNumber); + fail("ArithmeticException has not been caught"); + } catch (ArithmeticException e) { + assertEquals("Improper exception message", "BigInteger divide by zero", e.getMessage()); + } + } + + /** * mod when modulus is negative */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for mod method.", - targets = { - @TestTarget( - methodName = "mod", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for mod method.", + method = "mod", + args = {java.math.BigInteger.class} + ) public void testCase22() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {1, 30, 40, 56, -1, 45}; @@ -908,15 +840,12 @@ public class BigIntegerDivideTest extends TestCase { /** * mod when a divisor is positive */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for mod method.", - targets = { - @TestTarget( - methodName = "mod", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for mod method.", + method = "mod", + args = {java.math.BigInteger.class} + ) public void testCase23() { byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75}; byte bBytes[] = {27, -15, 65, 39, 100}; @@ -937,15 +866,12 @@ public class BigIntegerDivideTest extends TestCase { /** * mod when a divisor is negative */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for mod method.", - targets = { - @TestTarget( - methodName = "mod", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for mod method.", + method = "mod", + args = {java.math.BigInteger.class} + ) public void testCase24() { byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75}; byte bBytes[] = {27, -15, 65, 39, 100}; diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerHashCodeTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerHashCodeTest.java index b8b776c..d351fa8 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerHashCodeTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerHashCodeTest.java @@ -19,12 +19,12 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.math.BigInteger; @@ -38,15 +38,12 @@ public class BigIntegerHashCodeTest extends TestCase { /** * Test hash codes for the same object */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for hashCode method.", - targets = { - @TestTarget( - methodName = "hashCode", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for hashCode method.", + method = "hashCode", + args = {} + ) public void testSameObject() { String value1 = "12378246728727834290276457386374882976782849"; String value2 = "-5634562095872038262928728727834290276457386374882976782849"; @@ -65,15 +62,12 @@ public class BigIntegerHashCodeTest extends TestCase { /** * Test hash codes for equal objects. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for hashCode method.", - targets = { - @TestTarget( - methodName = "hashCode", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for hashCode method.", + method = "hashCode", + args = {} + ) public void testEqualObjects() { String value1 = "12378246728727834290276457386374882976782849"; String value2 = "12378246728727834290276457386374882976782849"; @@ -90,15 +84,12 @@ public class BigIntegerHashCodeTest extends TestCase { * Test hash codes for unequal objects. * The codes are unequal. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for hashCode method.", - targets = { - @TestTarget( - methodName = "hashCode", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for hashCode method.", + method = "hashCode", + args = {} + ) public void testUnequalObjectsUnequal() { String value1 = "12378246728727834290276457386374882976782849"; String value2 = "-5634562095872038262928728727834290276457386374882976782849"; diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerModPowTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerModPowTest.java index 43f128a..7142f16 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerModPowTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerModPowTest.java @@ -19,12 +19,12 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.math.BigInteger; @@ -38,15 +38,12 @@ public class BigIntegerModPowTest extends TestCase { /** * modPow: non-positive modulus */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for modPow method.", - targets = { - @TestTarget( - methodName = "modPow", - methodArgs = {java.math.BigInteger.class, java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for modPow method.", + method = "modPow", + args = {java.math.BigInteger.class, java.math.BigInteger.class} + ) public void testModPowException() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7}; byte eBytes[] = {1, 2, 3, 4, 5}; @@ -68,15 +65,12 @@ public class BigIntegerModPowTest extends TestCase { /** * modPow: positive exponent */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for modPow method.", - targets = { - @TestTarget( - methodName = "modPow", - methodArgs = {java.math.BigInteger.class, java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for modPow method.", + method = "modPow", + args = {java.math.BigInteger.class, java.math.BigInteger.class} + ) public void testModPowPosExp() { byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75, 48, -7}; byte eBytes[] = {27, -15, 65, 39}; @@ -100,15 +94,12 @@ public class BigIntegerModPowTest extends TestCase { /** * modPow: negative exponent */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for modPow method.", - targets = { - @TestTarget( - methodName = "modPow", - methodArgs = {java.math.BigInteger.class, java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for modPow method.", + method = "modPow", + args = {java.math.BigInteger.class, java.math.BigInteger.class} + ) public void testModPowNegExp() { byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75, 48, -7}; byte eBytes[] = {27, -15, 65, 39}; @@ -132,15 +123,12 @@ public class BigIntegerModPowTest extends TestCase { /** * modInverse: non-positive modulus */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for modInverse method.", - targets = { - @TestTarget( - methodName = "modInverse", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for modInverse method.", + method = "modInverse", + args = {java.math.BigInteger.class} + ) public void testmodInverseException() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7}; byte mBytes[] = {1, 2, 3}; @@ -159,15 +147,12 @@ public class BigIntegerModPowTest extends TestCase { /** * modInverse: non-invertible number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for modInverse method.", - targets = { - @TestTarget( - methodName = "modInverse", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for modInverse method.", + method = "modInverse", + args = {java.math.BigInteger.class} + ) public void testmodInverseNonInvertible() { byte aBytes[] = {-15, 24, 123, 56, -11, -112, -34, -98, 8, 10, 12, 14, 25, 125, -15, 28, -127}; byte mBytes[] = {-12, 1, 0, 0, 0, 23, 44, 55, 66}; @@ -186,15 +171,12 @@ public class BigIntegerModPowTest extends TestCase { /** * modInverse: positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for modInverse method.", - targets = { - @TestTarget( - methodName = "modInverse", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for modInverse method.", + method = "modInverse", + args = {java.math.BigInteger.class} + ) public void testmodInversePos1() { byte aBytes[] = {24, 123, 56, -11, -112, -34, -98, 8, 10, 12, 14, 25, 125, -15, 28, -127}; byte mBytes[] = {122, 45, 36, 100, 122, 45}; @@ -215,15 +197,12 @@ public class BigIntegerModPowTest extends TestCase { /** * modInverse: positive number (another case: a < 0) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for modInverse method.", - targets = { - @TestTarget( - methodName = "modInverse", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for modInverse method.", + method = "modInverse", + args = {java.math.BigInteger.class} + ) public void testmodInversePos2() { byte aBytes[] = {15, 24, 123, 56, -11, -112, -34, -98, 8, 10, 12, 14, 25, 125, -15, 28, -127}; byte mBytes[] = {2, 122, 45, 36, 100}; @@ -244,15 +223,12 @@ public class BigIntegerModPowTest extends TestCase { /** * modInverse: negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for modInverse method.", - targets = { - @TestTarget( - methodName = "modInverse", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for modInverse method.", + method = "modInverse", + args = {java.math.BigInteger.class} + ) public void testmodInverseNeg1() { byte aBytes[] = {15, 24, 123, 56, -11, -112, -34, -98, 8, 10, 12, 14, 25, 125, -15, 28, -127}; byte mBytes[] = {2, 122, 45, 36, 100}; @@ -273,15 +249,12 @@ public class BigIntegerModPowTest extends TestCase { /** * modInverse: negative number (another case: x < 0) */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for modInverse method.", - targets = { - @TestTarget( - methodName = "modInverse", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for modInverse method.", + method = "modInverse", + args = {java.math.BigInteger.class} + ) public void testmodInverseNeg2() { byte aBytes[] = {-15, 24, 123, 57, -15, 24, 123, 57, -15, 24, 123, 57}; byte mBytes[] = {122, 2, 4, 122, 2, 4}; @@ -300,15 +273,12 @@ public class BigIntegerModPowTest extends TestCase { /** * gcd: the second number is zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for gcd method.", - targets = { - @TestTarget( - methodName = "gcd", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for gcd method.", + method = "gcd", + args = {java.math.BigInteger.class} + ) public void testGcdSecondZero() { byte aBytes[] = {15, 24, 123, 57, -15, 24, 123, 57, -15, 24, 123, 57}; byte bBytes[] = {0}; @@ -329,15 +299,12 @@ public class BigIntegerModPowTest extends TestCase { /** * gcd: the first number is zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for gcd method.", - targets = { - @TestTarget( - methodName = "gcd", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for gcd method.", + method = "gcd", + args = {java.math.BigInteger.class} + ) public void testGcdFirstZero() { byte aBytes[] = {0}; byte bBytes[] = {15, 24, 123, 57, -15, 24, 123, 57, -15, 24, 123, 57}; @@ -358,15 +325,12 @@ public class BigIntegerModPowTest extends TestCase { /** * gcd: the first number is ZERO */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for gcd method.", - targets = { - @TestTarget( - methodName = "gcd", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for gcd method.", + method = "gcd", + args = {java.math.BigInteger.class} + ) public void testGcdFirstZERO() { byte bBytes[] = {15, 24, 123, 57, -15, 24, 123, 57, -15, 24, 123, 57}; int bSign = 1; @@ -385,15 +349,12 @@ public class BigIntegerModPowTest extends TestCase { /** * gcd: both numbers are zeros */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for gcd method.", - targets = { - @TestTarget( - methodName = "gcd", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for gcd method.", + method = "gcd", + args = {java.math.BigInteger.class} + ) public void testGcdBothZeros() { byte rBytes[] = {0}; BigInteger aNumber = new BigInteger("0"); @@ -409,15 +370,12 @@ public class BigIntegerModPowTest extends TestCase { /** * gcd: the first number is longer */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for gcd method.", - targets = { - @TestTarget( - methodName = "gcd", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for gcd method.", + method = "gcd", + args = {java.math.BigInteger.class} + ) public void testGcdFirstLonger() { byte aBytes[] = {-15, 24, 123, 56, -11, -112, -34, -98, 8, 10, 12, 14, 25, 125, -15, 28, -127}; byte bBytes[] = {-12, 1, 0, 0, 0, 23, 44, 55, 66}; @@ -438,15 +396,12 @@ public class BigIntegerModPowTest extends TestCase { /** * gcd: the second number is longer */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for gcd method.", - targets = { - @TestTarget( - methodName = "gcd", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for gcd method.", + method = "gcd", + args = {java.math.BigInteger.class} + ) public void testGcdSecondLonger() { byte aBytes[] = {-12, 1, 0, 0, 0, 23, 44, 55, 66}; byte bBytes[] = {-15, 24, 123, 56, -11, -112, -34, -98, 8, 10, 12, 14, 25, 125, -15, 28, -127}; diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerMultiplyTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerMultiplyTest.java index b78c941..59ff3c6 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerMultiplyTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerMultiplyTest.java @@ -19,12 +19,12 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.math.BigInteger; @@ -38,15 +38,12 @@ public class BigIntegerMultiplyTest extends TestCase { /** * Multiply two negative numbers of the same length */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for multiply method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for multiply method.", + method = "multiply", + args = {java.math.BigInteger.class} + ) public void testCase1() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -68,15 +65,12 @@ public class BigIntegerMultiplyTest extends TestCase { * Multiply two numbers of the same length and different signs. * The first is negative. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for multiply method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for multiply method.", + method = "multiply", + args = {java.math.BigInteger.class} + ) public void testCase2() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -98,15 +92,12 @@ public class BigIntegerMultiplyTest extends TestCase { * Multiply two positive numbers of different length. * The first is longer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for multiply method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for multiply method.", + method = "multiply", + args = {java.math.BigInteger.class} + ) public void testCase3() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 1, 2, 3, 4, 5}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -129,15 +120,12 @@ public class BigIntegerMultiplyTest extends TestCase { * Multiply two positive numbers of different length. * The second is longer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for multiply method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for multiply method.", + method = "multiply", + args = {java.math.BigInteger.class} + ) public void testCase4() { byte aBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 1, 2, 3, 4, 5}; @@ -161,15 +149,12 @@ public class BigIntegerMultiplyTest extends TestCase { * The first is positive. * The first is longer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for multiply method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for multiply method.", + method = "multiply", + args = {java.math.BigInteger.class} + ) public void testCase5() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 1, 2, 3, 4, 5}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -193,15 +178,12 @@ public class BigIntegerMultiplyTest extends TestCase { * The first is positive. * The second is longer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for multiply method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for multiply method.", + method = "multiply", + args = {java.math.BigInteger.class} + ) public void testCase6() { byte aBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 1, 2, 3, 4, 5}; @@ -223,15 +205,12 @@ public class BigIntegerMultiplyTest extends TestCase { /** * Multiply a number by zero. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for multiply method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for multiply method.", + method = "multiply", + args = {java.math.BigInteger.class} + ) public void testCase7() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 1, 2, 3, 4, 5}; byte bBytes[] = {0}; @@ -252,15 +231,12 @@ public class BigIntegerMultiplyTest extends TestCase { /** * Multiply a number by ZERO. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for multiply method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for multiply method.", + method = "multiply", + args = {java.math.BigInteger.class} + ) public void testCase8() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 1, 2, 3, 4, 5}; int aSign = 1; @@ -279,15 +255,12 @@ public class BigIntegerMultiplyTest extends TestCase { /** * Multiply a positive number by ONE. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for multiply method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for multiply method.", + method = "multiply", + args = {java.math.BigInteger.class} + ) public void testCase9() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 1, 2, 3, 4, 5}; int aSign = 1; @@ -306,15 +279,12 @@ public class BigIntegerMultiplyTest extends TestCase { /** * Multiply a negative number by ONE. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for multiply method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for multiply method.", + method = "multiply", + args = {java.math.BigInteger.class} + ) public void testCase10() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 1, 2, 3, 4, 5}; int aSign = -1; @@ -333,15 +303,12 @@ public class BigIntegerMultiplyTest extends TestCase { /** * Multiply two numbers of 4 bytes length. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for multiply method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for multiply method.", + method = "multiply", + args = {java.math.BigInteger.class} + ) public void testIntbyInt1() { byte aBytes[] = {10, 20, 30, 40}; byte bBytes[] = {1, 2, 3, 4}; @@ -362,15 +329,12 @@ public class BigIntegerMultiplyTest extends TestCase { /** * Multiply two numbers of 4 bytes length. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for multiply method.", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for multiply method.", + method = "multiply", + args = {java.math.BigInteger.class} + ) public void testIntbyInt2() { byte aBytes[] = {-1, -1, -1, -1}; byte bBytes[] = {-1, -1, -1, -1}; @@ -391,15 +355,12 @@ public class BigIntegerMultiplyTest extends TestCase { /** * Negative exponent. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for pow method.", - targets = { - @TestTarget( - methodName = "pow", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for pow method.", + method = "pow", + args = {int.class} + ) public void testPowException() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7}; int aSign = 1; @@ -416,15 +377,12 @@ public class BigIntegerMultiplyTest extends TestCase { /** * Exponentiation of a negative number to an odd exponent. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for pow method.", - targets = { - @TestTarget( - methodName = "pow", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for pow method.", + method = "pow", + args = {int.class} + ) public void testPowNegativeNumToOddExp() { byte aBytes[] = {50, -26, 90, 69, 120, 32, 63, -103, -14, 35}; int aSign = -1; @@ -446,15 +404,12 @@ public class BigIntegerMultiplyTest extends TestCase { /** * Exponentiation of a negative number to an even exponent. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for pow method.", - targets = { - @TestTarget( - methodName = "pow", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for pow method.", + method = "pow", + args = {int.class} + ) public void testPowNegativeNumToEvenExp() { byte aBytes[] = {50, -26, 90, 69, 120, 32, 63, -103, -14, 35}; int aSign = -1; @@ -475,15 +430,12 @@ public class BigIntegerMultiplyTest extends TestCase { /** * Exponentiation of a negative number to zero exponent. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for pow method.", - targets = { - @TestTarget( - methodName = "pow", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for pow method.", + method = "pow", + args = {int.class} + ) public void testPowNegativeNumToZeroExp() { byte aBytes[] = {50, -26, 90, 69, 120, 32, 63, -103, -14, 35}; int aSign = -1; @@ -502,15 +454,12 @@ public class BigIntegerMultiplyTest extends TestCase { /** * Exponentiation of a positive number. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for pow method.", - targets = { - @TestTarget( - methodName = "pow", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for pow method.", + method = "pow", + args = {int.class} + ) public void testPowPositiveNum() { byte aBytes[] = {50, -26, 90, 69, 120, 32, 63, -103, -14, 35}; int aSign = 1; @@ -532,15 +481,12 @@ public class BigIntegerMultiplyTest extends TestCase { /** * Exponentiation of a negative number to zero exponent. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for pow method.", - targets = { - @TestTarget( - methodName = "pow", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for pow method.", + method = "pow", + args = {int.class} + ) public void testPowPositiveNumToZeroExp() { byte aBytes[] = {50, -26, 90, 69, 120, 32, 63, -103, -14, 35}; int aSign = 1; diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerNotTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerNotTest.java index a2523cb..6ca350b 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerNotTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerNotTest.java @@ -19,12 +19,12 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.math.BigInteger; @@ -38,15 +38,12 @@ public class BigIntegerNotTest extends TestCase { /** * andNot for two positive numbers; the first is longer */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for andNot method.", - targets = { - @TestTarget( - methodName = "andNot", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for andNot method.", + method = "andNot", + args = {java.math.BigInteger.class} + ) public void testAndNotPosPosFirstLonger() { byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -67,15 +64,12 @@ public class BigIntegerNotTest extends TestCase { /** * andNot for two positive numbers; the first is shorter */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for andNot method.", - targets = { - @TestTarget( - methodName = "andNot", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for andNot method.", + method = "andNot", + args = {java.math.BigInteger.class} + ) public void testAndNotPosPosFirstShorter() { byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; byte bBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; @@ -96,15 +90,12 @@ public class BigIntegerNotTest extends TestCase { /** * andNot for two negative numbers; the first is longer */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for andNot method.", - targets = { - @TestTarget( - methodName = "andNot", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for andNot method.", + method = "andNot", + args = {java.math.BigInteger.class} + ) public void testAndNotNegNegFirstLonger() { byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -125,15 +116,12 @@ public class BigIntegerNotTest extends TestCase { /** * andNot for a negative and a positive numbers; the first is longer */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for andNot method.", - targets = { - @TestTarget( - methodName = "andNot", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for andNot method.", + method = "andNot", + args = {java.math.BigInteger.class} + ) public void testNegPosFirstLonger() { byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -154,15 +142,12 @@ public class BigIntegerNotTest extends TestCase { /** * Not for ZERO */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for not method.", - targets = { - @TestTarget( - methodName = "not", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for not method.", + method = "not", + args = {} + ) public void testNotZero() { byte rBytes[] = {-1}; BigInteger aNumber = BigInteger.ZERO; @@ -178,15 +163,12 @@ public class BigIntegerNotTest extends TestCase { /** * Not for ONE */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for not method.", - targets = { - @TestTarget( - methodName = "not", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for not method.", + method = "not", + args = {} + ) public void testNotOne() { byte rBytes[] = {-2}; BigInteger aNumber = BigInteger.ONE; @@ -202,15 +184,12 @@ public class BigIntegerNotTest extends TestCase { /** * Not for a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for not method.", - targets = { - @TestTarget( - methodName = "not", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for not method.", + method = "not", + args = {} + ) public void testNotPos() { byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117}; int aSign = 1; @@ -228,15 +207,12 @@ public class BigIntegerNotTest extends TestCase { /** * Not for a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for not method.", - targets = { - @TestTarget( - methodName = "not", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for not method.", + method = "not", + args = {} + ) public void testNotNeg() { byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117}; int aSign = -1; @@ -255,15 +231,12 @@ public class BigIntegerNotTest extends TestCase { * Not for a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for not method.", - targets = { - @TestTarget( - methodName = "not", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for not method.", + method = "not", + args = {} + ) public void testNotSpecialCase() { byte aBytes[] = {-1, -1, -1, -1}; int aSign = 1; diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOperateBitsTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerOperateBitsTest.java index 41f20e5..f28ec43 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOperateBitsTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerOperateBitsTest.java @@ -19,12 +19,12 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.math.BigInteger; @@ -39,15 +39,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * bitCount() of zero. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for bitCount method.", - targets = { - @TestTarget( - methodName = "bitCount", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for bitCount method.", + method = "bitCount", + args = {} + ) public void testBitCountZero() { BigInteger aNumber = new BigInteger("0"); assertEquals(0, aNumber.bitCount()); @@ -56,15 +53,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * bitCount() of a negative number. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for bitCount method.", - targets = { - @TestTarget( - methodName = "bitCount", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for bitCount method.", + method = "bitCount", + args = {} + ) public void testBitCountNeg() { BigInteger aNumber = new BigInteger("-12378634756382937873487638746283767238657872368748726875"); assertEquals(87, aNumber.bitCount()); @@ -73,15 +67,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * bitCount() of a negative number. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for bitCount method.", - targets = { - @TestTarget( - methodName = "bitCount", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for bitCount method.", + method = "bitCount", + args = {} + ) public void testBitCountPos() { BigInteger aNumber = new BigInteger("12378634756343564757582937873487638746283767238657872368748726875"); assertEquals(107, aNumber.bitCount()); @@ -90,15 +81,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * bitLength() of zero. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for bitLength method.", - targets = { - @TestTarget( - methodName = "bitLength", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for bitLength method.", + method = "bitLength", + args = {} + ) public void testBitLengthZero() { BigInteger aNumber = new BigInteger("0"); assertEquals(0, aNumber.bitLength()); @@ -107,15 +95,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * bitLength() of a positive number. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for bitLength method.", - targets = { - @TestTarget( - methodName = "bitLength", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for bitLength method.", + method = "bitLength", + args = {} + ) public void testBitLengthPositive1() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int aSign = 1; @@ -126,15 +111,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * bitLength() of a positive number with the leftmost bit set */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for bitLength method.", - targets = { - @TestTarget( - methodName = "bitLength", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for bitLength method.", + method = "bitLength", + args = {} + ) public void testBitLengthPositive2() { byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -145,15 +127,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * bitLength() of a positive number which is a power of 2 */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for bitLength method.", - targets = { - @TestTarget( - methodName = "bitLength", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for bitLength method.", + method = "bitLength", + args = {} + ) public void testBitLengthPositive3() { byte aBytes[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int aSign = 1; @@ -164,15 +143,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * bitLength() of a negative number. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for bitLength method.", - targets = { - @TestTarget( - methodName = "bitLength", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for bitLength method.", + method = "bitLength", + args = {} + ) public void testBitLengthNegative1() { byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int aSign = -1; @@ -183,15 +159,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * bitLength() of a negative number with the leftmost bit set */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for bitLength method.", - targets = { - @TestTarget( - methodName = "bitLength", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for bitLength method.", + method = "bitLength", + args = {} + ) public void testBitLengthNegative2() { byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -202,15 +175,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * bitLength() of a negative number which is a power of 2 */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for bitLength method.", - targets = { - @TestTarget( - methodName = "bitLength", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for bitLength method.", + method = "bitLength", + args = {} + ) public void testBitLengthNegative3() { byte aBytes[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int aSign = -1; @@ -221,15 +191,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(int n) of a negative n */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitException() { byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -246,15 +213,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(int n) outside zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitZero() { byte aBytes[] = {0}; int aSign = 0; @@ -273,15 +237,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(int n) outside zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitZeroOutside1() { byte aBytes[] = {0}; int aSign = 0; @@ -300,15 +261,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(int n) inside a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitNegativeInside1() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -327,15 +285,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(int n) inside a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitNegativeInside2() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -354,15 +309,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(2) in the negative number with all ones in bit representation */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitNegativeInside3() { String as = "-18446744073709551615"; int number = 2; @@ -376,15 +328,12 @@ public class BigIntegerOperateBitsTest extends TestCase { * with all ones in bit representation. * the resulting number's length is 2. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitNegativeInside4() { String as = "-4294967295"; String res = "-4294967296"; @@ -399,15 +348,12 @@ public class BigIntegerOperateBitsTest extends TestCase { * with all ones in bit representation. * the resulting number's length is 3. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitNegativeInside5() { String as = "-18446744073709551615"; String res = "-18446744073709551616"; @@ -420,15 +366,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(int n) outside a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitNegativeOutside1() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -447,15 +390,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(int n) outside a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitNegativeOutside2() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -474,15 +414,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(int n) inside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitPositiveInside1() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -501,15 +438,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(int n) inside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitPositiveInside2() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -528,15 +462,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(int n) inside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitPositiveInside3() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -555,15 +486,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(int n) inside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitPositiveInside4 () { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -582,15 +510,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(int n) inside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitPositiveInside5 () { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -609,15 +534,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(int n) outside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitPositiveOutside1() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -636,15 +558,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(int n) outside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitPositiveOutside2() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -663,15 +582,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * clearBit(int n) the leftmost bit in a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for clearBit method.", - targets = { - @TestTarget( - methodName = "clearBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for clearBit method.", + method = "clearBit", + args = {int.class} + ) public void testClearBitTopNegative() { byte aBytes[] = {1, -128, 56, 100, -15, 35, 26}; int aSign = -1; @@ -690,15 +606,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * flipBit(int n) of a negative n */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitException() { byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -715,15 +628,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * flipBit(int n) zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitZero() { byte aBytes[] = {0}; int aSign = 0; @@ -742,15 +652,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * flipBit(int n) outside zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitZeroOutside1() { byte aBytes[] = {0}; int aSign = 0; @@ -769,15 +676,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * flipBit(int n) outside zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitZeroOutside2() { byte aBytes[] = {0}; int aSign = 0; @@ -796,15 +700,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * flipBit(int n) the leftmost bit in a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitLeftmostNegative() { byte aBytes[] = {1, -128, 56, 100, -15, 35, 26}; int aSign = -1; @@ -823,15 +724,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * flipBit(int n) the leftmost bit in a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitLeftmostPositive() { byte aBytes[] = {1, -128, 56, 100, -15, 35, 26}; int aSign = 1; @@ -850,15 +748,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * flipBit(int n) inside a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitNegativeInside1() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -877,15 +772,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * flipBit(int n) inside a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitNegativeInside2() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -904,15 +796,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * flipBit(int n) inside a negative number with all ones in bit representation */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitNegativeInside3() { String as = "-18446744073709551615"; String res = "-18446744073709551611"; @@ -927,15 +816,12 @@ public class BigIntegerOperateBitsTest extends TestCase { * with all ones in bit representation. * the resulting number's length is 2. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitNegativeInside4() { String as = "-4294967295"; String res = "-4294967296"; @@ -950,15 +836,12 @@ public class BigIntegerOperateBitsTest extends TestCase { * with all ones in bit representation. * the resulting number's length is 3. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitNegativeInside5() { String as = "-18446744073709551615"; String res = "-18446744073709551616"; @@ -971,15 +854,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * flipBit(int n) outside a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitNegativeOutside1() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -998,15 +878,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * flipBit(int n) outside a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitNegativeOutside2() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -1025,15 +902,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * flipBit(int n) inside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitPositiveInside1() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1052,15 +926,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * flipBit(int n) inside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitPositiveInside2() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1079,15 +950,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * flipBit(int n) outside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitPositiveOutside1() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1106,15 +974,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * flipBit(int n) outside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for flipBit method.", - targets = { - @TestTarget( - methodName = "flipBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for flipBit method.", + method = "flipBit", + args = {int.class} + ) public void testFlipBitPositiveOutside2() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1133,15 +998,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) of a negative n */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitException() { byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1158,15 +1020,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) outside zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitZero() { byte aBytes[] = {0}; int aSign = 0; @@ -1185,15 +1044,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) outside zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitZeroOutside1() { byte aBytes[] = {0}; int aSign = 0; @@ -1212,15 +1068,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) inside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitPositiveInside1() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1239,15 +1092,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) inside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitPositiveInside2() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1266,15 +1116,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) inside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitPositiveInside3() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1293,15 +1140,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) inside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitPositiveInside4 () { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1320,15 +1164,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) outside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitPositiveOutside1() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1347,15 +1188,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) outside a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitPositiveOutside2() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1374,15 +1212,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) the leftmost bit in a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitTopPositive() { byte aBytes[] = {1, -128, 56, 100, -15, 35, 26}; int aSign = 1; @@ -1401,15 +1236,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) the leftmost bit in a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitLeftmostNegative() { byte aBytes[] = {1, -128, 56, 100, -15, 35, 26}; int aSign = -1; @@ -1428,15 +1260,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) inside a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitNegativeInside1() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -1455,15 +1284,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) inside a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitNegativeInside2() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -1482,15 +1308,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) inside a negative number with all ones in bit representation */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitNegativeInside3() { String as = "-18446744073709551615"; String res = "-18446744073709551611"; @@ -1505,15 +1328,12 @@ public class BigIntegerOperateBitsTest extends TestCase { * with all ones in bit representation. * the resulting number's length is 2. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitNegativeInside4() { String as = "-4294967295"; int number = 0; @@ -1527,15 +1347,12 @@ public class BigIntegerOperateBitsTest extends TestCase { * with all ones in bit representation. * the resulting number's length is 3. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitNegativeInside5() { String as = "-18446744073709551615"; int number = 0; @@ -1547,15 +1364,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) outside a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitNegativeOutside1() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -1574,15 +1388,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * setBit(int n) outside a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitNegativeOutside2() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -1603,15 +1414,12 @@ public class BigIntegerOperateBitsTest extends TestCase { * represented as n * 32 + 31, where n is an arbitrary integer. * Here 191 = 5 * 32 + 31 */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for setBit method.", - targets = { - @TestTarget( - methodName = "setBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for setBit method.", + method = "setBit", + args = {int.class} + ) public void testSetBitBug1331() { BigInteger result = BigInteger.valueOf(0L).setBit(191); assertEquals("incorrect value", "3138550867693340381917894711603833208051177722232017256448", result.toString()); @@ -1621,15 +1429,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * shiftLeft(int n), n = 0 */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftLeft method.", - targets = { - @TestTarget( - methodName = "shiftLeft", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftLeft method.", + method = "shiftLeft", + args = {int.class} + ) public void testShiftLeft1() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1648,15 +1453,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * shiftLeft(int n), n < 0 */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftLeft method.", - targets = { - @TestTarget( - methodName = "shiftLeft", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftLeft method.", + method = "shiftLeft", + args = {int.class} + ) public void testShiftLeft2() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1675,15 +1477,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * shiftLeft(int n) a positive number, n > 0 */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftLeft method.", - targets = { - @TestTarget( - methodName = "shiftLeft", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftLeft method.", + method = "shiftLeft", + args = {int.class} + ) public void testShiftLeft3() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1702,15 +1501,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * shiftLeft(int n) a positive number, n > 0 */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftLeft method.", - targets = { - @TestTarget( - methodName = "shiftLeft", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftLeft method.", + method = "shiftLeft", + args = {int.class} + ) public void testShiftLeft4() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1729,15 +1525,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * shiftLeft(int n) a negative number, n > 0 */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftLeft method.", - targets = { - @TestTarget( - methodName = "shiftLeft", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftLeft method.", + method = "shiftLeft", + args = {int.class} + ) public void testShiftLeft5() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -1756,15 +1549,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * shiftRight(int n), n = 0 */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "shiftRight", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "shiftRight", + args = {int.class} + ) public void testShiftRight1() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1783,15 +1573,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * shiftRight(int n), n < 0 */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "shiftRight", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "shiftRight", + args = {int.class} + ) public void testShiftRight2() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1810,15 +1597,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * shiftRight(int n), 0 < n < 32 */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "shiftRight", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "shiftRight", + args = {int.class} + ) public void testShiftRight3() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1837,15 +1621,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * shiftRight(int n), n > 32 */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "shiftRight", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "shiftRight", + args = {int.class} + ) public void testShiftRight4() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1864,15 +1645,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * shiftRight(int n), n is greater than bitLength() */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "shiftRight", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "shiftRight", + args = {int.class} + ) public void testShiftRight5() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -1893,15 +1671,12 @@ public class BigIntegerOperateBitsTest extends TestCase { * shift distance is multiple of 32; * shifted bits are NOT zeroes. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "shiftRight", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "shiftRight", + args = {int.class} + ) public void testShiftRightNegNonZeroesMul32() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 1, 0, 0, 0, 0, 0, 0, 0}; int aSign = -1; @@ -1922,15 +1697,12 @@ public class BigIntegerOperateBitsTest extends TestCase { * shift distance is NOT multiple of 32; * shifted bits are NOT zeroes. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "shiftRight", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "shiftRight", + args = {int.class} + ) public void testShiftRightNegNonZeroes() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 0, 0, 0, 0, 0, 0, 0, 0}; int aSign = -1; @@ -1951,15 +1723,12 @@ public class BigIntegerOperateBitsTest extends TestCase { * shift distance is NOT multiple of 32; * shifted bits are zeroes. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "shiftRight", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "shiftRight", + args = {int.class} + ) public void testShiftRightNegZeroes() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int aSign = -1; @@ -1980,15 +1749,12 @@ public class BigIntegerOperateBitsTest extends TestCase { * shift distance is multiple of 32; * shifted bits are zeroes. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "shiftRight", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "shiftRight", + args = {int.class} + ) public void testShiftRightNegZeroesMul32() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 0, 0, 0, 0, 0, 0, 0, 0}; int aSign = -1; @@ -2007,15 +1773,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * testBit(int n) of a negative n */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "testBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "testBit", + args = {int.class} + ) public void testTestBitException() { byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -2032,15 +1795,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * testBit(int n) of a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "testBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "testBit", + args = {int.class} + ) public void testTestBitPositive1() { byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -2052,15 +1812,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * testBit(int n) of a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "testBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "testBit", + args = {int.class} + ) public void testTestBitPositive2() { byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -2072,15 +1829,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * testBit(int n) of a positive number, n > bitLength() */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "testBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "testBit", + args = {int.class} + ) public void testTestBitPositive3() { byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; @@ -2092,15 +1846,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * testBit(int n) of a negative number */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "testBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "testBit", + args = {int.class} + ) public void testTestBitNegative1() { byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -2112,15 +1863,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * testBit(int n) of a positive n */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "testBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "testBit", + args = {int.class} + ) public void testTestBitNegative2() { byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -2132,15 +1880,12 @@ public class BigIntegerOperateBitsTest extends TestCase { /** * testBit(int n) of a positive n, n > bitLength() */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for shiftRight method.", - targets = { - @TestTarget( - methodName = "testBit", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for shiftRight method.", + method = "testBit", + args = {int.class} + ) public void testTestBitNegative3() { byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; @@ -2155,15 +1900,12 @@ public class BigIntegerOperateBitsTest extends TestCase { * @tests java.math.BigInteger#getLowestSetBit() getLowestSetBit for * negative BigInteger */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for getLowestSetBit method.", - targets = { - @TestTarget( - methodName = "getLowestSetBit", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for getLowestSetBit method.", + method = "getLowestSetBit", + args = {} + ) public void test_getLowestSetBitNeg() { byte aBytes[] = { -1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26 @@ -2179,15 +1921,12 @@ public class BigIntegerOperateBitsTest extends TestCase { * @tests java.math.BigInteger#getLowestSetBit() getLowestSetBit for * positive BigInteger */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for getLowestSetBit method.", - targets = { - @TestTarget( - methodName = "getLowestSetBit", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for getLowestSetBit method.", + method = "getLowestSetBit", + args = {} + ) public void test_getLowestSetBitPos() { byte aBytes[] = { -1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26 @@ -2219,15 +1958,12 @@ public class BigIntegerOperateBitsTest extends TestCase { * @tests java.math.BigInteger#getLowestSetBit() getLowestSetBit for zero * BigInteger */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for getLowestSetBit method.", - targets = { - @TestTarget( - methodName = "getLowestSetBit", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for getLowestSetBit method.", + method = "getLowestSetBit", + args = {} + ) public void test_getLowestSetBitZero() { byte[] aBytes = { 0 diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOrTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerOrTest.java index e6efeb0..b3dd5fa 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOrTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerOrTest.java @@ -19,12 +19,12 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.math.BigInteger; @@ -38,15 +38,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for zero and a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testZeroPos() { byte aBytes[] = {0}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -67,15 +64,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for zero and a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testZeroNeg() { byte aBytes[] = {0}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -96,15 +90,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for a positive number and zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testPosZero() { byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; byte bBytes[] = {0}; @@ -125,15 +116,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for a negative number and zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testNegPos() { byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; byte bBytes[] = {0}; @@ -154,15 +142,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for zero and zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testZeroZero() { byte aBytes[] = {0}; byte bBytes[] = {0}; @@ -183,15 +168,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for zero and one */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testZeroOne() { byte aBytes[] = {0}; byte bBytes[] = {1}; @@ -212,15 +194,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for one and one */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testOneOne() { byte aBytes[] = {1}; byte bBytes[] = {1}; @@ -241,15 +220,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for two positive numbers of the same length */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testPosPosSameLength() { byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -270,15 +246,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for two positive numbers; the first is longer */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testPosPosFirstLonger() { byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -299,15 +272,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for two positive numbers; the first is shorter */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testPosPosFirstShorter() { byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; byte bBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; @@ -328,15 +298,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for two negative numbers of the same length */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testNegNegSameLength() { byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -357,15 +324,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for two negative numbers; the first is longer */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testNegNegFirstLonger() { byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -386,15 +350,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for two negative numbers; the first is shorter */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testNegNegFirstShorter() { byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; byte bBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; @@ -415,15 +376,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for two numbers of different signs and the same length */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testPosNegSameLength() { byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -444,15 +402,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for two numbers of different signs and the same length */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testNegPosSameLength() { byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -473,15 +428,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for a negative and a positive numbers; the first is longer */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testNegPosFirstLonger() { byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -502,15 +454,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for two negative numbers; the first is shorter */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testNegPosFirstShorter() { byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; byte bBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; @@ -531,15 +480,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for a positive and a negative numbers; the first is longer */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testPosNegFirstLonger() { byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; @@ -560,15 +506,12 @@ public class BigIntegerOrTest extends TestCase { /** * Or for a positive and a negative number; the first is shorter */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testPosNegFirstShorter() { byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; byte bBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75}; @@ -586,15 +529,12 @@ public class BigIntegerOrTest extends TestCase { assertEquals("incorrect sign", -1, result.signum()); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for or operation", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for or operation", + method = "or", + args = {java.math.BigInteger.class} + ) public void testRegression() { // Regression test for HARMONY-1996 BigInteger x = new BigInteger("-1023"); diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerSubtractTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerSubtractTest.java index 7750fc0..29d8405 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerSubtractTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerSubtractTest.java @@ -19,12 +19,12 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.math.BigInteger; @@ -39,15 +39,12 @@ public class BigIntegerSubtractTest extends TestCase { * Subtract two positive numbers of the same length. * The first is greater. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase1() { byte aBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3}; @@ -69,15 +66,12 @@ public class BigIntegerSubtractTest extends TestCase { * Subtract two positive numbers of the same length. * The second is greater. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase2() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -100,15 +94,12 @@ public class BigIntegerSubtractTest extends TestCase { * The first is positive. * The first is greater in absolute value. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase3() { byte aBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3}; @@ -131,15 +122,12 @@ public class BigIntegerSubtractTest extends TestCase { * The first is positive. * The second is greater in absolute value. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase4() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -161,15 +149,12 @@ public class BigIntegerSubtractTest extends TestCase { * Subtract two negative numbers of the same length. * The first is greater in absolute value. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase5() { byte aBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3}; @@ -191,15 +176,12 @@ public class BigIntegerSubtractTest extends TestCase { * Subtract two negative numbers of the same length. * The second is greater in absolute value. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase6() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -222,15 +204,12 @@ public class BigIntegerSubtractTest extends TestCase { * The first is negative. * The first is greater in absolute value. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase7() { byte aBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3}; @@ -253,15 +232,12 @@ public class BigIntegerSubtractTest extends TestCase { * The first is negative. * The second is greater in absolute value. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase8() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -283,15 +259,12 @@ public class BigIntegerSubtractTest extends TestCase { * Subtract two positive numbers of different length. * The first is longer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase9() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -313,15 +286,12 @@ public class BigIntegerSubtractTest extends TestCase { * Subtract two positive numbers of different length. * The second is longer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase10() { byte aBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; @@ -344,15 +314,12 @@ public class BigIntegerSubtractTest extends TestCase { * The first is positive. * The first is greater in absolute value. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase11() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -375,15 +342,12 @@ public class BigIntegerSubtractTest extends TestCase { * The first is positive. * The second is greater in absolute value. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase12() { byte aBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; @@ -406,15 +370,12 @@ public class BigIntegerSubtractTest extends TestCase { * The first is negative. * The first is longer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase13() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -437,15 +398,12 @@ public class BigIntegerSubtractTest extends TestCase { * The first is negative. * The second is longer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase14() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -467,15 +425,12 @@ public class BigIntegerSubtractTest extends TestCase { * Subtract two negative numbers of different length. * The first is longer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase15() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; @@ -497,15 +452,12 @@ public class BigIntegerSubtractTest extends TestCase { * Subtract two negative numbers of different length. * The second is longer. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase16() { byte aBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; byte bBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; @@ -526,15 +478,12 @@ public class BigIntegerSubtractTest extends TestCase { /** * Subtract two positive equal in absolute value numbers. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase17() { byte aBytes[] = {-120, 34, 78, -23, -111, 45, 127, 23, 45, -3}; byte bBytes[] = {-120, 34, 78, -23, -111, 45, 127, 23, 45, -3}; @@ -556,15 +505,12 @@ public class BigIntegerSubtractTest extends TestCase { * Subtract zero from a number. * The number is positive. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase18() { byte aBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3}; byte bBytes[] = {0}; @@ -586,15 +532,12 @@ public class BigIntegerSubtractTest extends TestCase { * Subtract a number from zero. * The number is negative. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase19() { byte aBytes[] = {0}; byte bBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3}; @@ -615,15 +558,12 @@ public class BigIntegerSubtractTest extends TestCase { /** * Subtract zero from zero. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase20() { byte aBytes[] = {0}; byte bBytes[] = {0}; @@ -645,15 +585,12 @@ public class BigIntegerSubtractTest extends TestCase { * Subtract ZERO from a number. * The number is positive. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase21() { byte aBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3}; byte rBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3}; @@ -673,15 +610,12 @@ public class BigIntegerSubtractTest extends TestCase { * Subtract a number from ZERO. * The number is negative. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase22() { byte bBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3}; byte rBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3}; @@ -700,15 +634,12 @@ public class BigIntegerSubtractTest extends TestCase { /** * Subtract ZERO from ZERO. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase23() { byte rBytes[] = {0}; BigInteger aNumber = BigInteger.ZERO; @@ -725,15 +656,12 @@ public class BigIntegerSubtractTest extends TestCase { /** * Subtract ONE from ONE. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase24() { byte rBytes[] = {0}; BigInteger aNumber = BigInteger.ONE; @@ -750,15 +678,12 @@ public class BigIntegerSubtractTest extends TestCase { /** * Subtract two numbers so that borrow is 1. */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for subtract method", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for subtract method", + method = "subtract", + args = {java.math.BigInteger.class} + ) public void testCase25() { byte aBytes[] = {-1, -1, -1, -1, -1, -1, -1, -1}; byte bBytes[] = {-128, -128, -128, -128, -128, -128, -128, -128, -128}; diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerToStringTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerToStringTest.java index bd0d0b1..c405553 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerToStringTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerToStringTest.java @@ -19,12 +19,12 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.math.BigInteger; @@ -38,15 +38,12 @@ public class BigIntegerToStringTest extends TestCase { /** * If 36 < radix < 2 it should be set to 10 */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {int.class} + ) public void testRadixOutOfRange() { String value = "442429234853876401"; int radix = 10; @@ -58,15 +55,12 @@ public class BigIntegerToStringTest extends TestCase { /** * test negative number of radix 2 */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {int.class} + ) public void testRadix2Neg() { String value = "-101001100010010001001010101110000101010110001010010101010101010101010101010101010101010101010010101"; int radix = 2; @@ -78,15 +72,12 @@ public class BigIntegerToStringTest extends TestCase { /** * test positive number of radix 2 */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {int.class} + ) public void testRadix2Pos() { String value = "101000011111000000110101010101010101010001001010101010101010010101010101010000100010010"; int radix = 2; @@ -98,15 +89,12 @@ public class BigIntegerToStringTest extends TestCase { /** * test negative number of radix 10 */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {int.class} + ) public void testRadix10Neg() { String value = "-2489756308572364789878394872984"; int radix = 16; @@ -118,15 +106,12 @@ public class BigIntegerToStringTest extends TestCase { /** * test positive number of radix 10 */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {int.class} + ) public void testRadix10Pos() { String value = "2387627892347567398736473476"; int radix = 16; @@ -138,15 +123,12 @@ public class BigIntegerToStringTest extends TestCase { /** * test negative number of radix 16 */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {int.class} + ) public void testRadix16Neg() { String value = "-287628a883451b800865c67e8d7ff20"; int radix = 16; @@ -158,15 +140,12 @@ public class BigIntegerToStringTest extends TestCase { /** * test positive number of radix 16 */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {int.class} + ) public void testRadix16Pos() { String value = "287628a883451b800865c67e8d7ff20"; int radix = 16; @@ -178,15 +157,12 @@ public class BigIntegerToStringTest extends TestCase { /** * test negative number of radix 24 */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {int.class} + ) public void testRadix24Neg() { String value = "-287628a88gmn3451b8ijk00865c67e8d7ff20"; int radix = 24; @@ -198,15 +174,12 @@ public class BigIntegerToStringTest extends TestCase { /** * test positive number of radix 24 */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {int.class} + ) public void testRadix24Pos() { String value = "287628a883451bg80ijhk0865c67e8d7ff20"; int radix = 24; @@ -218,15 +191,12 @@ public class BigIntegerToStringTest extends TestCase { /** * test negative number of radix 24 */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {int.class} + ) public void testRadix36Neg() { String value = "-uhguweut98iu4h3478tq3985pq98yeiuth33485yq4aiuhalai485yiaehasdkr8tywi5uhslei8"; int radix = 36; @@ -238,15 +208,12 @@ public class BigIntegerToStringTest extends TestCase { /** * test positive number of radix 24 */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {int.class} + ) public void testRadix36Pos() { String value = "23895lt45y6vhgliuwhgi45y845htsuerhsi4586ysuerhtsio5y68peruhgsil4568ypeorihtse48y6"; int radix = 36; @@ -260,15 +227,12 @@ public class BigIntegerToStringTest extends TestCase { /** * @tests java.math.BigInteger#toString() */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {} + ) public void test_toString1() { String s = "0000000000"; @@ -280,15 +244,12 @@ public class BigIntegerToStringTest extends TestCase { /** * @tests java.math.BigInteger#toString() */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {} + ) public void test_toString2() { String s = "1234567890987654321"; BigInteger bi = new BigInteger(s); @@ -299,15 +260,12 @@ public class BigIntegerToStringTest extends TestCase { /** * @tests java.math.BigInteger#toString() */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {} + ) public void test_toString3() { String s = "-1234567890987654321"; BigInteger bi = new BigInteger(s); @@ -318,15 +276,12 @@ public class BigIntegerToStringTest extends TestCase { /** * @tests java.math.BigInteger#toString() */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {} + ) public void test_toString4() { String s = "12345678901234"; long l = 12345678901234L; @@ -338,15 +293,12 @@ public class BigIntegerToStringTest extends TestCase { /** * @tests java.math.BigInteger#toString() */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {} + ) public void test_toString5() { String s = "-12345678901234"; long l = -12345678901234L; @@ -358,15 +310,12 @@ public class BigIntegerToStringTest extends TestCase { /** * @tests java.math.BigInteger#toString() */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "This is a complete subset of tests for toString method", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "This is a complete subset of tests for toString method", + method = "toString", + args = {} + ) public void test_toString() { byte aBytes[] = { 12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91 diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerXorTest.java b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerXorTest.java index 5098361..4e2dbcf 100644 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerXorTest.java +++ b/math/src/test/java/org/apache/harmony/math/tests/java/math/BigIntegerXorTest.java @@ -19,12 +19,12 @@ * @version $Revision$ */ -package org.apache.harmony.tests.java.math; +package org.apache.harmony.math.tests.java.math; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.math.BigInteger; @@ -38,15 +38,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for zero and a positive number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testZeroPos() { String numA = "0"; String numB = "27384627835298756289327365"; @@ -60,15 +57,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for zero and a negative number */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testZeroNeg() { String numA = "0"; String numB = "-27384627835298756289327365"; @@ -82,15 +76,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for a positive number and zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testPosZero() { String numA = "27384627835298756289327365"; String numB = "0"; @@ -104,15 +95,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for a negative number and zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testNegPos() { String numA = "-27384627835298756289327365"; String numB = "0"; @@ -126,15 +114,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for zero and zero */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testZeroZero() { String numA = "0"; String numB = "0"; @@ -148,15 +133,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for zero and one */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testZeroOne() { String numA = "0"; String numB = "1"; @@ -170,15 +152,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for one and one */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testOneOne() { String numA = "1"; String numB = "1"; @@ -192,15 +171,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for two positive numbers of the same length */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testPosPosSameLength() { String numA = "283746278342837476784564875684767"; String numB = "293478573489347658763745839457637"; @@ -214,15 +190,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for two positive numbers; the first is longer */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testPosPosFirstLonger() { String numA = "2837462783428374767845648748973847593874837948575684767"; String numB = "293478573489347658763745839457637"; @@ -236,15 +209,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for two positive numbers; the first is shorter */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testPosPosFirstShorter() { String numA = "293478573489347658763745839457637"; String numB = "2837462783428374767845648748973847593874837948575684767"; @@ -258,15 +228,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for two negative numbers of the same length */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testNegNegSameLength() { String numA = "-283746278342837476784564875684767"; String numB = "-293478573489347658763745839457637"; @@ -280,15 +247,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for two negative numbers; the first is longer */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testNegNegFirstLonger() { String numA = "-2837462783428374767845648748973847593874837948575684767"; String numB = "-293478573489347658763745839457637"; @@ -302,15 +266,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for two negative numbers; the first is shorter */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testNegNegFirstShorter() { String numA = "293478573489347658763745839457637"; String numB = "2837462783428374767845648748973847593874837948575684767"; @@ -324,15 +285,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for two numbers of different signs and the same length */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testPosNegSameLength() { String numA = "283746278342837476784564875684767"; String numB = "-293478573489347658763745839457637"; @@ -346,15 +304,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for two numbers of different signs and the same length */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testNegPosSameLength() { String numA = "-283746278342837476784564875684767"; String numB = "293478573489347658763745839457637"; @@ -368,15 +323,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for a negative and a positive numbers; the first is longer */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testNegPosFirstLonger() { String numA = "-2837462783428374767845648748973847593874837948575684767"; String numB = "293478573489347658763745839457637"; @@ -390,15 +342,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for two negative numbers; the first is shorter */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testNegPosFirstShorter() { String numA = "-293478573489347658763745839457637"; String numB = "2837462783428374767845648748973847593874837948575684767"; @@ -412,15 +361,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for a positive and a negative numbers; the first is longer */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testPosNegFirstLonger() { String numA = "2837462783428374767845648748973847593874837948575684767"; String numB = "-293478573489347658763745839457637"; @@ -434,15 +380,12 @@ public class BigIntegerXorTest extends TestCase { /** * Xor for a positive and a negative number; the first is shorter */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for xor operation.", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "This is a complete subset of tests for xor operation.", + method = "xor", + args = {java.math.BigInteger.class} + ) public void testPosNegFirstShorter() { String numA = "293478573489347658763745839457637"; String numB = "-2837462783428374767845648748973847593874837948575684767"; diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java b/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java deleted file mode 100644 index 44966e3..0000000 --- a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java +++ /dev/null @@ -1,1201 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Elena Semukhina - * @version $Revision$ - */ - -package org.apache.harmony.tests.java.math; - -import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; -import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.math.MathContext; -import java.math.RoundingMode; - -import junit.framework.TestCase; -@TestTargetClass(BigDecimal.class) -/** - * Class: java.math.BigDecimal - * Methods: constructors and fields - */ -public class BigDecimalConstructorsTest extends TestCase { - /** - * check ONE - */ - public void testFieldONE() { - String oneS = "1"; - double oneD = 1.0; - assertEquals("incorrect string value", oneS, BigDecimal.ONE.toString()); - assertEquals("incorrect double value", oneD, BigDecimal.ONE.doubleValue(), 0); - } - - /** - * check TEN - */ - public void testFieldTEN() { - String oneS = "10"; - double oneD = 10.0; - assertEquals("incorrect string value", oneS, BigDecimal.TEN.toString()); - assertEquals("incorrect double value", oneD, BigDecimal.TEN.doubleValue(), 0); - } - - /** - * check ZERO - */ - public void testFieldZERO() { - String oneS = "0"; - double oneD = 0.0; - assertEquals("incorrect string value", oneS, BigDecimal.ZERO.toString()); - assertEquals("incorrect double value", oneD, BigDecimal.ZERO.doubleValue(), 0); - } - - /** - * new BigDecimal(BigInteger value) - */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.math.BigInteger.class} - ) - }) - public void testConstrBI() { - String a = "1231212478987482988429808779810457634781384756794987"; - BigInteger bA = new BigInteger(a); - BigDecimal aNumber = new BigDecimal(bA); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", 0, aNumber.scale()); - - try { - new BigDecimal((BigInteger) null); - fail("No NullPointerException"); - } catch (NullPointerException e) { - //expected - } - } - - /** - * new BigDecimal(BigInteger value, int scale) - */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.math.BigInteger.class, int.class} - ) - }) - public void testConstrBIScale() { - String a = "1231212478987482988429808779810457634781384756794987"; - BigInteger bA = new BigInteger(a); - int aScale = 10; - BigDecimal aNumber = new BigDecimal(bA, aScale); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(BigInteger value, MathContext) - */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.math.BigInteger.class, java.math.MathContext.class} - ) - }) - public void testConstrBigIntegerMathContext() { - String a = "1231212478987482988429808779810457634781384756794987"; - BigInteger bA = new BigInteger(a); - int precision = 46; - RoundingMode rm = RoundingMode.CEILING; - MathContext mc = new MathContext(precision, rm); - String res = "1231212478987482988429808779810457634781384757"; - int resScale = -6; - BigDecimal result = new BigDecimal(bA, mc); - assertEquals("incorrect value", res, result.unscaledValue().toString()); - assertEquals("incorrect scale", resScale, result.scale()); - } - - /** - * new BigDecimal(BigInteger value, int scale, MathContext) - */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.math.BigInteger.class, int.class, java.math.MathContext.class} - ) - }) - public void testConstrBigIntegerScaleMathContext() { - String a = "1231212478987482988429808779810457634781384756794987"; - BigInteger bA = new BigInteger(a); - int aScale = 10; - int precision = 46; - RoundingMode rm = RoundingMode.CEILING; - MathContext mc = new MathContext(precision, rm); - String res = "1231212478987482988429808779810457634781384757"; - int resScale = 4; - BigDecimal result = new BigDecimal(bA, aScale, mc); - assertEquals("incorrect value", res, result.unscaledValue().toString()); - assertEquals("incorrect scale", resScale, result.scale()); - } - - /** - * new BigDecimal(char[] value); - */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {char[].class} - ) - }) - public void testConstrChar() { - char value[] = {'-', '1', '2', '3', '8', '0', '.', '4', '7', '3', '8', 'E', '-', '4', '2', '3'}; - BigDecimal result = new BigDecimal(value); - String res = "-1.23804738E-419"; - int resScale = 427; - assertEquals("incorrect value", res, result.toString()); - assertEquals("incorrect scale", resScale, result.scale()); - - try { - // Regression for HARMONY-783 - new BigDecimal(new char[] {}); - fail("NumberFormatException has not been thrown"); - } catch (NumberFormatException e) { - } - } - - /** - * new BigDecimal(char[] value, int offset, int len); - */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {char[].class, int.class, int.class} - ) - }) - public void testConstrCharIntInt() { - char value[] = {'-', '1', '2', '3', '8', '0', '.', '4', '7', '3', '8', 'E', '-', '4', '2', '3'}; - int offset = 3; - int len = 12; - BigDecimal result = new BigDecimal(value, offset, len); - String res = "3.804738E-40"; - int resScale = 46; - assertEquals("incorrect value", res, result.toString()); - assertEquals("incorrect scale", resScale, result.scale()); - - try { - // Regression for HARMONY-783 - new BigDecimal(new char[] {}, 0, 0); - fail("NumberFormatException has not been thrown"); - } catch (NumberFormatException e) { - } - } - - /** - * new BigDecimal(char[] value, int offset, int len, MathContext mc); - */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {char[].class, int.class, int.class, java.math.MathContext.class} - ) - }) - public void testConstrCharIntIntMathContext() { - char value[] = {'-', '1', '2', '3', '8', '0', '.', '4', '7', '3', '8', 'E', '-', '4', '2', '3'}; - int offset = 3; - int len = 12; - int precision = 4; - RoundingMode rm = RoundingMode.CEILING; - MathContext mc = new MathContext(precision, rm); - BigDecimal result = new BigDecimal(value, offset, len, mc); - String res = "3.805E-40"; - int resScale = 43; - assertEquals("incorrect value", res, result.toString()); - assertEquals("incorrect scale", resScale, result.scale()); - - try { - // Regression for HARMONY-783 - new BigDecimal(new char[] {}, 0, 0, MathContext.DECIMAL32); - fail("NumberFormatException has not been thrown"); - } catch (NumberFormatException e) { - } - } - - /** - * new BigDecimal(char[] value, int offset, int len, MathContext mc); - */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {char[].class, int.class, int.class, java.math.MathContext.class} - ) - }) - public void testConstrCharIntIntMathContextException1() { - char value[] = {'-', '1', '2', '3', '8', '0', '.', '4', '7', '3', '8', 'E', '-', '4', '2', '3'}; - int offset = 3; - int len = 120; - int precision = 4; - RoundingMode rm = RoundingMode.CEILING; - MathContext mc = new MathContext(precision, rm); - try { - new BigDecimal(value, offset, len, mc); - fail("NumberFormatException has not been thrown"); - } catch (NumberFormatException e) { - } - } - - /** - * new BigDecimal(char[] value, int offset, int len, MathContext mc); - */ -@TestInfo( - level = TestLevel.TODO, - purpose = "The same as testConstrCharIntIntMathContextException1." + - "Probably this is an initial stage for testing ArithmeticException", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {char[].class, int.class, int.class, java.math.MathContext.class} - ) - }) - public void testConstrCharIntIntMathContextException2() { - char value[] = {'-', '1', '2', '3', '8', '0', ',', '4', '7', '3', '8', 'E', '-', '4', '2', '3'}; - int offset = 3; - int len = 120; - int precision = 4; - RoundingMode rm = RoundingMode.CEILING; - MathContext mc = new MathContext(precision, rm); - try { - new BigDecimal(value, offset, len, mc); - fail("NumberFormatException has not been thrown"); - } catch (NumberFormatException e) { - } - } - - /** - * new BigDecimal(char[] value, MathContext mc); - */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Regression. Checks NumberFormatException.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {char[].class, java.math.MathContext.class} - ) - }) - public void testConstrCharMathContext() { - try { - // Regression for HARMONY-783 - new BigDecimal(new char[] {}, MathContext.DECIMAL32); - fail("NumberFormatException has not been thrown"); - } catch (NumberFormatException e) { - } - } - - /** - * new BigDecimal(double value) when value is NaN - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(double) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {double.class} - ) - }) - public void testConstrDoubleNaN() { - double a = Double.NaN; - try { - new BigDecimal(a); - fail("NumberFormatException has not been caught"); - } catch (NumberFormatException e) { - assertEquals("Improper exception message", "Infinite or NaN", e - .getMessage()); - } - } - - /** - * new BigDecimal(double value) when value is positive infinity - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(double) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {double.class} - ) - }) - public void testConstrDoublePosInfinity() { - double a = Double.POSITIVE_INFINITY; - try { - new BigDecimal(a); - fail("NumberFormatException has not been caught"); - } catch (NumberFormatException e) { - assertEquals("Improper exception message", "Infinite or NaN", - e.getMessage()); - } - } - - /** - * new BigDecimal(double value) when value is positive infinity - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(double) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {double.class} - ) - }) - public void testConstrDoubleNegInfinity() { - double a = Double.NEGATIVE_INFINITY; - try { - new BigDecimal(a); - fail("NumberFormatException has not been caught"); - } catch (NumberFormatException e) { - assertEquals("Improper exception message", "Infinite or NaN", - e.getMessage()); - } - } - - /** - * new BigDecimal(double value) - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(double) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {double.class} - ) - }) - public void testConstrDouble() { - double a = 732546982374982347892379283571094797.287346782359284756; - int aScale = 0; - BigInteger bA = new BigInteger("732546982374982285073458350476230656"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(double, MathContext) - */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Exception checking missed.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {double.class, java.math.MathContext.class} - ) - }) - public void testConstrDoubleMathContext() { - double a = 732546982374982347892379283571094797.287346782359284756; - int precision = 21; - RoundingMode rm = RoundingMode.CEILING; - MathContext mc = new MathContext(precision, rm); - String res = "732546982374982285074"; - int resScale = -15; - BigDecimal result = new BigDecimal(a, mc); - assertEquals("incorrect value", res, result.unscaledValue().toString()); - assertEquals("incorrect scale", resScale, result.scale()); - } - - /** - * new BigDecimal(0.1) - */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(double) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {double.class} - ) - }) - public void testConstrDouble01() { - double a = 1.E-1; - int aScale = 55; - BigInteger bA = new BigInteger("1000000000000000055511151231257827021181583404541015625"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(0.555) - */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(double) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {double.class} - ) - }) - public void testConstrDouble02() { - double a = 0.555; - int aScale = 53; - BigInteger bA = new BigInteger("55500000000000004884981308350688777863979339599609375"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(-0.1) - */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(double) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {double.class} - ) - }) - public void testConstrDoubleMinus01() { - double a = -1.E-1; - int aScale = 55; - BigInteger bA = new BigInteger("-1000000000000000055511151231257827021181583404541015625"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(int value) - */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {int.class} - ) - }) - public void testConstrInt() { - int a = 732546982; - String res = "732546982"; - int resScale = 0; - BigDecimal result = new BigDecimal(a); - assertEquals("incorrect value", res, result.unscaledValue().toString()); - assertEquals("incorrect scale", resScale, result.scale()); - } - - /** - * new BigDecimal(int, MathContext) - */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {int.class, java.math.MathContext.class} - ) - }) - public void testConstrIntMathContext() { - int a = 732546982; - int precision = 21; - RoundingMode rm = RoundingMode.CEILING; - MathContext mc = new MathContext(precision, rm); - String res = "732546982"; - int resScale = 0; - BigDecimal result = new BigDecimal(a, mc); - assertEquals("incorrect value", res, result.unscaledValue().toString()); - assertEquals("incorrect scale", resScale, result.scale()); - } - - /** - * new BigDecimal(long value) - */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {long.class} - ) - }) - public void testConstrLong() { - long a = 4576578677732546982L; - String res = "4576578677732546982"; - int resScale = 0; - BigDecimal result = new BigDecimal(a); - assertEquals("incorrect value", res, result.unscaledValue().toString()); - assertEquals("incorrect scale", resScale, result.scale()); - } - - /** - * new BigDecimal(long, MathContext) - */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {long.class, java.math.MathContext.class} - ) - }) - public void testConstrLongMathContext() { - long a = 4576578677732546982L; - int precision = 5; - RoundingMode rm = RoundingMode.CEILING; - MathContext mc = new MathContext(precision, rm); - String res = "45766"; - int resScale = -14; - BigDecimal result = new BigDecimal(a, mc); - assertEquals("incorrect value", res, result.unscaledValue().toString()); - assertEquals("incorrect scale", resScale, result.scale()); - } - - /** - * new BigDecimal(double value) when value is denormalized - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(double) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {double.class} - ) - }) - public void testConstrDoubleDenormalized() { - double a = 2.274341322658976E-309; - int aScale = 1073; - BigInteger bA = new BigInteger("227434132265897633950269241702666687639731047124115603942986140264569528085692462493371029187342478828091760934014851133733918639492582043963243759464684978401240614084312038547315281016804838374623558434472007664427140169018817050565150914041833284370702366055678057809362286455237716100382057360123091641959140448783514464639706721250400288267372238950016114583259228262046633530468551311769574111763316146065958042194569102063373243372766692713192728878701004405568459288708477607744497502929764155046100964958011009313090462293046650352146796805866786767887226278836423536035611825593567576424943331337401071583562754098901412372708947790843318760718495117047155597276492717187936854356663665005157041552436478744491526494952982062613955349661409854888916015625"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value) - * when value is not a valid representation of BigDecimal. - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringException() { - String a = "-238768.787678287a+10"; - try { -// BEGIN android-modified - BigDecimal bd = new BigDecimal(a); - fail("NumberFormatException has not been caught: " + bd.toString()); -// END android-modified - } catch (NumberFormatException e) {} - } - - /** - * new BigDecimal(String value) when exponent is empty. - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringExceptionEmptyExponent1() { - String a = "-238768.787678287e"; - try { - new BigDecimal(a); - fail("NumberFormatException has not been caught"); - } catch (NumberFormatException e) { - } - } - - /** - * new BigDecimal(String value) when exponent is empty. - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringExceptionEmptyExponent2() { - String a = "-238768.787678287e-"; - try { - new BigDecimal(a); - fail("NumberFormatException has not been caught"); - } catch (NumberFormatException e) { - } - } - - /** - * new BigDecimal(String value) when exponent is greater than - * Integer.MAX_VALUE. - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringExceptionExponentGreaterIntegerMax() { - String a = "-238768.787678287e214748364767876"; - try { - new BigDecimal(a); - fail("NumberFormatException has not been caught"); - } catch (NumberFormatException e) { - } - } - - /** - * new BigDecimal(String value) when exponent is less than - * Integer.MIN_VALUE. - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringExceptionExponentLessIntegerMin() { - String a = "-238768.787678287e-214748364767876"; - try { - new BigDecimal(a); - fail("NumberFormatException has not been caught"); - } catch (NumberFormatException e) { - } - } - - /** - * new BigDecimal(String value) - * when exponent is Integer.MAX_VALUE. - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringExponentIntegerMax() { - String a = "-238768.787678287e2147483647"; - int aScale = -2147483638; - BigInteger bA = new BigInteger("-238768787678287"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value) - * when exponent is Integer.MIN_VALUE. - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringExponentIntegerMin() { - String a = ".238768e-2147483648"; - try { - new BigDecimal(a); - fail("NumberFormatException expected"); - } catch (NumberFormatException e) { - assertEquals("Improper exception message","Scale out of range.", - e.getMessage()); - } - } - - /** - * new BigDecimal(String value); value does not contain exponent - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringWithoutExpPos1() { - String a = "732546982374982347892379283571094797.287346782359284756"; - int aScale = 18; - BigInteger bA = new BigInteger("732546982374982347892379283571094797287346782359284756"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value); value does not contain exponent - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringWithoutExpPos2() { - String a = "+732546982374982347892379283571094797.287346782359284756"; - int aScale = 18; - BigInteger bA = new BigInteger("732546982374982347892379283571094797287346782359284756"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value); value does not contain exponent - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringWithoutExpNeg() { - String a = "-732546982374982347892379283571094797.287346782359284756"; - int aScale = 18; - BigInteger bA = new BigInteger("-732546982374982347892379283571094797287346782359284756"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value); value does not contain exponent - * and decimal point - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringWithoutExpWithoutPoint() { - String a = "-732546982374982347892379283571094797287346782359284756"; - int aScale = 0; - BigInteger bA = new BigInteger("-732546982374982347892379283571094797287346782359284756"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value); value contains exponent - * and does not contain decimal point - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringWithExponentWithoutPoint1() { - String a = "-238768787678287e214"; - int aScale = -214; - BigInteger bA = new BigInteger("-238768787678287"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value); value contains exponent - * and does not contain decimal point - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringWithExponentWithoutPoint2() { - String a = "-238768787678287e-214"; - int aScale = 214; - BigInteger bA = new BigInteger("-238768787678287"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value); value contains exponent - * and does not contain decimal point - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringWithExponentWithoutPoint3() { - String a = "238768787678287e-214"; - int aScale = 214; - BigInteger bA = new BigInteger("238768787678287"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value); value contains exponent - * and does not contain decimal point - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringWithExponentWithoutPoint4() { - String a = "238768787678287e+214"; - int aScale = -214; - BigInteger bA = new BigInteger("238768787678287"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value); value contains exponent - * and does not contain decimal point - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringWithExponentWithoutPoint5() { - String a = "238768787678287E214"; - int aScale = -214; - BigInteger bA = new BigInteger("238768787678287"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value); - * value contains both exponent and decimal point - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringWithExponentWithPoint1() { - String a = "23985439837984782435652424523876878.7678287e+214"; - int aScale = -207; - BigInteger bA = new BigInteger("239854398379847824356524245238768787678287"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value); - * value contains both exponent and decimal point - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringWithExponentWithPoint2() { - String a = "238096483923847545735673567457356356789029578490276878.7678287e-214"; - int aScale = 221; - BigInteger bA = new BigInteger("2380964839238475457356735674573563567890295784902768787678287"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value); - * value contains both exponent and decimal point - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringWithExponentWithPoint3() { - String a = "2380964839238475457356735674573563567890.295784902768787678287E+21"; - int aScale = 0; - BigInteger bA = new BigInteger("2380964839238475457356735674573563567890295784902768787678287"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value); - * value contains both exponent and decimal point - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringWithExponentWithPoint4() { - String a = "23809648392384754573567356745735635678.90295784902768787678287E+21"; - int aScale = 2; - BigInteger bA = new BigInteger("2380964839238475457356735674573563567890295784902768787678287"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value); - * value contains both exponent and decimal point - */ -@TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "This is a complete subset of tests for BigDecimal(String) constructor.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void testConstrStringWithExponentWithPoint5() { - String a = "238096483923847545735673567457356356789029.5784902768787678287E+21"; - int aScale = -2; - BigInteger bA = new BigInteger("2380964839238475457356735674573563567890295784902768787678287"); - BigDecimal aNumber = new BigDecimal(a); - assertEquals("incorrect value", bA, aNumber.unscaledValue()); - assertEquals("incorrect scale", aScale, aNumber.scale()); - } - - /** - * new BigDecimal(String value, MathContext) - */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Exceptions checking missed.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class, java.math.MathContext.class} - ) - }) - public void testConstrStringMathContext() { - String a = "-238768787678287e214"; - int precision = 5; - RoundingMode rm = RoundingMode.CEILING; - MathContext mc = new MathContext(precision, rm); - String res = "-23876"; - int resScale = -224; - BigDecimal result = new BigDecimal(a, mc); - assertEquals("incorrect value", res, result.unscaledValue().toString()); - assertEquals("incorrect scale", resScale, result.scale()); - } - -// ANDROID ADDED - - /** - * @tests java.math.BigDecimal#BigDecimal(java.math.BigInteger, int) - */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.math.BigInteger.class, int.class} - ) - }) - public void test_Constructor_java_math_BigInteger_int() { - BigInteger value = new BigInteger("12345908"); - BigDecimal big = new BigDecimal(value); - assertTrue("the BigDecimal value is not initialized properly", - big.unscaledValue().equals(value) - && big.scale() == 0); - - BigInteger value2 = new BigInteger("12334560000"); - BigDecimal big2 = new BigDecimal(value2, 5); - assertTrue("the BigDecimal value is not initialized properly", - big2.unscaledValue().equals(value2) - && big2.scale() == 5); - assertTrue("the BigDecimal value is not represented properly", big2.toString().equals( - "123345.60000")); - } - - /** - * @tests java.math.BigDecimal#BigDecimal(double) - */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "NumberFormatException checking missed.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {double.class} - ) - }) - public void test_Constructor_Double() { - BigDecimal big = new BigDecimal(123E04); - assertTrue("the BigDecimal value taking a double argument is not initialized properly", big - .toString().equals("1230000")); - big = new BigDecimal(1.2345E-12); - assertTrue("the double representation is not correct for 1.2345E-12", - big.doubleValue() == 1.2345E-12); - big = new BigDecimal(-12345E-3); - assertTrue("the double representation is not correct for -12345E-3", - big.doubleValue() == -12.345); - big = new BigDecimal(5.1234567897654321e138); - assertTrue("the double representation is not correct for 5.1234567897654321e138", big - .doubleValue() == 5.1234567897654321E138 - && big.scale() == 0); - big = new BigDecimal(0.1); - assertTrue("the double representation of 0.1 bigDecimal is not correct", - big.doubleValue() == 0.1); - big = new BigDecimal(0.00345); - assertTrue("the double representation of 0.00345 bigDecimal is not correct", big - .doubleValue() == 0.00345); - // regression test for HARMONY-2429 - big = new BigDecimal(-0.0); - assertTrue("the double representation of -0.0 bigDecimal is not correct", big.scale() == 0); - } - - /** - * @tests java.math.BigDecimal#BigDecimal(java.lang.String) - */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) - public void test_Constructor_java_lang_String() throws NumberFormatException { - BigDecimal big = new BigDecimal("345.23499600293850"); - assertTrue("the BigDecimal value is not initialized properly", big.toString().equals( - "345.23499600293850") - && big.scale() == 14); - big = new BigDecimal("-12345"); - assertTrue("the BigDecimal value is not initialized properly", big.toString().equals( - "-12345") - && big.scale() == 0); - big = new BigDecimal("123."); - assertTrue("the BigDecimal value is not initialized properly", big.toString().equals("123") - && big.scale() == 0); - - } - -} diff --git a/math/src/test/java/tests/api/java/math/AllTests.java b/math/src/test/java/tests/api/java/math/AllTests.java index 2888ba0..483e08a 100644 --- a/math/src/test/java/tests/api/java/math/AllTests.java +++ b/math/src/test/java/tests/api/java/math/AllTests.java @@ -29,10 +29,12 @@ public class AllTests { } public static Test suite() { - TestSuite suite = new TestSuite("Tests for java.math"); + TestSuite suite = tests.TestSuiteFactory.createTestSuite("Tests for java.math"); // $JUnit-BEGIN$ suite.addTestSuite(BigDecimalTest.class); suite.addTestSuite(BigIntegerTest.class); + suite.addTestSuite(RoundingModeTest.class); + suite.addTestSuite(MathContextTest.class); // $JUnit-END$ return suite; } diff --git a/math/src/test/java/tests/api/java/math/BigDecimalTest.java b/math/src/test/java/tests/api/java/math/BigDecimalTest.java index 76bdcba..32c9e84 100644 --- a/math/src/test/java/tests/api/java/math/BigDecimalTest.java +++ b/math/src/test/java/tests/api/java/math/BigDecimalTest.java @@ -17,10 +17,10 @@ package tests.api.java.math; -import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; +import dalvik.annotation.TestTargetClass; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -28,7 +28,6 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.math.BigDecimal; import java.math.BigInteger; -import java.math.MathContext; import java.math.RoundingMode; @TestTargetClass(BigDecimal.class) @@ -40,15 +39,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#BigDecimal(java.math.BigInteger) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {java.math.BigInteger.class} + ) public void test_ConstructorLjava_math_BigInteger() { BigDecimal big = new BigDecimal(value); assertTrue("the BigDecimal value is not initialized properly", big @@ -59,15 +55,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#BigDecimal(java.math.BigInteger, int) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.math.BigInteger.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {java.math.BigInteger.class, int.class} + ) public void test_ConstructorLjava_math_BigIntegerI() { BigDecimal big = new BigDecimal(value2, 5); assertTrue("the BigDecimal value is not initialized properly", big @@ -80,20 +73,35 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#BigDecimal(double) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Unpredictable cases with limitation of double representation are not checked.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {double.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = ".", + method = "BigDecimal", + args = {double.class} + ) public void test_ConstructorD() { + // + // These numbers have an exact representation as doubles: + // BigDecimal big = new BigDecimal(123E04); assertTrue( "the BigDecimal value taking a double argument is not initialized properly", big.toString().equals("1230000")); + big = new BigDecimal(123.375); + assertTrue("init(D) failed for 123.375; became " + big, + big.toString().equals("123.375") ); + big = new BigDecimal(Math.pow(2, -33)); + assertTrue("init(D) failed for 2^(-33) = 1.16415321826934814453125E-10; became " + big, + big.toString().equals("1.16415321826934814453125E-10") ); + big = new BigDecimal(123456 * Math.pow(2, -33)); + assertTrue("init(D) failed for 123456 * 2^(-33) = 0.000014372169971466064453125; became " + big, + big.toString().equals("0.000014372169971466064453125") ); + big = new BigDecimal(-123456 * Math.pow(2, -33)); + assertTrue("init(D) failed for 123456 * 2^(-33) = -0.000014372169971466064453125; became " + big, + big.toString().equals("-0.000014372169971466064453125") ); + + // Following numbers can't: + // big = new BigDecimal(1.2345E-12); assertTrue("the double representation is not correct", big .doubleValue() == 1.2345E-12); @@ -122,15 +130,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#BigDecimal(java.lang.String) */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigDecimal", + args = {java.lang.String.class} + ) public void test_ConstructorLjava_lang_String() throws NumberFormatException { BigDecimal big = new BigDecimal("345.23499600293850"); assertTrue("the BigDecimal value is not initialized properly", big @@ -151,36 +156,35 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#BigDecimal(java.lang.String) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {double.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "", + method = "BigDecimal", + args = {double.class} + ) public void test_constructor_String_plus_exp() { /* * BigDecimal does not support a + sign in the exponent when converting - * from a String + * from a String. + * + * mc 081106: who says so?!? */ - new BigDecimal(+23e-0); - new BigDecimal(-23e+0); + BigDecimal bd; + bd = new BigDecimal("+23e-0"); + assertEquals("incorrect value", "23", bd.toString()); + bd = new BigDecimal("-23e+0"); + assertEquals("incorrect value", "-23", bd.toString()); } /** * @tests java.math.BigDecimal#BigDecimal(java.lang.String) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Exception checked.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Exception checked.", + method = "BigDecimal", + args = {java.lang.String.class} + ) public void test_constructor_String_empty() { try { new BigDecimal(""); @@ -192,15 +196,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#BigDecimal(java.lang.String) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Exception checked.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Exception checked.", + method = "BigDecimal", + args = {java.lang.String.class} + ) public void test_constructor_String_plus_minus_exp() { try { new BigDecimal("+35e+-2"); @@ -218,15 +219,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#BigDecimal(char[]) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Exception checked.", - targets = { - @TestTarget( - methodName = "BigDecimal", - methodArgs = {char[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Exception checked.", + method = "BigDecimal", + args = {char[].class} + ) public void test_constructor_CC_plus_minus_exp() { try { new BigDecimal("+35e+-2".toCharArray()); @@ -244,15 +242,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#abs() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "abs", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "abs", + args = {} + ) public void test_abs() { BigDecimal big = new BigDecimal("-1234"); BigDecimal bigabs = big.abs(); @@ -267,15 +262,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#add(java.math.BigDecimal) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "add", + args = {java.math.BigDecimal.class} + ) public void test_addLjava_math_BigDecimal() { BigDecimal add1 = new BigDecimal("23.456"); BigDecimal add2 = new BigDecimal("3849.235"); @@ -293,15 +285,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#compareTo(java.math.BigDecimal) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "compareTo", + args = {java.math.BigDecimal.class} + ) public void test_compareToLjava_math_BigDecimal() { BigDecimal comp1 = new BigDecimal("1.00"); BigDecimal comp2 = new BigDecimal(1.000000D); @@ -318,15 +307,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#divide(java.math.BigDecimal, int) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "IllegalArgumentException checking missed. Used only ROUND_UP & ROUND_DOWN round modes.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "IllegalArgumentException checking missed. Used only ROUND_UP & ROUND_DOWN round modes.", + method = "divide", + args = {java.math.BigDecimal.class, int.class} + ) public void test_divideLjava_math_BigDecimalI() { BigDecimal divd1 = new BigDecimal(value, 2); BigDecimal divd2 = new BigDecimal("2.335"); @@ -354,15 +340,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#divide(java.math.BigDecimal, int, int) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "IllegalArgumentException checking missed. Used only ROUND_UP & ROUND_DOWN round modes.", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigDecimal.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "IllegalArgumentException checking missed. Used only ROUND_UP & ROUND_DOWN round modes.", + method = "divide", + args = {java.math.BigDecimal.class, int.class, int.class} + ) public void test_divideLjava_math_BigDecimalII() { BigDecimal divd1 = new BigDecimal(value2, 4); BigDecimal divd2 = new BigDecimal("0.0023"); @@ -387,15 +370,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#doubleValue() */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Narrowing limitations of double representation are not checked.", - targets = { - @TestTarget( - methodName = "doubleValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Narrowing limitations of double representation are not checked.", + method = "doubleValue", + args = {} + ) public void test_doubleValue() { BigDecimal bigDB = new BigDecimal(-1.234E-112); // Commenting out this part because it causes an endless loop (see HARMONY-319 and HARMONY-329) @@ -427,15 +407,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#equals(java.lang.Object) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "equals", + args = {java.lang.Object.class} + ) public void test_equalsLjava_lang_Object() { BigDecimal equal1 = new BigDecimal(1.00D); BigDecimal equal2 = new BigDecimal("1.0"); @@ -463,15 +440,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#floatValue() */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Narrowing limitations of float representation are not checked.", - targets = { - @TestTarget( - methodName = "floatValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Narrowing limitations of float representation are not checked.", + method = "floatValue", + args = {} + ) public void test_floatValue() { BigDecimal fl1 = new BigDecimal("234563782344567"); assertTrue("the float representation of bigDecimal 234563782344567", @@ -499,15 +473,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#hashCode() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "hashCode", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "hashCode", + args = {} + ) public void test_hashCode() { // anything that is equal must have the same hashCode BigDecimal hash = new BigDecimal("1.00"); @@ -536,15 +507,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#intValue() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "intValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "intValue", + args = {} + ) public void test_intValue() { BigDecimal int1 = new BigDecimal(value, 3); assertTrue("the int value of 12345.908 is not 12345", @@ -563,15 +531,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#longValue() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "longValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "longValue", + args = {} + ) public void test_longValue() { BigDecimal long1 = new BigDecimal(value2.negate(), 0); assertTrue("the long value of 12334560000 is not 12334560000", long1 @@ -590,15 +555,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#max(java.math.BigDecimal) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "max", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "max", + args = {java.math.BigDecimal.class} + ) public void test_maxLjava_math_BigDecimal() { BigDecimal max1 = new BigDecimal(value2, 1); BigDecimal max2 = new BigDecimal(value2, 4); @@ -616,15 +578,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#min(java.math.BigDecimal) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "min", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "min", + args = {java.math.BigDecimal.class} + ) public void test_minLjava_math_BigDecimal() { BigDecimal min1 = new BigDecimal(-12345.4D); BigDecimal min2 = new BigDecimal(-12345.39D); @@ -639,15 +598,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#movePointLeft(int) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "movePointLeft", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "movePointLeft", + args = {int.class} + ) public void test_movePointLeftI() { BigDecimal movePtLeft = new BigDecimal("123456265.34"); BigDecimal alreadyMoved = movePtLeft.movePointLeft(5); @@ -677,15 +633,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#movePointRight(int) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed.", - targets = { - @TestTarget( - methodName = "movePointRight", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed.", + method = "movePointRight", + args = {int.class} + ) public void test_movePointRightI() { BigDecimal movePtRight = new BigDecimal("-1.58796521458"); BigDecimal alreadyMoved = movePtRight.movePointRight(8); @@ -712,15 +665,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#multiply(java.math.BigDecimal) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "multiply", + args = {java.math.BigDecimal.class} + ) public void test_multiplyLjava_math_BigDecimal() { BigDecimal multi1 = new BigDecimal(value, 5); BigDecimal multi2 = new BigDecimal(2.345D); @@ -756,15 +706,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#negate() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "negate", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "negate", + args = {} + ) public void test_negate() { BigDecimal negate1 = new BigDecimal(value2, 7); assertTrue("the negate of 1233.4560000 is not -1233.4560000", negate1 @@ -780,15 +727,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#scale() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "scale", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "scale", + args = {} + ) public void test_scale() { BigDecimal scale1 = new BigDecimal(value2, 8); assertTrue("the scale of the number 123.34560000 is wrong", scale1 @@ -812,15 +756,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#setScale(int) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "setScale", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setScale", + args = {int.class} + ) public void test_setScaleI() { // rounding mode defaults to zero BigDecimal setScale1 = new BigDecimal(value, 3); @@ -840,15 +781,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#setScale(int, int) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "setScale", - methodArgs = {int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setScale", + args = {int.class, int.class} + ) public void test_setScaleII() { BigDecimal setScale1 = new BigDecimal(2.323E102); BigDecimal setScale2 = setScale1.setScale(4); @@ -856,9 +794,10 @@ public class BigDecimalTest extends junit.framework.TestCase { setScale2.scale() == 4); assertTrue("the representation of the number 2.323E102 is wrong", setScale2.doubleValue() == 2.323E102); + setScale1 = new BigDecimal("-1.253E-12"); setScale2 = setScale1.setScale(17, BigDecimal.ROUND_CEILING); - assertTrue("the number -1.253E-12 after setting scale is wrong", + assertTrue("the scale of the number -1.253E-12 after setting scale is wrong", setScale2.scale() == 17); assertTrue( "the representation of the number -1.253E-12 after setting scale is wrong, " + setScale2.toString(), @@ -981,17 +920,155 @@ public class BigDecimalTest extends junit.framework.TestCase { } /** + * @tests java.math.BigDecimal#setScale(int, java.math.RoundingMode) + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setScale", + args = {int.class, java.math.RoundingMode.class} + ) + public void test_setScaleILjava_math_RoundingMode() { + BigDecimal setScale1 = new BigDecimal(2.323E102); + BigDecimal setScale2 = setScale1.setScale(4); + assertTrue("the number 2.323E102 after setting scale is wrong", + setScale2.scale() == 4); + assertTrue("the representation of the number 2.323E102 is wrong", + setScale2.doubleValue() == 2.323E102); + + setScale1 = new BigDecimal("-1.253E-12"); + setScale2 = setScale1.setScale(17, RoundingMode.CEILING); + assertTrue("the scale of the number -1.253E-12 after setting scale is wrong", + setScale2.scale() == 17); + assertTrue( + "the representation of the number -1.253E-12 after setting scale is wrong, " + setScale2.toString(), + setScale2.toString().equals("-1.25300E-12")); + + // testing rounding Mode RoundingMode.CEILING + setScale1 = new BigDecimal(value, 4); + setScale2 = setScale1.setScale(1, RoundingMode.CEILING); + assertTrue( + "the number 1234.5908 after setting scale to 1/RoundingMode.CEILING is wrong", + setScale2.toString().equals("1234.6") && setScale2.scale() == 1); + BigDecimal setNeg = new BigDecimal(value.negate(), 4); + setScale2 = setNeg.setScale(1, RoundingMode.CEILING); + assertTrue( + "the number -1234.5908 after setting scale to 1/RoundingMode.CEILING is wrong", + setScale2.toString().equals("-1234.5") + && setScale2.scale() == 1); + + // testing rounding Mode RoundingMode.DOWN + setScale2 = setNeg.setScale(1, RoundingMode.DOWN); + assertTrue( + "the number -1234.5908 after setting scale to 1/RoundingMode.DOWN is wrong", + setScale2.toString().equals("-1234.5") + && setScale2.scale() == 1); + setScale1 = new BigDecimal(value, 4); + setScale2 = setScale1.setScale(1, RoundingMode.DOWN); + assertTrue( + "the number 1234.5908 after setting scale to 1/RoundingMode.DOWN is wrong", + setScale2.toString().equals("1234.5") && setScale2.scale() == 1); + + // testing rounding Mode RoundingMode.FLOOR + setScale2 = setScale1.setScale(1, RoundingMode.FLOOR); + assertTrue( + "the number 1234.5908 after setting scale to 1/RoundingMode.FLOOR is wrong", + setScale2.toString().equals("1234.5") && setScale2.scale() == 1); + setScale2 = setNeg.setScale(1, RoundingMode.FLOOR); + assertTrue( + "the number -1234.5908 after setting scale to 1/RoundingMode.FLOOR is wrong", + setScale2.toString().equals("-1234.6") + && setScale2.scale() == 1); + + // testing rounding Mode RoundingMode.HALF_DOWN + setScale2 = setScale1.setScale(3, RoundingMode.HALF_DOWN); + assertTrue( + "the number 1234.5908 after setting scale to 3/RoundingMode.HALF_DOWN is wrong", + setScale2.toString().equals("1234.591") + && setScale2.scale() == 3); + setScale1 = new BigDecimal(new BigInteger("12345000"), 5); + setScale2 = setScale1.setScale(1, RoundingMode.HALF_DOWN); + assertTrue( + "the number 123.45908 after setting scale to 1/RoundingMode.HALF_DOWN is wrong", + setScale2.toString().equals("123.4") && setScale2.scale() == 1); + setScale2 = new BigDecimal("-1234.5000").setScale(0, + RoundingMode.HALF_DOWN); + assertTrue( + "the number -1234.5908 after setting scale to 0/RoundingMode.HALF_DOWN is wrong", + setScale2.toString().equals("-1234") && setScale2.scale() == 0); + + // testing rounding Mode RoundingMode.HALF_EVEN + setScale1 = new BigDecimal(1.2345789D); + setScale2 = setScale1.setScale(4, RoundingMode.HALF_EVEN); + assertTrue( + "the number 1.2345789 after setting scale to 4/RoundingMode.HALF_EVEN is wrong", + setScale2.doubleValue() == 1.2346D && setScale2.scale() == 4); + setNeg = new BigDecimal(-1.2335789D); + setScale2 = setNeg.setScale(2, RoundingMode.HALF_EVEN); + assertTrue( + "the number -1.2335789 after setting scale to 2/RoundingMode.HALF_EVEN is wrong", + setScale2.doubleValue() == -1.23D && setScale2.scale() == 2); + setScale2 = new BigDecimal("1.2345000").setScale(3, + RoundingMode.HALF_EVEN); + assertTrue( + "the number 1.2345789 after setting scale to 3/RoundingMode.HALF_EVEN is wrong", + setScale2.doubleValue() == 1.234D && setScale2.scale() == 3); + setScale2 = new BigDecimal("-1.2345000").setScale(3, + RoundingMode.HALF_EVEN); + assertTrue( + "the number -1.2335789 after setting scale to 3/RoundingMode.HALF_EVEN is wrong", + setScale2.doubleValue() == -1.234D && setScale2.scale() == 3); + + // testing rounding Mode RoundingMode.HALF_UP + setScale1 = new BigDecimal("134567.34650"); + setScale2 = setScale1.setScale(3, RoundingMode.HALF_UP); + assertTrue( + "the number 134567.34658 after setting scale to 3/RoundingMode.HALF_UP is wrong", + setScale2.toString().equals("134567.347") + && setScale2.scale() == 3); + setNeg = new BigDecimal("-1234.4567"); + setScale2 = setNeg.setScale(0, RoundingMode.HALF_UP); + assertTrue( + "the number -1234.4567 after setting scale to 0/RoundingMode.HALF_UP is wrong", + setScale2.toString().equals("-1234") && setScale2.scale() == 0); + + // testing rounding Mode RoundingMode.UNNECESSARY + try { + setScale1.setScale(3, RoundingMode.UNNECESSARY); + fail("arithmetic Exception not caught for round unnecessary"); + } catch (ArithmeticException e) { + } + + // testing rounding Mode RoundingMode.UP + setScale1 = new BigDecimal("100000.374"); + setScale2 = setScale1.setScale(2, RoundingMode.UP); + assertTrue( + "the number 100000.374 after setting scale to 2/RoundingMode.UP is wrong", + setScale2.toString().equals("100000.38") + && setScale2.scale() == 2); + setNeg = new BigDecimal(-134.34589D); + setScale2 = setNeg.setScale(2, RoundingMode.UP); + assertTrue( + "the number -134.34589 after setting scale to 2/RoundingMode.UP is wrong", + setScale2.doubleValue() == -134.35D && setScale2.scale() == 2); + + // testing invalid rounding modes + try { + setScale2 = setScale1.setScale(0, -123); + fail("IllegalArgumentException is not caught for wrong rounding mode"); + } catch (IllegalArgumentException e) { + } + } + + /** * @tests java.math.BigDecimal#signum() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "signum", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "signum", + args = {} + ) public void test_signum() { BigDecimal sign = new BigDecimal(123E-104); assertTrue("123E-104 is not positive in signum()", sign.signum() == 1); @@ -1005,15 +1082,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#subtract(java.math.BigDecimal) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "subtract", - methodArgs = {java.math.BigDecimal.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "subtract", + args = {java.math.BigDecimal.class} + ) public void test_subtractLjava_math_BigDecimal() { BigDecimal sub1 = new BigDecimal("13948"); BigDecimal sub2 = new BigDecimal("2839.489"); @@ -1046,15 +1120,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#toBigInteger() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "toBigInteger", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "toBigInteger", + args = {} + ) public void test_toBigInteger() { BigDecimal sub1 = new BigDecimal("-29830.989"); BigInteger result = sub1.toBigInteger(); @@ -1078,15 +1149,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#toString() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "toString", + args = {} + ) public void test_toString() { BigDecimal toString1 = new BigDecimal("1234.000"); assertTrue("the toString representation of 1234.000 is wrong", @@ -1105,15 +1173,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#unscaledValue() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "unscaledValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "unscaledValue", + args = {} + ) public void test_unscaledValue() { BigDecimal unsVal = new BigDecimal("-2839485.000"); assertTrue("the unscaledValue of -2839485.000 is wrong", unsVal @@ -1134,15 +1199,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#valueOf(long) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "valueOf", - methodArgs = {long.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "valueOf", + args = {long.class} + ) public void test_valueOfJ() { BigDecimal valueOfL = BigDecimal.valueOf(9223372036854775806L); assertTrue("the bigDecimal equivalent of 9223372036854775806 is wrong", @@ -1161,15 +1223,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#valueOf(long, int) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "valueOf", - methodArgs = {long.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "valueOf", + args = {long.class, int.class} + ) public void test_valueOfJI() { BigDecimal valueOfJI = BigDecimal.valueOf(9223372036854775806L, 5); assertTrue( @@ -1199,15 +1258,12 @@ public class BigDecimalTest extends junit.framework.TestCase { } -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "Checks serialization", - targets = { - @TestTarget( - methodName = "!SerializationSelf", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "Checks serialization", + method = "!SerializationSelf", + args = {} + ) public void test_BigDecimal_serialization() throws Exception { // Regression for HARMONY-1896 char[] in = { '1', '5', '6', '7', '8', '7', '.', '0', '0' }; @@ -1229,15 +1285,12 @@ public class BigDecimalTest extends junit.framework.TestCase { /** * @tests java.math.BigDecimal#stripTrailingZero(long) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "stripTrailingZeros", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "SUN JDK fails the Zero Test: has scale 4 for BigDecimal('0.0000')", + method = "stripTrailingZeros", + args = {} + ) public void test_stripTrailingZero() { BigDecimal sixhundredtest = new BigDecimal("600.0"); assertTrue("stripTrailingZero failed for 600.0", @@ -1253,39 +1306,8 @@ public class BigDecimalTest extends junit.framework.TestCase { /* Zero */ //regression for HARMONY-4623, NON-BUG DIFF with RI BigDecimal zerotest = new BigDecimal("0.0000"); - assertTrue("stripTrailingZero failed for 0.0000", - ((zerotest.stripTrailingZeros()).scale() == 0) - ); + assertEquals("stripTrailingZero failed for 0.0000", + 0, (zerotest.stripTrailingZeros()).scale() ); } - public void testMathContextConstruction() { - String a = "-12380945E+61"; - BigDecimal aNumber = new BigDecimal(a); - int precision = 6; - RoundingMode rm = RoundingMode.HALF_DOWN; - MathContext mcIntRm = new MathContext(precision, rm); - MathContext mcStr = new MathContext("precision=6 roundingMode=HALF_DOWN"); - MathContext mcInt = new MathContext(precision); - BigDecimal res = aNumber.abs(mcInt); - assertEquals("MathContext Constructer with int precision failed", - res, - new BigDecimal("1.23809E+68")); - - assertEquals("Equal MathContexts are not Equal ", - mcIntRm, - mcStr); - - assertEquals("Different MathContext are reported as Equal ", - mcInt.equals(mcStr), - false); - - assertEquals("Equal MathContexts have different hashcodes ", - mcIntRm.hashCode(), - mcStr.hashCode()); - - assertEquals("MathContext.toString() returning incorrect value", - mcIntRm.toString(), - "precision=6 roundingMode=HALF_DOWN"); - } - } diff --git a/math/src/test/java/tests/api/java/math/BigIntegerTest.java b/math/src/test/java/tests/api/java/math/BigIntegerTest.java index 16e2e50..c640638 100644 --- a/math/src/test/java/tests/api/java/math/BigIntegerTest.java +++ b/math/src/test/java/tests/api/java/math/BigIntegerTest.java @@ -17,10 +17,11 @@ package tests.api.java.math; -import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.KnownFailure; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; +import dalvik.annotation.TestTargets; import java.math.BigInteger; import java.util.Random; @@ -86,15 +87,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#BigInteger(int, java.util.Random) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Regression test. IllegalArgumentException checking missed", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, java.util.Random.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigInteger", + args = {int.class, java.util.Random.class} + ) public void test_ConstructorILjava_util_Random() { // regression test for HARMONY-1047 try { @@ -113,49 +111,69 @@ public class BigIntegerTest extends junit.framework.TestCase { "Two random numbers in a row are the same (might not be a bug but it very likely is)", !bi.equals(bi2)); assertTrue("Not zero", new BigInteger(0, rand).equals(BigInteger.ZERO)); + + try { + new BigInteger(-1, (Random)null); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + // PASSED + } } -// mc: Commented out as BIGNUM returns no Primes smaller than 16 bits. -// BEGIN android-removed -// -// /** -// * @tests java.math.BigInteger#BigInteger(int, int, java.util.Random) -// */ -// public void test_ConstructorIILjava_util_Random() { -// bi = new BigInteger(10, 5, rand); -// bi2 = new BigInteger(10, 5, rand); -// assertTrue("Random number one is negative", bi.compareTo(zero) >= 0); -// assertTrue("Random number one is too big", -// bi.compareTo(twoToTheTen) < 0); -// assertTrue("Random number two is negative", bi2.compareTo(zero) >= 0); -// assertTrue("Random number two is too big", -// bi2.compareTo(twoToTheTen) < 0); -// -// Random rand = new Random(); -// BigInteger bi; -// int certainty[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -// Integer.MIN_VALUE, Integer.MIN_VALUE + 1, -2, -1 }; -// for (int i = 2; i <= 20; i++) { -// for (int c = 0; c < certainty.length; c++) { -// bi = new BigInteger(i, c, rand); // Create BigInteger -// assertTrue("Bit length incorrect", bi.bitLength() == i); -// } -// } -// } -// END android-removed + /** + * @tests java.math.BigInteger#BigInteger(int, int, java.util.Random) + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "BigInteger", + args = {int.class, int.class, java.util.Random.class} + ) + @KnownFailure("BIGNUM returns no Primes smaller than 16 bits.") + public void test_ConstructorIILjava_util_Random() { + bi = new BigInteger(10, 5, rand); + bi2 = new BigInteger(10, 5, rand); + assertTrue("Random number one is negative", bi.compareTo(zero) >= 0); + assertTrue("Random number one is too big", + bi.compareTo(twoToTheTen) < 0); + assertTrue("Random number two is negative", bi2.compareTo(zero) >= 0); + assertTrue("Random number two is too big", + bi2.compareTo(twoToTheTen) < 0); + + Random rand = new Random(); + BigInteger bi; + int certainty[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + Integer.MIN_VALUE, Integer.MIN_VALUE + 1, -2, -1 }; + for (int i = 2; i <= 20; i++) { + for (int c = 0; c < certainty.length; c++) { + bi = new BigInteger(i, c, rand); // Create BigInteger + assertTrue("Bit length incorrect", bi.bitLength() == i); + } + } + + try { + new BigInteger(1, 80, (Random)null); + fail("ArithmeticException expected"); + } catch (ArithmeticException e) { + // PASSED + } + + try { + new BigInteger(-1, (Random)null); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + // PASSED + } + } /** * @tests java.math.BigInteger#BigInteger(byte[]) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "NumberFormatException checking missed", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "NumberFormatException checking missed", + method = "BigInteger", + args = {byte[].class} + ) public void test_Constructor$B() { byte[] myByteArray; myByteArray = new byte[] { (byte) 0x00, (byte) 0xFF, (byte) 0xFE }; @@ -170,15 +188,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#BigInteger(int, byte[]) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {int.class, byte[].class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "BigInteger", + args = {int.class, byte[].class} + ) public void test_ConstructorI$B() { byte[] myByteArray; myByteArray = new byte[] { (byte) 0xFF, (byte) 0xFE }; @@ -203,15 +218,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#BigInteger(java.lang.String) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Checks NumberFormatException", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Checks NumberFormatException", + method = "BigInteger", + args = {java.lang.String.class} + ) public void test_constructor_String_empty() { try { new BigInteger(""); @@ -223,15 +235,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#toByteArray() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "toByteArray", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "toByteArray", + args = {} + ) public void test_toByteArray() { byte[] myByteArray, anotherByteArray; myByteArray = new byte[] { 97, 33, 120, 124, 50, 2, 0, 0, 0, 12, 124, @@ -245,16 +254,38 @@ public class BigIntegerTest extends junit.framework.TestCase { } } +// public void test_SpecialPrimes() { +// System.out.println("test_SpecialPrimes"); +// final BigInteger TWO = BigInteger.valueOf(2); +// BigInteger p, q; +// for (;;) { +// p = new BigInteger(1024, 23, new Random()); +// q = p.subtract(BigInteger.ONE).divide(TWO); +// if (q.isProbablePrime(20)) { +// System.out.println(q); +// System.out.println(p); +// break; +// } +// System.out.print("."); +// } +// fail("isProbablePrime failed for: " + bi); +// } + /** * @tests java.math.BigInteger#isProbablePrime(int) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "isProbablePrime", - methodArgs = {int.class} + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isProbablePrime", + args = {int.class} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "probablePrime", + args = {int.class, java.util.Random.class} ) }) public void test_isProbablePrimeI() { @@ -297,8 +328,95 @@ public class BigIntegerTest extends junit.framework.TestCase { } assertTrue("Too many false positives - may indicate a problem", fails <= 1); + + // + // And now some tests on real big integers: + // + bi = new BigInteger("153890972191202256150310830154922163807316525358455215516067727076235016932726922093888770552128767458882963869421440585369743", 10); + if (!bi.isProbablePrime(80)) { + fail("isProbablePrime failed for: " + bi); + } + bi = new BigInteger("2090575416269141767246491983797422123741252476560371649798066134123893524014911825188890458270426076468664046568752890122415061377308817346303546688282957897504000216241497550243010257911214329646877810655164658470278901030511157372440751259674247310396158238588463284702737181653", 10); + if (!bi.isProbablePrime(80)) { + fail("isProbablePrime failed for: " + bi); + } + // + for (int bitLength = 100; bitLength <= 600; bitLength += 100) { + BigInteger a = BigInteger.probablePrime(bitLength, rand); + BigInteger b = BigInteger.probablePrime(bitLength, rand); + BigInteger c = a.multiply(b); + assertFalse("isProbablePrime failed for product of two large primes" + + a + " * " + b + " = " + c + + " (bitLength = " + bitLength + ")", + c.isProbablePrime(80) ); + } + } + + /** + * @tests java.math.BigInteger#nextProbablePrime() + */ + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "nextProbablePrime", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isProbablePrime", + args = {int.class} + ) + }) + public void test_nextProbablePrime() { + largePrimesProduct( + new BigInteger("2537895984043447429238717358455377929009126353874925049325287329295635198252046158619999217453233889378619619008359011789"), + new BigInteger("1711501451602688337873833423534849678524059393231999670806585630179374689152366029939952735718718709436427337762082614710093"), + "4343612660706993434504106787562106084038357258130862545477481433639575850237346784798851102536616749334772541987502120552264920040629526028540204698334741815536099373917351194423681128374184971846099257056996626343051832131340568120612204287123" + ); + + largePrimesProduct( + new BigInteger("4617974730611208463200675282934641082129817404749925308887287017217158545765190433369842932770197341032031682222405074564586462802072184047198214312142847809259437477387527466762251087500170588962277514858557309036550499896961735701485020851"), + new BigInteger("4313158964405728158057980867015758419530142215799386331265837224051830838583266274443105715022196238165196727467066901495701708590167750818040112544031694506528759169669442493029999154074962566165293254671176670719518898684698255068313216294333"), + "19918059106734861363335842730108905466210762564765297409619920041621379008685530738918145604092111306972524565803236031571858280032420140331838737621152630780261815015157696362550138161774466814661069892975003440654998880587960037013294137372709096788892473385003457361736563927256562678181177287998121131179907762285048659075843995525830945659905573174849006768920618442371027575308854641789533211132313916836205357976988977849024687805212304038260207820679964201211309384057458137851" + ); + } + + static void largePrimesProduct(BigInteger a, BigInteger b, String c) { + BigInteger wp = a.multiply(b); + assertFalse("isProbablePrime failed for product of two large primes" + + a + " * " + b + " = " + c, + wp.isProbablePrime(80) ); + BigInteger wpMinusOne = wp.subtract(BigInteger.ONE); + BigInteger next = wpMinusOne.nextProbablePrime(); +// System.out.println(c); +// System.out.println(next); + assertTrue("nextProbablePrime returns wrong number: " + next + + "instead of expected: " + c, + next.toString().equals(c) ); } + /** + * @tests java.math.BigInteger#probablePrime(int, java.util.Random) + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "probablePrime", + args = {int.class, java.util.Random.class} + ) + public void test_probablePrime() { + for (int bitLength = 50; bitLength <= 1050; bitLength += 100) { + BigInteger a = BigInteger.probablePrime(bitLength, rand); + assertTrue("isProbablePrime(probablePrime()) failed for: " + bi, + a.isProbablePrime(80)); +// System.out.println(a); +// BigInteger prime = a.nextProbablePrime(); +// System.out.print("Next Probable Prime is "); +// System.out.println(prime); + } + } // BEGIN android-added // public void testModPowPerformance() { @@ -356,18 +474,16 @@ public class BigIntegerTest extends junit.framework.TestCase { // END android-added + /** * @tests java.math.BigInteger#equals(java.lang.Object) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "equals", + args = {java.lang.Object.class} + ) public void test_equalsLjava_lang_Object() { assertTrue("0=0", zero.equals(BigInteger.valueOf(0))); assertTrue("-123=-123", BigInteger.valueOf(-123).equals( @@ -383,15 +499,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#compareTo(java.math.BigInteger) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "compareTo", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "compareTo", + args = {java.math.BigInteger.class} + ) public void test_compareToLjava_math_BigInteger() { assertTrue("Smaller number returned >= 0", one.compareTo(two) < 0); assertTrue("Larger number returned >= 0", two.compareTo(one) > 0); @@ -403,15 +516,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#intValue() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "intValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "intValue", + args = {} + ) public void test_intValue() { assertTrue("Incorrect intValue for 2**70", twoToTheSeventy.intValue() == 0); @@ -421,15 +531,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#longValue() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "longValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "longValue", + args = {} + ) public void test_longValue() { assertTrue("Incorrect longValue for 2**70", twoToTheSeventy.longValue() == 0); @@ -439,15 +546,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#valueOf(long) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "valueOf", - methodArgs = {long.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "valueOf", + args = {long.class} + ) public void test_valueOfJ() { assertTrue("Incurred number returned for 2", BigInteger.valueOf(2L) .equals(two)); @@ -458,15 +562,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#add(java.math.BigInteger) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Test is OK, but some cases listed below can be reasonable.", - targets = { - @TestTarget( - methodName = "add", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Test is OK, but some cases listed below can be reasonable.", + method = "add", + args = {java.math.BigInteger.class} + ) public void test_addLjava_math_BigInteger() { assertTrue("Incorrect sum--wanted a zillion", aZillion.add(aZillion) .add(aZillion.negate()).equals(aZillion)); @@ -489,7 +590,14 @@ public class BigIntegerTest extends junit.framework.TestCase { BigInteger bi3p2 = bi3.add(bi2); assertTrue("bi2p3=bi3p2", bi2p3.equals(bi3p2)); + + // BESSER UEBERGREIFENDE TESTS MACHEN IN FORM VON STRESS TEST. // add large positive + small positive + BigInteger sum = aZillion; + BigInteger increment = one; + for (int i = 0; i < 20; i++) { + + } // add large positive + small negative @@ -501,15 +609,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#negate() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "negate", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "negate", + args = {} + ) public void test_negate() { assertTrue("Single negation of zero did not result in zero", zero .negate().equals(zero)); @@ -538,15 +643,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#signum() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "signum", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "signum", + args = {} + ) public void test_signum() { assertTrue("Wrong positive signum", two.signum() == 1); assertTrue("Wrong zero signum", zero.signum() == 0); @@ -557,15 +659,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#abs() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "abs", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "abs", + args = {} + ) public void test_abs() { assertTrue("Invalid number returned for zillion", aZillion.negate() .abs().equals(aZillion.abs())); @@ -579,15 +678,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#pow(int) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checking missed", - targets = { - @TestTarget( - methodName = "pow", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checking missed", + method = "pow", + args = {int.class} + ) public void test_powI() { assertTrue("Incorrect exponent returned for 2**10", two.pow(10).equals( twoToTheTen)); @@ -600,15 +696,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#modInverse(java.math.BigInteger) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "modInverse", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "modInverse", + args = {java.math.BigInteger.class} + ) public void test_modInverseLjava_math_BigInteger() { BigInteger a = zero, mod, inv; for (int j = 3; j < 50; j++) { @@ -658,15 +751,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#shiftRight(int) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "shiftRight", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "shiftRight", + args = {int.class} + ) public void test_shiftRightI() { assertTrue("1 >> 0", BigInteger.valueOf(1).shiftRight(0).equals( BigInteger.ONE)); @@ -724,15 +814,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#shiftLeft(int) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "shiftLeft", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "shiftLeft", + args = {int.class} + ) public void test_shiftLeftI() { assertTrue("1 << 0", one.shiftLeft(0).equals(one)); assertTrue("1 << 1", one.shiftLeft(1).equals(two)); @@ -774,15 +861,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#multiply(java.math.BigInteger) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "multiply", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "multiply", + args = {java.math.BigInteger.class} + ) public void test_multiplyLjava_math_BigInteger() { assertTrue("Incorrect sum--wanted three zillion", aZillion .add(aZillion).add(aZillion).equals( @@ -809,15 +893,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#divide(java.math.BigInteger) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "divide", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "divide", + args = {java.math.BigInteger.class} + ) public void test_divideLjava_math_BigInteger() { testAllDivs(bi33, bi3); testAllDivs(bi22, bi2); @@ -876,15 +957,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#remainder(java.math.BigInteger) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checked", - targets = { - @TestTarget( - methodName = "remainder", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checked", + method = "remainder", + args = {java.math.BigInteger.class} + ) public void test_remainderLjava_math_BigInteger() { try { largePos.remainder(zero); @@ -914,15 +992,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#mod(java.math.BigInteger) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checked", - targets = { - @TestTarget( - methodName = "mod", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checked", + method = "mod", + args = {java.math.BigInteger.class} + ) public void test_modLjava_math_BigInteger() { try { largePos.mod(zero); @@ -952,15 +1027,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#divideAndRemainder(java.math.BigInteger) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "ArithmeticException checked", - targets = { - @TestTarget( - methodName = "divideAndRemainder", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "ArithmeticException checked", + method = "divideAndRemainder", + args = {java.math.BigInteger.class} + ) public void test_divideAndRemainderLjava_math_BigInteger() { try { largePos.divideAndRemainder(zero); @@ -990,15 +1062,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#BigInteger(java.lang.String) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "NumberFormatException checking missed.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "NumberFormatException checking missed.", + method = "BigInteger", + args = {java.lang.String.class} + ) public void test_ConstructorLjava_lang_String() { assertTrue("new(0)", new BigInteger("0").equals(BigInteger.valueOf(0))); assertTrue("new(1)", new BigInteger("1").equals(BigInteger.valueOf(1))); @@ -1013,15 +1082,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#BigInteger(java.lang.String, int) */ -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "NumberFormatException checking missed.", - targets = { - @TestTarget( - methodName = "BigInteger", - methodArgs = {java.lang.String.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "NumberFormatException checking missed.", + method = "BigInteger", + args = {java.lang.String.class, int.class} + ) public void test_ConstructorLjava_lang_StringI() { assertTrue("new(0,16)", new BigInteger("0", 16).equals(BigInteger .valueOf(0))); @@ -1046,15 +1112,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#toString() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "toString", + args = {} + ) public void test_toString() { assertTrue("0.toString", "0".equals(BigInteger.valueOf(0).toString())); assertTrue("1.toString", "1".equals(BigInteger.valueOf(1).toString())); @@ -1069,15 +1132,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#toString(int) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "toString", + args = {int.class} + ) public void test_toStringI() { assertTrue("0.toString(16)", "0".equals(BigInteger.valueOf(0).toString( 16))); @@ -1096,15 +1156,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#and(java.math.BigInteger) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "and", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "and", + args = {java.math.BigInteger.class} + ) public void test_andLjava_math_BigInteger() { for (BigInteger[] element : booleanPairs) { BigInteger i1 = element[0], i2 = element[1]; @@ -1121,15 +1178,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#or(java.math.BigInteger) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "or", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "or", + args = {java.math.BigInteger.class} + ) public void test_orLjava_math_BigInteger() { for (BigInteger[] element : booleanPairs) { BigInteger i1 = element[0], i2 = element[1]; @@ -1146,15 +1200,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#xor(java.math.BigInteger) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "xor", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "xor", + args = {java.math.BigInteger.class} + ) public void test_xorLjava_math_BigInteger() { for (BigInteger[] element : booleanPairs) { BigInteger i1 = element[0], i2 = element[1]; @@ -1171,15 +1222,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#not() */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "not", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "not", + args = {} + ) public void test_not() { for (BigInteger[] element : booleanPairs) { BigInteger i1 = element[0]; @@ -1194,15 +1242,12 @@ public class BigIntegerTest extends junit.framework.TestCase { /** * @tests java.math.BigInteger#andNot(java.math.BigInteger) */ -@TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "andNot", - methodArgs = {java.math.BigInteger.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "andNot", + args = {java.math.BigInteger.class} + ) public void test_andNotLjava_math_BigInteger() { for (BigInteger[] element : booleanPairs) { BigInteger i1 = element[0], i2 = element[1]; @@ -1224,15 +1269,12 @@ public class BigIntegerTest extends junit.framework.TestCase { } -@TestInfo( - level = TestLevel.PARTIAL, - purpose = "Regression test", - targets = { - @TestTarget( - methodName = "clone", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Regression test", + method = "clone", + args = {} + ) public void testClone() { // Regression test for HARMONY-1770 MyBigInteger myBigInteger = new MyBigInteger("12345"); diff --git a/math/src/test/java/tests/api/java/math/MathContextTest.java b/math/src/test/java/tests/api/java/math/MathContextTest.java new file mode 100644 index 0000000..0051b44 --- /dev/null +++ b/math/src/test/java/tests/api/java/math/MathContextTest.java @@ -0,0 +1,135 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.java.math; + +import dalvik.annotation.TestTargets; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetNew; +import dalvik.annotation.TestTargetClass; + +import java.math.BigDecimal; +import java.math.MathContext; +import java.math.RoundingMode; + +@TestTargetClass(MathContext.class) +public class MathContextTest extends junit.framework.TestCase { + + /** + * @tests java.math.MathContext#MathContext(...) + */ + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "MathContext", + args = {int.class} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "MathContext", + args = {int.class, java.math.RoundingMode.class} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "MathContext", + args = {java.lang.String.class} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getPrecision", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getRoundingMode", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "equals", + args = {java.lang.Object.class} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "hashCode", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "toString", + args = {} + ) + }) + public void test_MathContextConstruction() { + String a = "-12380945E+61"; + BigDecimal aNumber = new BigDecimal(a); + MathContext mcIntRm6hd = new MathContext(6, RoundingMode.HALF_DOWN); + MathContext mcStr6hd = new MathContext("precision=6 roundingMode=HALF_DOWN"); + MathContext mcInt6 = new MathContext(6); + MathContext mcInt134 = new MathContext(134); + + // getPrecision() + assertEquals("MathContext.getPrecision() returns incorrect value", + 6, mcIntRm6hd.getPrecision() ); + assertEquals("MathContext.getPrecision() returns incorrect value", + 134, mcInt134.getPrecision() ); + + // getRoundingMode() + assertEquals("MathContext.getRoundingMode() returns incorrect value", + RoundingMode.HALF_UP, + mcInt6.getRoundingMode()); + assertEquals("MathContext.getRoundingMode() returns incorrect value", + RoundingMode.HALF_DOWN, mcIntRm6hd.getRoundingMode() ); + + // toString() + assertEquals("MathContext.toString() returning incorrect value", + "precision=6 roundingMode=HALF_DOWN", mcIntRm6hd.toString() ); + assertEquals("MathContext.toString() returning incorrect value", + "precision=6 roundingMode=HALF_UP", mcInt6.toString() ); + + // equals(.) + assertEquals("Equal MathContexts are not equal ", + mcIntRm6hd, mcStr6hd ); + assertFalse("Different MathContexts are reported as equal ", + mcInt6.equals(mcStr6hd) ); + assertFalse("Different MathContexts are reported as equal ", + mcInt6.equals(mcInt134) ); + + // hashCode(.) + assertEquals("Equal MathContexts have different hashcodes ", + mcIntRm6hd.hashCode(), mcStr6hd.hashCode() ); + assertFalse("Different MathContexts have equal hashcodes ", + mcInt6.hashCode() == mcStr6hd.hashCode() ); + assertFalse("Different MathContexts have equal hashcodes ", + mcInt6.hashCode() == mcInt134.hashCode() ); + + // other: + BigDecimal res = aNumber.abs(mcInt6); + assertEquals("MathContext Constructor with int precision failed", + new BigDecimal("1.23809E+68"), + res); + } + +}
\ No newline at end of file diff --git a/math/src/test/java/tests/api/java/math/RoundingModeTest.java b/math/src/test/java/tests/api/java/math/RoundingModeTest.java new file mode 100644 index 0000000..e0946b3 --- /dev/null +++ b/math/src/test/java/tests/api/java/math/RoundingModeTest.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.java.math; + +import dalvik.annotation.TestTargets; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetNew; +import dalvik.annotation.TestTargetClass; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +@TestTargetClass(RoundingMode.class) +public class RoundingModeTest extends junit.framework.TestCase { + + /** + * @tests java.math.RoundingMode#valueOf(int) + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "valueOf", + args = {int.class} + ) + public void test_valueOfI() { + assertEquals("valueOf failed for ROUND_CEILING", RoundingMode.valueOf(BigDecimal.ROUND_CEILING), RoundingMode.CEILING); + assertEquals("valueOf failed for ROUND_DOWN", RoundingMode.valueOf(BigDecimal.ROUND_DOWN), RoundingMode.DOWN); + assertEquals("valueOf failed for ROUND_FLOOR", RoundingMode.valueOf(BigDecimal.ROUND_FLOOR), RoundingMode.FLOOR); + assertEquals("valueOf failed for ROUND_HALF_DOWN", RoundingMode.valueOf(BigDecimal.ROUND_HALF_DOWN), RoundingMode.HALF_DOWN); + assertEquals("valueOf failed for ROUND_HALF_EVEN", RoundingMode.valueOf(BigDecimal.ROUND_HALF_EVEN), RoundingMode.HALF_EVEN); + assertEquals("valueOf failed for ROUND_HALF_UP", RoundingMode.valueOf(BigDecimal.ROUND_HALF_UP), RoundingMode.HALF_UP); + assertEquals("valueOf failed for ROUND_UNNECESSARY", RoundingMode.valueOf(BigDecimal.ROUND_UNNECESSARY), RoundingMode.UNNECESSARY); + assertEquals("valueOf failed for ROUND_UP", RoundingMode.valueOf(BigDecimal.ROUND_UP), RoundingMode.UP); + try { + RoundingMode.valueOf(13); + fail("IllegalArgumentException expected for RoundingMode(13)"); + } catch (IllegalArgumentException e) { + } + try { + RoundingMode.valueOf(-1); + fail("IllegalArgumentException expected for RoundingMode(-1)"); + } catch (IllegalArgumentException e) { + } + } + +} diff --git a/math/src/test/java/tests/math/AllTests.java b/math/src/test/java/tests/math/AllTests.java index 9216f21..2773ad6 100644 --- a/math/src/test/java/tests/math/AllTests.java +++ b/math/src/test/java/tests/math/AllTests.java @@ -29,10 +29,10 @@ public class AllTests { } public static Test suite() { - TestSuite suite = new TestSuite("All Math test suites"); + TestSuite suite = tests.TestSuiteFactory.createTestSuite("All Math test suites"); suite.addTest(tests.api.java.math.AllTests.suite()); - suite.addTest(org.apache.harmony.tests.java.math.AllTests.suite()); + suite.addTest(org.apache.harmony.math.tests.java.math.AllTests.suite()); return suite; } |