summaryrefslogtreecommitdiffstats
path: root/math
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:03:55 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:03:55 -0800
commitdd828f42a5c83b4270d4fbf6fce2da1878f1e84a (patch)
treefdd4b68fa1020f2b6426034c94823419a7236200 /math
parentfdb2704414a9ed92394ada0d1395e4db86889465 (diff)
downloadlibcore-dd828f42a5c83b4270d4fbf6fce2da1878f1e84a.zip
libcore-dd828f42a5c83b4270d4fbf6fce2da1878f1e84a.tar.gz
libcore-dd828f42a5c83b4270d4fbf6fce2da1878f1e84a.tar.bz2
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'math')
-rw-r--r--math/src/main/java/java/math/BigDecimal.java1003
-rw-r--r--math/src/main/java/java/math/BigInt.java10
-rw-r--r--math/src/main/java/java/math/BigInteger.java548
-rw-r--r--math/src/main/java/java/math/BitLevel.java92
-rw-r--r--math/src/main/java/java/math/Conversion.java22
-rw-r--r--math/src/main/java/java/math/Division.java38
-rw-r--r--math/src/main/java/java/math/Logical.java3
-rw-r--r--math/src/main/java/java/math/MathContext.java211
-rw-r--r--math/src/main/java/java/math/Multiplication.java38
-rw-r--r--math/src/main/java/java/math/Primality.java58
-rw-r--r--math/src/main/java/java/math/RoundingMode.java66
-rw-r--r--math/src/main/java/java/math/package.html24
-rw-r--r--math/src/main/java/org/apache/harmony/math/internal/nls/Messages.java8
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/AllTests.java60
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalArithmeticTest.java892
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalCompareTest.java313
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java440
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConvertTest.java710
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalScaleOperationsTest.java233
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAddTest.java215
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAndTest.java197
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerCompareTest.java305
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConstructorsTest.java476
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConvertTest.java530
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerDivideTest.java296
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerHashCodeTest.java34
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerModPowTest.java143
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerMultiplyTest.java170
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerNotTest.java89
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOperateBitsTest.java800
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOrTest.java188
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerSubtractTest.java233
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerToStringTest.java160
-rw-r--r--math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerXorTest.java183
-rw-r--r--math/src/test/java/tests/api/java/math/BigDecimalTest.java390
-rw-r--r--math/src/test/java/tests/api/java/math/BigIntegerTest.java314
-rw-r--r--math/src/test/java/tests/math/AllTests.java24
37 files changed, 8522 insertions, 994 deletions
diff --git a/math/src/main/java/java/math/BigDecimal.java b/math/src/main/java/java/math/BigDecimal.java
index 0989f8a..93c095c 100644
--- a/math/src/main/java/java/math/BigDecimal.java
+++ b/math/src/main/java/java/math/BigDecimal.java
@@ -1,20 +1,4 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed 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.
- */
-
-/*
* 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.
@@ -31,12 +15,6 @@
* limitations under the License.
*/
-/*
- * Since the original Harmony Code of the BigInteger class was strongly modified,
- * in order to use the more efficient OpenSSL BIGNUM implementation,
- * no android-modification-tags were placed, at all.
- */
-
package java.math;
import java.io.IOException;
@@ -47,35 +25,37 @@ import java.io.Serializable;
import org.apache.harmony.math.internal.nls.Messages;
/**
- * Class which represents immutable arbritary precision decimal numbers. Each
+ * This class represents immutable arbitrary precision decimal numbers. Each
* {@code BigDecimal} instance is represented with a unscaled arbitrary
- * precision mantissa (the unscaled value) and a scale. The value of the
- * {@code BigDecimal} is {@code unscaledValue} * 10^{-{@code scale}}.
+ * precision mantissa (the unscaled value) and a scale. The value of the {@code
+ * BigDecimal} is {@code unscaledValue} 10^(-{@code scale}).
*
- * @author Intel Middleware Product Division
- * @author Instituto Tecnologico de Cordoba
+ * @since Android 1.0
*/
public class BigDecimal extends Number implements Comparable<BigDecimal>, Serializable {
/* Static Fields */
/**
- * The constant zero as a BigDecimal.
+ * The constant zero as a {@code BigDecimal}.
*
* @since 1.2
+ * @since Android 1.0
*/
public static final BigDecimal ZERO = new BigDecimal(0, 0);
/**
- * The constant one as a BigDecimal.
+ * The constant one as a {@code BigDecimal}.
*
* @since 1.2
+ * @since Android 1.0
*/
public static final BigDecimal ONE = new BigDecimal(1, 0);
/**
- * The constant ten as a BigDecimal.
+ * The constant ten as a {@code BigDecimal}.
*
* @since 1.5
+ * @since Android 1.0
*/
public static final BigDecimal TEN = new BigDecimal(10, 0);
@@ -84,6 +64,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* and negative values towards negative infinity.
*
* @see RoundingMode#UP
+ * @since Android 1.0
*/
public static final int ROUND_UP = 0;
@@ -91,61 +72,70 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* Rounding mode where the values are rounded towards zero.
*
* @see RoundingMode#DOWN
+ * @since Android 1.0
*/
public static final int ROUND_DOWN = 1;
/**
* Rounding mode to round towards positive infinity. For positive values
- * this rounding mode behaves as UP, for negative values as DOWN.
+ * this rounding mode behaves as {@link #ROUND_UP}, for negative values as
+ * {@link #ROUND_DOWN}.
*
* @see RoundingMode#CEILING
+ * @since Android 1.0
*/
public static final int ROUND_CEILING = 2;
/**
* Rounding mode to round towards negative infinity. For positive values
- * this rounding mode behaves as DOWN, for negative values as UP.
+ * this rounding mode behaves as {@link #ROUND_DOWN}, for negative values as
+ * {@link #ROUND_UP}.
*
* @see RoundingMode#FLOOR
+ * @since Android 1.0
*/
public static final int ROUND_FLOOR = 3;
/**
- * Rounding mode where values are rounded towards the nearest neighbour.
+ * Rounding mode where values are rounded towards the nearest neighbor.
* Ties are broken by rounding up.
*
* @see RoundingMode#HALF_UP
+ * @since Android 1.0
*/
public static final int ROUND_HALF_UP = 4;
/**
- * Rounding mode where values are rounded towards the nearest neighbour.
+ * Rounding mode where values are rounded towards the nearest neighbor.
* Ties are broken by rounding down.
*
* @see RoundingMode#HALF_DOWN
+ * @since Android 1.0
*/
public static final int ROUND_HALF_DOWN = 5;
/**
- * Rounding mode where values are rounded towards the nearest neighbour.
- * Ties are broken by rounding to the even neighbour.
+ * Rounding mode where values are rounded towards the nearest neighbor.
+ * Ties are broken by rounding to the even neighbor.
*
* @see RoundingMode#HALF_EVEN
+ * @since Android 1.0
*/
public static final int ROUND_HALF_EVEN = 6;
/**
- * Rounding mode where the rounding operations throws an ArithmeticException
- * for the case that rounding is necessary, i.e. for the case that the value
- * cannot be represented exactly.
+ * Rounding mode where the rounding operations throws an {@code
+ * ArithmeticException} for the case that rounding is necessary, i.e. for
+ * the case that the value cannot be represented exactly.
*
* @see RoundingMode#UNNECESSARY
+ * @since Android 1.0
*/
public static final int ROUND_UNNECESSARY = 7;
/* Private Fields */
- /** This is the serialVersionUID used by the sun implementation */
+ /** This is the serialVersionUID used by the sun implementation. */
private static final long serialVersionUID = 6108874887143696463L;
/** The double closer to <code>Log10(2)</code>. */
@@ -159,19 +149,19 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* An array with powers of five that fit in the type <code>long</code>
- * (<code>5^0,5^1,...,5^27</code>)
+ * (<code>5^0,5^1,...,5^27</code>).
*/
private static final BigInteger FIVE_POW[];
/**
* An array with powers of ten that fit in the type <code>long</code>
- * (<code>10^0,10^1,...,10^18</code>)
+ * (<code>10^0,10^1,...,10^18</code>).
*/
private static final BigInteger TEN_POW[];
/**
* An array with powers of ten that fit in the type <code>long</code>
- * (<code>10^0,10^1,...,10^18</code>)
+ * (<code>10^0,10^1,...,10^18</code>).
*/
private static final long[] LONG_TEN_POW = new long[]
{ 1L,
@@ -229,15 +219,16 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
private static final int[] LONG_TEN_POW_BIT_LENGTH = new int[LONG_TEN_POW.length];
private static final int BI_SCALED_BY_ZERO_LENGTH = 11;
+
/**
* An array with the first <code>BigInteger</code> scaled by zero.
- * (<code>[0,0],[1,0],...,[10,0]</code>)
+ * (<code>[0,0],[1,0],...,[10,0]</code>).
*/
private static final BigDecimal BI_SCALED_BY_ZERO[] = new BigDecimal[BI_SCALED_BY_ZERO_LENGTH];
/**
* An array with the zero number scaled by the first positive scales.
- * (<code>0*10^0, 0*10^1, ..., 0*10^10</code>)
+ * (<code>0*10^0, 0*10^1, ..., 0*10^10</code>).
*/
private static final BigDecimal ZERO_SCALED_BY[] = new BigDecimal[11];
@@ -271,7 +262,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* The arbitrary precision integer (unscaled value) in the internal
- * representation of <code>BigDecimal</code>.
+ * representation of {@code BigDecimal}.
*/
private BigInteger intVal;
@@ -280,7 +271,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
private transient long smallValue;
/**
- * The 32-bit integer scale in the internal representation of <code>BigDecimal</code>.
+ * The 32-bit integer scale in the internal representation of {@code BigDecimal}.
*/
private int scale;
@@ -315,21 +306,20 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
*
* @param in
* array of characters containing the string representation of
- * this {@code BigDecimal}
+ * this {@code BigDecimal}.
* @param offset
- * first index to be copied
+ * first index to be copied.
* @param len
- * number of characters to be used
+ * number of characters to be used.
* @throws NullPointerException
- * if in == null
- * @throws NumberFormatException
- * if offset < 0 or len <= 0 or offset+len-1 < 0 or offset+len-1 >=
- * in.length
+ * if {@code in == null}.
* @throws NumberFormatException
- * if scale is out of range
+ * if {@code offset < 0} or {@code len <= 0} or {@code
+ * offset+len-1 < 0} or {@code offset+len-1 >= in.length}.
* @throws NumberFormatException
- * if in does not contain a valid string representation of a big
- * decimal.
+ * if in does not contain a valid string representation of a big
+ * decimal.
+ * @since Android 1.0
*/
public BigDecimal(char[] in, int offset, int len) {
int begin = offset; // first index to be copied
@@ -360,8 +350,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
if (in[offset] == '0') {
counter++;
} else {
- wasNonZero = true;
- }
+ wasNonZero = true;
+ }
};
}
@@ -378,8 +368,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
if (in[offset] == '0') {
counter++;
} else {
- wasNonZero = true;
- }
+ wasNonZero = true;
+ }
};
}
scale = offset - begin;
@@ -415,7 +405,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
bitLength = bitLength(smallValue);
} else {
setUnscaledValue(new BigInteger(unscaledBuffer.toString()));
- }
+ }
precision = unscaledBuffer.length() - counter;
if (unscaledBuffer.charAt(0) == '-') {
precision --;
@@ -428,27 +418,26 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
*
* @param in
* array of characters containing the string representation of
- * this {@code BigDecimal}
+ * this {@code BigDecimal}.
* @param offset
- * first index to be copied
+ * first index to be copied.
* @param len
- * number of characters to be used
+ * number of characters to be used.
* @param mc
* rounding mode and precision for the result of this operation.
* @throws NullPointerException
- * if in == null
+ * if {@code in == null}.
* @throws NumberFormatException
- * if offset < 0 or len <= 0 or offset+len-1 < 0 or offset+len-1 >=
- * in.length
+ * if {@code offset < 0} or {@code len <= 0} or {@code
+ * offset+len-1 < 0} or {@code offset+len-1 >= in.length}.
* @throws NumberFormatException
- * if scale is out of range
- * @throws NumberFormatException
- * if in does not contain a valid string representation of a big
- * decimal.
+ * if {@code in} does not contain a valid string representation
+ * of a big decimal.
* @throws ArithmeticException
- * if mc.precision > 0 and mc.roundingMode == UNNECESSARY and
- * the new big decimal cannot be represented within the given
- * precision without rounding.
+ * if {@code mc.precision > 0} and {@code mc.roundingMode ==
+ * UNNECESSARY} and the new big decimal cannot be represented
+ * within the given precision without rounding.
+ * @since Android 1.0
*/
public BigDecimal(char[] in, int offset, int len, MathContext mc) {
this(in, offset, len);
@@ -463,12 +452,11 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* array of characters containing the string representation of
* this {@code BigDecimal}.
* @throws NullPointerException
- * if in == null
+ * if {@code in == null}.
* @throws NumberFormatException
- * if scale is out of range
- * @throws NumberFormatException
- * if in does not contain a valid string representation of a big
- * decimal.
+ * if {@code in} does not contain a valid string representation
+ * of a big decimal.
+ * @since Android 1.0
*/
public BigDecimal(char[] in) {
this(in, 0, in.length);
@@ -485,16 +473,15 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* @param mc
* rounding mode and precision for the result of this operation.
* @throws NullPointerException
- * if in == null
- * @throws NumberFormatException
- * if scale is out of range
+ * if {@code in == null}.
* @throws NumberFormatException
- * if in does not contain a valid string representation of a big
- * decimal.
+ * if {@code in} does not contain a valid string representation
+ * of a big decimal.
* @throws ArithmeticException
- * if mc.precision > 0 and mc.roundingMode == UNNECESSARY and
- * the new big decimal cannot be represented within the given
- * precision without rounding.
+ * if {@code mc.precision > 0} and {@code mc.roundingMode ==
+ * UNNECESSARY} and the new big decimal cannot be represented
+ * within the given precision without rounding.
+ * @since Android 1.0
*/
public BigDecimal(char[] in, MathContext mc) {
this(in, 0, in.length);
@@ -506,14 +493,12 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* representation.
*
* @param val
- * string containing the string representation of this
- * {@code BigDecimal}.
- *
- * @throws NumberFormatException
- * if scale is out of range
+ * string containing the string representation of this {@code
+ * BigDecimal}.
* @throws NumberFormatException
- * if val does not contain a valid string representation of a big
- * decimal.
+ * if {@code val} does not contain a valid string representation
+ * of a big decimal.
+ * @since Android 1.0
*/
public BigDecimal(String val) {
this(val.toCharArray(), 0, val.length());
@@ -525,20 +510,18 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* context.
*
* @param val
- * string containing the string representation of this
- * {@code BigDecimal}.
+ * string containing the string representation of this {@code
+ * BigDecimal}.
* @param mc
* rounding mode and precision for the result of this operation.
- *
- * @throws NumberFormatException
- * if scale is out of range
* @throws NumberFormatException
- * if val does not contain a valid string representation of a big
- * decimal.
+ * if {@code val} does not contain a valid string representation
+ * of a big decimal.
* @throws ArithmeticException
- * if mc.precision > 0 and mc.roundingMode == UNNECESSARY and
- * the new big decimal cannot be represented within the given
- * precision without rounding.
+ * if {@code mc.precision > 0} and {@code mc.roundingMode ==
+ * UNNECESSARY} and the new big decimal cannot be represented
+ * within the given precision without rounding.
+ * @since Android 1.0
*/
public BigDecimal(String val, MathContext mc) {
this(val.toCharArray(), 0, val.length());
@@ -547,18 +530,19 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Constructs a new {@code BigDecimal} instance from the 64bit double
- * {@code val}. The constructed big decimal is equivalent to the double.
- * For example, new BigDecimal(0.1) is equal to
- * 0.1000000000000000055511151231257827021181583404541015625. This happens
- * as 0.1 cannot be represented exactly in binary.
- *
- * To generate a big decimal instance which is equivalent to 0.1 use the
- * BigDecimal(String) constructor.
+ * {@code val}. The constructed big decimal is equivalent to the given
+ * double. For example, {@code new BigDecimal(0.1)} is equal to {@code
+ * 0.1000000000000000055511151231257827021181583404541015625}. This happens
+ * as {@code 0.1} cannot be represented exactly in binary.
+ * <p>
+ * To generate a big decimal instance which is equivalent to {@code 0.1} use
+ * the {@code BigDecimal(String)} constructor.
*
* @param val
* double value to be converted to a {@code BigDecimal} instance.
* @throws NumberFormatException
- * if val is infinity or not a number.
+ * if {@code val} is infinity or not a number.
+ * @since Android 1.0
*/
public BigDecimal(double val) {
if (Double.isInfinite(val) || Double.isNaN(val)) {
@@ -577,7 +561,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
scale = 0;
precision = 1;
}
- // To simplify all factors '2' in the mantisa
+ // To simplify all factors '2' in the mantisa
if (scale > 0) {
trailingZeros = Math.min(scale, Long.numberOfTrailingZeros(mantisa));
mantisa >>>= trailingZeros;
@@ -593,10 +577,12 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
if(bitLength < 64) {
smallValue = mantisa << (-scale);
} else {
+ // BEGIN android-changed
BigInt bi = new BigInt();
bi.putLongInt(mantisa);
bi.shift(-scale);
intVal = new BigInteger(bi);
+ // END android-changed
}
scale = 0;
} else if (scale > 0) {
@@ -616,24 +602,25 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Constructs a new {@code BigDecimal} instance from the 64bit double
- * {@code val}. The constructed big decimal is equivalent to the double.
- * For example, new BigDecimal(0.1) is equal to
- * 0.1000000000000000055511151231257827021181583404541015625. This happens
- * as 0.1 cannot be represented exactly in binary.
- *
- * To generate a big decimal instance which is equivalent to 0.1 use the
- * BigDecimal(String) constructor.
+ * {@code val}. The constructed big decimal is equivalent to the given
+ * double. For example, {@code new BigDecimal(0.1)} is equal to {@code
+ * 0.1000000000000000055511151231257827021181583404541015625}. This happens
+ * as {@code 0.1} cannot be represented exactly in binary.
+ * <p>
+ * To generate a big decimal instance which is equivalent to {@code 0.1} use
+ * the {@code BigDecimal(String)} constructor.
*
* @param val
* double value to be converted to a {@code BigDecimal} instance.
* @param mc
* rounding mode and precision for the result of this operation.
* @throws NumberFormatException
- * if val is infinity or not a number.
+ * if {@code val} is infinity or not a number.
* @throws ArithmeticException
- * if mc.precision > 0 and mc.roundingMode == UNNECESSARY and
- * the new big decimal cannot be represented within the given
- * precision without rounding.
+ * if {@code mc.precision > 0} and {@code mc.roundingMode ==
+ * UNNECESSARY} and the new big decimal cannot be represented
+ * within the given precision without rounding.
+ * @since Android 1.0
*/
public BigDecimal(double val, MathContext mc) {
this(val);
@@ -642,11 +629,12 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Constructs a new {@code BigDecimal} instance from the given big integer
- * {@code val}. The scale of the result is 0.
+ * {@code val}. The scale of the result is {@code 0}.
*
* @param val
- * {@code BigInteger} value to be converted to a
- * {@code BigDecimal} instance.
+ * {@code BigInteger} value to be converted to a {@code
+ * BigDecimal} instance.
+ * @since Android 1.0
*/
public BigDecimal(BigInteger val) {
this(val, 0);
@@ -654,18 +642,18 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Constructs a new {@code BigDecimal} instance from the given big integer
- * {@code val}. The scale of the result is 0.
+ * {@code val}. The scale of the result is {@code 0}.
*
* @param val
- * {@code BigInteger} value to be converted to a
- * {@code BigDecimal} instance.
+ * {@code BigInteger} value to be converted to a {@code
+ * BigDecimal} instance.
* @param mc
* rounding mode and precision for the result of this operation.
- *
* @throws ArithmeticException
- * if mc.precision > 0 and mc.roundingMode == UNNECESSARY and
- * the new big decimal cannot be represented within the given
- * precision without rounding.
+ * if {@code mc.precision > 0} and {@code mc.roundingMode ==
+ * UNNECESSARY} and the new big decimal cannot be represented
+ * within the given precision without rounding.
+ * @since Android 1.0
*/
public BigDecimal(BigInteger val, MathContext mc) {
this(val);
@@ -675,13 +663,16 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Constructs a new {@code BigDecimal} instance from a given unscaled value
* {@code unscaledVal} and a given scale. The value of this instance is
- * {@code unscaledVal} * 10^{-{@code scale}}.
+ * {@code unscaledVal} 10^(-{@code scale}).
*
* @param unscaledVal
* {@code BigInteger} representing the unscaled value of this
* {@code BigDecimal} instance.
* @param scale
* scale of this {@code BigDecimal} instance.
+ * @throws NullPointerException
+ * if {@code unscaledVal == null}.
+ * @since Android 1.0
*/
public BigDecimal(BigInteger unscaledVal, int scale) {
if (unscaledVal == null) {
@@ -694,8 +685,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Constructs a new {@code BigDecimal} instance from a given unscaled value
* {@code unscaledVal} and a given scale. The value of this instance is
- * {@code unscaledVal} * 10^{-{@code scale}}. The result is rounded
- * according to the specified math context.
+ * {@code unscaledVal} 10^(-{@code scale}). The result is rounded according
+ * to the specified math context.
*
* @param unscaledVal
* {@code BigInteger} representing the unscaled value of this
@@ -704,11 +695,13 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* scale of this {@code BigDecimal} instance.
* @param mc
* rounding mode and precision for the result of this operation.
- *
* @throws ArithmeticException
- * if mc.precision > 0 and mc.roundingMode == UNNECESSARY and
- * the new big decimal cannot be represented within the given
- * precision without rounding.
+ * if {@code mc.precision > 0} and {@code mc.roundingMode ==
+ * UNNECESSARY} and the new big decimal cannot be represented
+ * within the given precision without rounding.
+ * @throws NullPointerException
+ * if {@code unscaledVal == null}.
+ * @since Android 1.0
*/
public BigDecimal(BigInteger unscaledVal, int scale, MathContext mc) {
this(unscaledVal, scale);
@@ -721,14 +714,15 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
*
* @param val
* int value to be converted to a {@code BigDecimal} instance.
+ * @since Android 1.0
*/
public BigDecimal(int val) {
this(val,0);
}
/**
- * Constructs a new {@code BigDecimal} instance from the given int
- * {@code val}. The scale of the result is 0. The result is rounded
+ * Constructs a new {@code BigDecimal} instance from the given int {@code
+ * val}. The scale of the result is {@code 0}. The result is rounded
* according to the specified math context.
*
* @param val
@@ -736,9 +730,10 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* @param mc
* rounding mode and precision for the result of this operation.
* @throws ArithmeticException
- * if mc.precision > 0 and mc.roundingMode == UNNECESSARY and
- * the new big decimal cannot be represented within the given
- * precision without rounding.
+ * if {@code mc.precision > 0} and {@code c.roundingMode ==
+ * UNNECESSARY} and the new big decimal cannot be represented
+ * within the given precision without rounding.
+ * @since Android 1.0
*/
public BigDecimal(int val, MathContext mc) {
this(val,0);
@@ -746,30 +741,31 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
}
/**
- * Constructs a new {@code BigDecimal} instance from the given long
- * {@code val}. The scale of the result is 0.
+ * Constructs a new {@code BigDecimal} instance from the given long {@code
+ * val}. The scale of the result is {@code 0}.
*
* @param val
* long value to be converted to a {@code BigDecimal} instance.
+ * @since Android 1.0
*/
public BigDecimal(long val) {
this(val,0);
}
/**
- * Constructs a new {@code BigDecimal} instance from the given long
- * {@code val}. The scale of the result is 0. The result is rounded
+ * Constructs a new {@code BigDecimal} instance from the given long {@code
+ * val}. The scale of the result is {@code 0}. The result is rounded
* according to the specified math context.
*
* @param val
* long value to be converted to a {@code BigDecimal} instance.
* @param mc
* rounding mode and precision for the result of this operation.
- *
* @throws ArithmeticException
- * if mc.precision > 0 and mc.roundingMode == UNNECESSARY and
- * the new big decimal cannot be represented within the given
- * precision without rounding.
+ * if {@code mc.precision > 0} and {@code mc.roundingMode ==
+ * UNNECESSARY} and the new big decimal cannot be represented
+ * within the given precision without rounding.
+ * @since Android 1.0
*/
public BigDecimal(long val, MathContext mc) {
this(val);
@@ -779,16 +775,18 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/* Public Methods */
/**
- * Returns a new {@code BigDecimal} instance whose value is equal to
- * {@code unscaledVal} * 10^{-{@code scale}}. The scale of the result is
- * {@code scale}, and its unscaled value is {@code unscaledVal}.
+ * Returns a new {@code BigDecimal} instance whose value is equal to {@code
+ * unscaledVal} 10^(-{@code scale}). The scale of the result is {@code
+ * scale}, and its unscaled value is {@code unscaledVal}.
*
* @param unscaledVal
- * unscaled value to be used to construct the new
- * {@code BigDecimal}.
+ * unscaled value to be used to construct the new {@code
+ * BigDecimal}.
* @param scale
* scale to be used to construct the new {@code BigDecimal}.
- * @return {@code BigDecimal} instance with the value {@code unscaledVal}*10^{-{@code unscaledVal}}.
+ * @return {@code BigDecimal} instance with the value {@code unscaledVal}*
+ * 10^(-{@code unscaledVal}).
+ * @since Android 1.0
*/
public static BigDecimal valueOf(long unscaledVal, int scale) {
if (scale == 0) {
@@ -802,13 +800,14 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
}
/**
- * Returns a new {@code BigDecimal} instance whose value is equal to
- * {@code unscaledVal}. The scale of the result is 0, and its unscaled
+ * Returns a new {@code BigDecimal} instance whose value is equal to {@code
+ * unscaledVal}. The scale of the result is {@code 0}, and its unscaled
* value is {@code unscaledVal}.
*
* @param unscaledVal
* value to be converted to a {@code BigDecimal}.
* @return {@code BigDecimal} instance with the value {@code unscaledVal}.
+ * @since Android 1.0
*/
public static BigDecimal valueOf(long unscaledVal) {
if ((unscaledVal >= 0) && (unscaledVal < BI_SCALED_BY_ZERO_LENGTH)) {
@@ -818,25 +817,24 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
}
/**
- * Returns a new {@code BigDecimal} instance whose value is equal to
- * {@code unscaledVal}.
- *
- * The new decimal is constructed as if the {@code BigDecimal(String)}
- * constructor is called with an argument which is equal to
- * {@code Double.toString(val)}.
- *
- * For example, valueOf(0.1) is converted to (unscaled=1, scale=1), although
- * the double 0.1 cannot be represented exactly as a double value. In
- * contrast to that, a new {@code BigDecimal(0.1)} instance has the value
- * 0.1000000000000000055511151231257827021181583404541015625 with an
- * unscaled value 1000000000000000055511151231257827021181583404541015625
- * and the scale 55.
+ * Returns a new {@code BigDecimal} instance whose value is equal to {@code
+ * unscaledVal}. The new decimal is constructed as if the {@code
+ * BigDecimal(String)} constructor is called with an argument which is equal
+ * to {@code Double.toString(val)}. For example, {@code valueOf(0.1)} is
+ * converted to (unscaled=1, scale=1), although the double {@code 0.1}
+ * cannot be represented exactly as a double value. In contrast to that, a
+ * new {@code BigDecimal(0.1)} instance has the value {@code
+ * 0.1000000000000000055511151231257827021181583404541015625} with an
+ * unscaled value {@code
+ * 1000000000000000055511151231257827021181583404541015625} and the scale
+ * {@code 55}.
*
* @param val
* double value to be converted to a {@code BigDecimal}.
* @return {@code BigDecimal} instance with the value {@code val}.
* @throws NumberFormatException
- * if val is infinite or val is not a number.
+ * if {@code val} is infinite or {@code val} is not a number
+ * @since Android 1.0
*/
public static BigDecimal valueOf(double val) {
if (Double.isInfinite(val) || Double.isNaN(val)) {
@@ -855,7 +853,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* value to be added to {@code this}.
* @return {@code this + augend}.
* @throws NullPointerException
- * if augend == null
+ * if {@code augend == null}.
+ * @since Android 1.0
*/
public BigDecimal add(BigDecimal augend) {
int diffScale = this.scale - augend.scale;
@@ -872,7 +871,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
return this;
}
}
- // Let be: this = [u1,s1] and augend = [u2,s2]
+ // Let be: this = [u1,s1] and augend = [u2,s2]
if (diffScale == 0) {
// case s1 == s2: [u1 + u2 , s1]
if (Math.max(this.bitLength, augend.bitLength) + 1 < 64) {
@@ -888,17 +887,18 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
}
private static BigDecimal addAndMult10(BigDecimal thisValue,BigDecimal augend, int diffScale) {
+ // BEGIN android-changed
if(diffScale < LONG_TEN_POW.length &&
Math.max(thisValue.bitLength,augend.bitLength+LONG_TEN_POW_BIT_LENGTH[diffScale])+1<64) {
return valueOf(thisValue.smallValue+augend.smallValue*LONG_TEN_POW[diffScale],thisValue.scale);
- }
- else {
+ } else {
BigInt bi = Multiplication.multiplyByTenPow(augend.getUnscaledValue(),diffScale).bigInt;
bi.add(thisValue.getUnscaledValue().bigInt);
return new BigDecimal(new BigInteger(bi), thisValue.scale);
}
+ // END android-changed
}
-
+
/**
* Returns a new {@code BigDecimal} whose value is {@code this + augend}.
* The result is rounded according to the passed context {@code mc}.
@@ -909,7 +909,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* rounding mode and precision for the result of this operation.
* @return {@code this + augend}.
* @throws NullPointerException
- * if augend == null
+ * if {@code augend == null} or {@code mc == null}.
+ * @since Android 1.0
*/
public BigDecimal add(BigDecimal augend, MathContext mc) {
BigDecimal larger; // operand with the largest unscaled value
@@ -917,7 +918,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
BigInteger tempBI;
long diffScale = (long)this.scale - augend.scale;
int largerSignum;
- // Some operand is zero or the precision is infinity
+ // Some operand is zero or the precision is infinity
if ((augend.isZero()) || (this.isZero())
|| (mc.getPrecision() == 0)) {
return add(augend).round(mc);
@@ -929,15 +930,14 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
} else if (augend.aproxPrecision() < -diffScale - 1) {
larger = this;
smaller = augend;
- } else {// No optimization is done
+ } else {// No optimization is done
return add(augend).round(mc);
}
if (mc.getPrecision() >= larger.aproxPrecision()) {
// No optimization is done
return add(augend).round(mc);
}
- // Cases where it's unnecessary to add two numbers with very different
- // scales
+ // Cases where it's unnecessary to add two numbers with very different scales
largerSignum = larger.signum();
if (largerSignum == smaller.signum()) {
tempBI = Multiplication.multiplyByPositiveInt(larger.getUnscaledValue(),10)
@@ -948,21 +948,22 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
tempBI = Multiplication.multiplyByPositiveInt(tempBI,10)
.add(BigInteger.valueOf(largerSignum * 9));
}
- // Rounding the improved adding
+ // Rounding the improved adding
larger = new BigDecimal(tempBI, larger.scale + 1);
return larger.round(mc);
}
/**
- * Returns a new {@code BigDecimal} whose value is {@code this - subtrahend}.
- * The scale of the result is the maximum of the scales of the two
+ * Returns a new {@code BigDecimal} whose value is {@code this - subtrahend}
+ * . The scale of the result is the maximum of the scales of the two
* arguments.
*
* @param subtrahend
* value to be subtracted from {@code this}.
* @return {@code this - subtrahend}.
* @throws NullPointerException
- * if subtrahend == null
+ * if {@code subtrahend == null}.
+ * @since Android 1.0
*/
public BigDecimal subtract(BigDecimal subtrahend) {
int diffScale = this.scale - subtrahend.scale;
@@ -1015,7 +1016,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* rounding mode and precision for the result of this operation.
* @return {@code this - subtrahend}.
* @throws NullPointerException
- * if subtrahend == null
+ * if {@code subtrahend == null} or {@code mc == null}.
+ * @since Android 1.0
*/
public BigDecimal subtract(BigDecimal subtrahend, MathContext mc) {
long diffScale = subtrahend.scale - (long)this.scale;
@@ -1050,15 +1052,16 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
}
/**
- * Returns a new {@code BigDecimal} whose value is
- * {@code this * multiplicand}. The scale of the result is the sum of the
- * scales of the two arguments.
+ * Returns a new {@code BigDecimal} whose value is {@code this *
+ * multiplicand}. The scale of the result is the sum of the scales of the
+ * two arguments.
*
* @param multiplicand
* value to be multiplied with {@code this}.
* @return {@code this * multiplicand}.
* @throws NullPointerException
- * if multiplicand == null
+ * if {@code multiplicand == null}.
+ * @since Android 1.0
*/
public BigDecimal multiply(BigDecimal multiplicand) {
long newScale = (long)this.scale + multiplicand.scale;
@@ -1076,9 +1079,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
}
/**
- * Returns a new {@code BigDecimal} whose value is
- * {@code this * multiplicand}. The result is rounded according to the
- * passed context {@code mc}.
+ * Returns a new {@code BigDecimal} whose value is {@code this *
+ * multiplicand}. The result is rounded according to the passed context
+ * {@code mc}.
*
* @param multiplicand
* value to be multiplied with {@code this}.
@@ -1086,7 +1089,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* rounding mode and precision for the result of this operation.
* @return {@code this * multiplicand}.
* @throws NullPointerException
- * if multiplicand == null
+ * if {@code multiplicand == null} or {@code mc == null}.
+ * @since Android 1.0
*/
public BigDecimal multiply(BigDecimal multiplicand, MathContext mc) {
BigDecimal result = multiply(multiplicand);
@@ -1110,14 +1114,15 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* @return {@code this / divisor} rounded according to the given rounding
* mode.
* @throws NullPointerException
- * if divisor == null
+ * if {@code divisor == null}.
* @throws IllegalArgumentException
- * if roundingMode is not a valid rounding mode
+ * if {@code roundingMode} is not a valid rounding mode.
* @throws ArithmeticException
- * if divisor == 0
+ * if {@code divisor == 0}.
* @throws ArithmeticException
- * if roundingMode == ROUND_UNNECESSARY and rounding is
+ * if {@code roundingMode == ROUND_UNNECESSARY} and rounding is
* necessary according to the given scale.
+ * @since Android 1.0
*/
public BigDecimal divide(BigDecimal divisor, int scale, int roundingMode) {
return divide(divisor, scale, RoundingMode.valueOf(roundingMode));
@@ -1138,16 +1143,17 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* @return {@code this / divisor} rounded according to the given rounding
* mode.
* @throws NullPointerException
- * if divisor == null or roundingMode == null
+ * if {@code divisor == null} or {@code roundingMode == null}.
* @throws ArithmeticException
- * if divisor == 0
+ * if {@code divisor == 0}.
* @throws ArithmeticException
- * if roundingMode == RoundingMode.UNNECESSARY and rounding is
- * necessary according to the given scale and given precision.
+ * if {@code roundingMode == RoundingMode.UNNECESSAR}Y and
+ * rounding is necessary according to the given scale and given
+ * precision.
+ * @since Android 1.0
*/
- public BigDecimal divide(BigDecimal divisor, int scale,
- RoundingMode roundingMode) {
- // Let be: this = [u1,s1] and divisor = [u2,s2]
+ public BigDecimal divide(BigDecimal divisor, int scale, RoundingMode roundingMode) {
+ // Let be: this = [u1,s1] and divisor = [u2,s2]
if (roundingMode == null) {
throw new NullPointerException();
}
@@ -1179,7 +1185,6 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
scale,
roundingMode);
}
-
}
}
@@ -1251,8 +1256,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a new {@code BigDecimal} whose value is {@code this / divisor}.
- * The scale of the result is the scale of this. If rounding is required to
- * meet the specified scale, then the specified rounding mode
+ * The scale of the result is the scale of {@code this}. If rounding is
+ * required to meet the specified scale, then the specified rounding mode
* {@code roundingMode} is applied.
*
* @param divisor
@@ -1262,14 +1267,15 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* @return {@code this / divisor} rounded according to the given rounding
* mode.
* @throws NullPointerException
- * if divisor == null
+ * if {@code divisor == null}.
* @throws IllegalArgumentException
- * if roundingMode is not a valid rounding mode
+ * if {@code roundingMode} is not a valid rounding mode.
* @throws ArithmeticException
- * if divisor == 0
+ * if {@code divisor == 0}.
* @throws ArithmeticException
- * if roundingMode == ROUND_UNNECESSARY and rounding is
+ * if {@code roundingMode == ROUND_UNNECESSARY} and rounding is
* necessary according to the scale of this.
+ * @since Android 1.0
*/
public BigDecimal divide(BigDecimal divisor, int roundingMode) {
return divide(divisor, scale, RoundingMode.valueOf(roundingMode));
@@ -1277,8 +1283,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a new {@code BigDecimal} whose value is {@code this / divisor}.
- * The scale of the result is the scale of this. If rounding is required to
- * meet the specified scale, then the specified rounding mode
+ * The scale of the result is the scale of {@code this}. If rounding is
+ * required to meet the specified scale, then the specified rounding mode
* {@code roundingMode} is applied.
*
* @param divisor
@@ -1288,12 +1294,13 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* @return {@code this / divisor} rounded according to the given rounding
* mode.
* @throws NullPointerException
- * if divisor == null or roundingMode == null
+ * if {@code divisor == null} or {@code roundingMode == null}.
* @throws ArithmeticException
- * if divisor == 0
+ * if {@code divisor == 0}.
* @throws ArithmeticException
- * if roundingMode == RoundingMode.UNNECESSARY and rounding is
- * necessary according to the scale of this.
+ * if {@code roundingMode == RoundingMode.UNNECESSARY} and
+ * rounding is necessary according to the scale of this.
+ * @since Android 1.0
*/
public BigDecimal divide(BigDecimal divisor, RoundingMode roundingMode) {
return divide(divisor, scale, roundingMode);
@@ -1301,20 +1308,21 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a new {@code BigDecimal} whose value is {@code this / divisor}.
- * The scale of the result is the difference of the scales of this and
- * divisor. If the exact result requires more digits, then the scale is
- * adjusted accordingly. For example, 1/128 = 0.0078125 which has a scale of
- * 7 and precision 5.
+ * The scale of the result is the difference of the scales of {@code this}
+ * and {@code divisor}. If the exact result requires more digits, then the
+ * scale is adjusted accordingly. For example, {@code 1/128 = 0.0078125}
+ * which has a scale of {@code 7} and precision {@code 5}.
*
* @param divisor
* value by which {@code this} is divided.
* @return {@code this / divisor}.
* @throws NullPointerException
- * if divisor == null
+ * if {@code divisor == null}.
* @throws ArithmeticException
- * if divisor == 0
+ * if {@code divisor == 0}.
* @throws ArithmeticException
- * if the result cannot be represented exactly
+ * if the result cannot be represented exactly.
+ * @since Android 1.0
*/
public BigDecimal divide(BigDecimal divisor) {
BigInteger p = this.getUnscaledValue();
@@ -1380,8 +1388,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a new {@code BigDecimal} whose value is {@code this / divisor}.
* The result is rounded according to the passed context {@code mc}. If the
- * passed math context specifies precision 0, then this call is equivalent
- * to {@code this.divide(divisor)}.
+ * passed math context specifies precision {@code 0}, then this call is
+ * equivalent to {@code this.divide(divisor)}.
*
* @param divisor
* value by which {@code this} is divided.
@@ -1389,12 +1397,13 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* rounding mode and precision for the result of this operation.
* @return {@code this / divisor}.
* @throws NullPointerException
- * if divisor == null or mc == null
+ * if {@code divisor == null} or {@code mc == null}.
* @throws ArithmeticException
- * if divisor == 0
+ * if {@code divisor == 0}.
* @throws ArithmeticException
- * if mc.getRoundingMode() == UNNECESSARY and rounding is
- * necessary according to mc.getPrecision()
+ * if {@code mc.getRoundingMode() == UNNECESSARY} and rounding
+ * is necessary according {@code mc.getPrecision()}.
+ * @since Android 1.0
*/
public BigDecimal divide(BigDecimal divisor, MathContext mc) {
/* Calculating how many zeros must be append to 'dividend'
@@ -1454,17 +1463,16 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a new {@code BigDecimal} whose value is the integral part of
* {@code this / divisor}. The quotient is rounded down towards zero to the
- * next integer. For example, 0.5/0.2 = 2.
+ * next integer. For example, {@code 0.5/0.2 = 2}.
*
* @param divisor
* value by which {@code this} is divided.
- *
* @return integral part of {@code this / divisor}.
- *
* @throws NullPointerException
- * if divisor == null
+ * if {@code divisor == null}.
* @throws ArithmeticException
- * if divisor == 0
+ * if {@code divisor == 0}.
+ * @since Android 1.0
*/
public BigDecimal divideToIntegralValue(BigDecimal divisor) {
BigInteger integralValue; // the integer of result
@@ -1521,24 +1529,23 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* Returns a new {@code BigDecimal} whose value is the integral part of
* {@code this / divisor}. The quotient is rounded down towards zero to the
* next integer. The rounding mode passed with the parameter {@code mc} is
- * not considered. But if the precision of {@code mc} > 0 and the integral
- * part requires more digits, then an ArithmeticException is thrown.
+ * not considered. But if the precision of {@code mc > 0} and the integral
+ * part requires more digits, then an {@code ArithmeticException} is thrown.
*
* @param divisor
* value by which {@code this} is divided.
* @param mc
* math context which determines the maximal precision of the
* result.
- *
* @return integral part of {@code this / divisor}.
- *
* @throws NullPointerException
- * if divisor == null or mc == null.
+ * if {@code divisor == null} or {@code mc == null}.
* @throws ArithmeticException
- * if divisor == 0
+ * if {@code divisor == 0}.
* @throws ArithmeticException
- * if mc.getPrecision() > 0 and the result requires more digits
- * to be represented.
+ * if {@code mc.getPrecision() > 0} and the result requires more
+ * digits to be represented.
+ * @since Android 1.0
*/
public BigDecimal divideToIntegralValue(BigDecimal divisor, MathContext mc) {
int mcPrecision = mc.getPrecision();
@@ -1552,7 +1559,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
if ((mcPrecision == 0) || (this.isZero()) || (divisor.isZero())) {
return this.divideToIntegralValue(divisor);
}
- // Let be: this = [u1,s1] and divisor = [u2,s2]
+ // Let be: this = [u1,s1] and divisor = [u2,s2]
if (quotPrecision <= 0) {
quotAndRem[0] = BigInteger.ZERO;
} else if (diffScale == 0) {
@@ -1633,19 +1640,18 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a new {@code BigDecimal} whose value is {@code this % divisor}.
- *
- * The remainder is defined as
- * {@code this - this.divideToIntegralValue(divisor) * divisor}.
+ * <p>
+ * The remainder is defined as {@code this -
+ * this.divideToIntegralValue(divisor) * divisor}.
*
* @param divisor
* value by which {@code this} is divided.
- *
* @return {@code this % divisor}.
- *
* @throws NullPointerException
- * if divisor == null
+ * if {@code divisor == null}.
* @throws ArithmeticException
- * if divisor == 0
+ * if {@code divisor == 0}.
+ * @since Android 1.0
*/
public BigDecimal remainder(BigDecimal divisor) {
return divideAndRemainder(divisor)[1];
@@ -1653,27 +1659,26 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a new {@code BigDecimal} whose value is {@code this % divisor}.
- *
- * The remainder is defined as
- * {@code this - this.divideToIntegralValue(divisor) * divisor}.
- *
+ * <p>
+ * The remainder is defined as {@code this -
+ * this.divideToIntegralValue(divisor) * divisor}.
+ * <p>
* The specified rounding mode {@code mc} is used for the division only.
*
* @param divisor
* value by which {@code this} is divided.
* @param mc
* rounding mode and precision to be used.
- *
* @return {@code this % divisor}.
- *
* @throws NullPointerException
- * if divisor == null
+ * if {@code divisor == null}.
* @throws ArithmeticException
- * if divisor == 0
+ * if {@code divisor == 0}.
* @throws ArithmeticException
- * if mc.getPrecision() > 0 and the result of
- * {@code this.divideToIntegralValue(divisor, mc)} requires more
- * digits to be represented.
+ * if {@code mc.getPrecision() > 0} and the result of {@code
+ * this.divideToIntegralValue(divisor, mc)} requires more digits
+ * to be represented.
+ * @since Android 1.0
*/
public BigDecimal remainder(BigDecimal divisor, MathContext mc) {
return divideAndRemainder(divisor, mc)[1];
@@ -1681,21 +1686,21 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a {@code BigDecimal} array which contains the integral part of
- * {@code this / divisor} at index 0 and the remainder
- * {@code this % divisor} at index 1. The quotient is rounded down towards
- * zero to the next integer.
+ * {@code this / divisor} at index 0 and the remainder {@code this %
+ * divisor} at index 1. The quotient is rounded down towards zero to the
+ * next integer.
*
* @param divisor
* value by which {@code this} is divided.
- *
- * @return {@code [this.divideToIntegralValue(divisor), this.remainder(divisor)]}.
- *
+ * @return {@code [this.divideToIntegralValue(divisor),
+ * this.remainder(divisor)]}.
* @throws NullPointerException
- * if divisor == null
+ * if {@code divisor == null}.
* @throws ArithmeticException
- * if divisor == 0
+ * if {@code divisor == 0}.
* @see #divideToIntegralValue
* @see #remainder
+ * @since Android 1.0
*/
public BigDecimal[] divideAndRemainder(BigDecimal divisor) {
BigDecimal quotAndRem[] = new BigDecimal[2];
@@ -1707,27 +1712,26 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a {@code BigDecimal} array which contains the integral part of
- * {@code this / divisor} at index 0 and the remainder
- * {@code this % divisor} at index 1. The quotient is rounded down towards
- * zero to the next integer. The rounding mode passed with the parameter
- * {@code mc} is not considered. But if the precision of {@code mc} > 0 and
- * the integral part requires more digits, then an ArithmeticException is
- * thrown.
+ * {@code this / divisor} at index 0 and the remainder {@code this %
+ * divisor} at index 1. The quotient is rounded down towards zero to the
+ * next integer. The rounding mode passed with the parameter {@code mc} is
+ * not considered. But if the precision of {@code mc > 0} and the integral
+ * part requires more digits, then an {@code ArithmeticException} is thrown.
*
* @param divisor
* value by which {@code this} is divided.
* @param mc
* math context which determines the maximal precision of the
* result.
- *
- * @return {@code [this.divideToIntegralValue(divisor), this.remainder(divisor)]}.
- *
+ * @return {@code [this.divideToIntegralValue(divisor),
+ * this.remainder(divisor)]}.
* @throws NullPointerException
- * if divisor == null
+ * if {@code divisor == null}.
* @throws ArithmeticException
- * if divisor == 0
+ * if {@code divisor == 0}.
* @see #divideToIntegralValue
* @see #remainder
+ * @since Android 1.0
*/
public BigDecimal[] divideAndRemainder(BigDecimal divisor, MathContext mc) {
BigDecimal quotAndRem[] = new BigDecimal[2];
@@ -1739,16 +1743,19 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a new {@code BigDecimal} whose value is {@code this ^ n}. The
- * scale of the result is n times the scales of this. x.pow(0) returns 1,
- * even if x == 0.
+ * scale of the result is {@code n} times the scales of {@code this}.
+ * <p>
+ * {@code x.pow(0)} returns {@code 1}, even if {@code x == 0}.
+ * <p>
+ * Implementation Note: The implementation is based on the ANSI standard
+ * X3.274-1996 algorithm.
*
* @param n
* exponent to which {@code this} is raised.
- *
* @return {@code this ^ n}.
- *
* @throws ArithmeticException
- * if n < 0 or n > 999999999
+ * if {@code n < 0} or {@code n > 999999999}.
+ * @since Android 1.0
*/
public BigDecimal pow(int n) {
if (n == 0) {
@@ -1767,18 +1774,19 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a new {@code BigDecimal} whose value is {@code this ^ n}. The
- * result is rounded according to the passed context {@code mc}. TODO add
- * algorithm description
+ * result is rounded according to the passed context {@code mc}.
+ * <p>
+ * Implementation Note: The implementation is based on the ANSI standard
+ * X3.274-1996 algorithm.
*
* @param n
* exponent to which {@code this} is raised.
* @param mc
* rounding mode and precision for the result of this operation.
- *
* @return {@code this ^ n}.
- *
* @throws ArithmeticException
- * if n < 0 or n > 999999999
+ * if {@code n < 0} or {@code n > 999999999}.
+ * @since Android 1.0
*/
public BigDecimal pow(int n, MathContext mc) {
// The ANSI standard X3.274-1996 algorithm
@@ -1827,6 +1835,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* {@code this}. The scale of the result is the same as the scale of this.
*
* @return {@code abs(this)}
+ * @since Android 1.0
*/
public BigDecimal abs() {
return ((signum() < 0) ? negate() : this);
@@ -1839,18 +1848,23 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
*
* @param mc
* rounding mode and precision for the result of this operation.
- *
* @return {@code abs(this)}
+ * @since Android 1.0
*/
public BigDecimal abs(MathContext mc) {
- return round(mc).abs();
+ // BEGIN android-changed
+ BigDecimal result = abs();
+ result.inplaceRound(mc);
+ return result;
+ // END android-changed
}
/**
* Returns a new {@code BigDecimal} whose value is the {@code -this}. The
* scale of the result is the same as the scale of this.
*
- * @return {@code -this}.
+ * @return {@code -this}
+ * @since Android 1.0
*/
public BigDecimal negate() {
if(bitLength < 63 || (bitLength == 63 && smallValue!=Long.MIN_VALUE)) {
@@ -1865,30 +1879,36 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
*
* @param mc
* rounding mode and precision for the result of this operation.
- *
- * @return {@code -this}.
+ * @return {@code -this}
+ * @since Android 1.0
*/
public BigDecimal negate(MathContext mc) {
- return round(mc).negate();
+ // BEGIN android-changed
+ BigDecimal result = negate();
+ result.inplaceRound(mc);
+ return result;
+ // END android-changed
}
/**
* Returns a new {@code BigDecimal} whose value is {@code +this}. The scale
* of the result is the same as the scale of this.
*
- * @return this.
+ * @return {@code this}
+ * @since Android 1.0
*/
public BigDecimal plus() {
return this;
}
/**
- * Returns a new {@code BigDecimal} whose value is {@code +this}. The
- * result is rounded according to the passed context {@code mc}.
+ * Returns a new {@code BigDecimal} whose value is {@code +this}. The result
+ * is rounded according to the passed context {@code mc}.
*
* @param mc
* rounding mode and precision for the result of this operation.
- * @return this.
+ * @return {@code this}
+ * @since Android 1.0
*/
public BigDecimal plus(MathContext mc) {
return round(mc);
@@ -1897,8 +1917,10 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns the sign of this {@code BigDecimal}.
*
- * @return -1 if {@code this < 0}, 0 if {@code this == 0}, 1 if
- * {@code this > 0}.
+ * @return {@code -1} if {@code this < 0},
+ * {@code 0} if {@code this == 0},
+ * {@code 1} if {@code this > 0}.
+ * @since Android 1.0
*/
public int signum() {
if( bitLength < 64) {
@@ -1915,10 +1937,11 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns the scale of this {@code BigDecimal}. The scale is the number of
* digits behind the decimal point. The value of this {@code BigDecimal} is
- * the unsignedValue * 10^{-scale}. If the scale is negative, then this
+ * the unsignedValue * 10^(-scale). If the scale is negative, then this
* {@code BigDecimal} represents a big integer.
*
* @return the scale of this {@code BigDecimal}.
+ * @since Android 1.0
*/
public int scale() {
return scale;
@@ -1927,10 +1950,11 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns the precision of this {@code BigDecimal}. The precision is the
* number of decimal digits used to represent this decimal. It is equivalent
- * to the number of digits of tue unscaled value. The precision of 0 is 1
- * (independent of the scale).
+ * to the number of digits of the unscaled value. The precision of {@code 0}
+ * is {@code 1} (independent of the scale).
*
* @return the precision of this {@code BigDecimal}.
+ * @since Android 1.0
*/
public int precision() {
// Checking if the precision already was calculated
@@ -1964,10 +1988,11 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns the unscaled value (mantissa) of this {@code BigDecimal} instance
- * as a {@code BigInteger}. The unscaled value can be computed as this *
- * 10^{scale}.
+ * as a {@code BigInteger}. The unscaled value can be computed as {@code
+ * this} 10^(scale).
*
* @return unscaled value (this * 10^(scale)).
+ * @since Android 1.0
*/
public BigInteger unscaledValue() {
return getUnscaledValue();
@@ -1976,21 +2001,21 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a new {@code BigDecimal} whose value is {@code this}, rounded
* according to the passed context {@code mc}.
- *
- * If mc.precision = 0, then no rounding.
- *
- * If mc.precision > 0 and mc.roundingMode == UNNECESSARY, then an
- * ArithmeticException is thrown if the result cannot be represented exactly
- * within the given precision.
+ * <p>
+ * If {@code mc.precision = 0}, then no rounding is performed.
+ * <p>
+ * If {@code mc.precision > 0} and {@code mc.roundingMode == UNNECESSARY},
+ * then an {@code ArithmeticException} is thrown if the result cannot be
+ * represented exactly within the given precision.
*
* @param mc
* rounding mode and precision for the result of this operation.
- *
- * @return this rounded according to the passed context.
- *
+ * @return {@code this} rounded according to the passed context.
* @throws ArithmeticException
- * if mc.precision > 0 and mc.roundingMode == UNNECESSARY and
- * this cannot be represented within the given precision.
+ * if {@code mc.precision > 0} and {@code mc.roundingMode ==
+ * UNNECESSARY} and this cannot be represented within the given
+ * precision.
+ * @since Android 1.0
*/
public BigDecimal round(MathContext mc) {
BigDecimal thisBD = new BigDecimal(getUnscaledValue(), scale);
@@ -2001,10 +2026,10 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a new {@code BigDecimal} instance with the specified scale.
- *
- * If new new scale is greater than the old scale, then additional zeros are
+ * <p>
+ * If the new scale is greater than the old scale, then additional zeros are
* added to the unscaled value. In this case no rounding is necessary.
- *
+ * <p>
* If the new scale is smaller than the old scale, then trailing digits are
* removed. If these trailing digits are not zero, then the remaining
* unscaled value has to be rounded. For this rounding operation the
@@ -2014,14 +2039,13 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* scale of the result returned.
* @param roundingMode
* rounding mode to be used to round the result.
- *
* @return a new {@code BigDecimal} instance with the specified scale.
- *
* @throws NullPointerException
- * if roundingMode == null
+ * if {@code roundingMode == null}.
* @throws ArithmeticException
- * if roundingMode == ROUND_UNNECESSARY and rounding is
+ * if {@code roundingMode == ROUND_UNNECESSARY} and rounding is
* necessary according to the given scale.
+ * @since Android 1.0
*/
public BigDecimal setScale(int newScale, RoundingMode roundingMode) {
if (roundingMode == null) {
@@ -2050,10 +2074,10 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a new {@code BigDecimal} instance with the specified scale.
- *
- * If new new scale is greater than the old scale, then additional zeros are
+ * <p>
+ * If the new scale is greater than the old scale, then additional zeros are
* added to the unscaled value. In this case no rounding is necessary.
- *
+ * <p>
* If the new scale is smaller than the old scale, then trailing digits are
* removed. If these trailing digits are not zero, then the remaining
* unscaled value has to be rounded. For this rounding operation the
@@ -2063,14 +2087,13 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* scale of the result returned.
* @param roundingMode
* rounding mode to be used to round the result.
- *
* @return a new {@code BigDecimal} instance with the specified scale.
- *
* @throws IllegalArgumentException
- * if roundingMode is not a valid rounding mode
+ * if {@code roundingMode} is not a valid rounding mode.
* @throws ArithmeticException
- * if roundingMode == ROUND_UNNECESSARY and rounding is
+ * if {@code roundingMode == ROUND_UNNECESSARY} and rounding is
* necessary according to the given scale.
+ * @since Android 1.0
*/
public BigDecimal setScale(int newScale, int roundingMode) {
return setScale(newScale, RoundingMode.valueOf(roundingMode));
@@ -2078,21 +2101,20 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a new {@code BigDecimal} instance with the specified scale. If
- * new new scale is greater than the old scale, then additional zeros are
+ * the new scale is greater than the old scale, then additional zeros are
* added to the unscaled value. If the new scale is smaller than the old
* scale, then trailing zeros are removed. If the trailing digits are not
* zeros then an ArithmeticException is thrown.
- *
- * If no exception is thrown, then the following equation holds:
- * x.setScale(s).compareTo(x) == 0
+ * <p>
+ * If no exception is thrown, then the following equation holds: {@code
+ * x.setScale(s).compareTo(x) == 0}.
*
* @param newScale
* scale of the result returned.
- *
* @return a new {@code BigDecimal} instance with the specified scale.
- *
* @throws ArithmeticException
* if rounding would be necessary.
+ * @since Android 1.0
*/
public BigDecimal setScale(int newScale) {
return setScale(newScale, RoundingMode.UNNECESSARY);
@@ -2100,23 +2122,23 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a new {@code BigDecimal} instance where the decimal point has
- * been moved {@code n} places to the left. If n < 0 then the decimal point
- * is moved -n places to the right.
- *
+ * been moved {@code n} places to the left. If {@code n < 0} then the
+ * decimal point is moved {@code -n} places to the right.
+ * <p>
* The result is obtained by changing its scale. If the scale of the result
* becomes negative, then its precision is increased such that the scale is
* zero.
- *
+ * <p>
* Note, that {@code movePointLeft(0)} returns a result which is
- * mathematically equivalent, but which has scale >= 0.
+ * mathematically equivalent, but which has {@code scale >= 0}.
*
* @param n
* number of placed the decimal point has to be moved.
- *
- * @return this * 10^{-n}.
+ * @return {@code this} 10^({@code -n}).
+ * @since Android 1.0
*/
public BigDecimal movePointLeft(int n) {
- return movePoint(scale + (long) n);
+ return movePoint(scale + (long)n);
}
private BigDecimal movePoint(long newScale) {
@@ -2142,37 +2164,37 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a new {@code BigDecimal} instance where the decimal point has
- * been moved {@code n} places to the right. If n < 0 then the decimal point
- * is moved -n places to the left.
- *
+ * been moved {@code n} places to the right. If {@code n < 0} then the
+ * decimal point is moved {@code -n} places to the left.
+ * <p>
* The result is obtained by changing its scale. If the scale of the result
* becomes negative, then its precision is increased such that the scale is
* zero.
- *
+ * <p>
* Note, that {@code movePointRight(0)} returns a result which is
* mathematically equivalent, but which has scale >= 0.
*
* @param n
* number of placed the decimal point has to be moved.
- *
- * @return this * 10^{n}.
+ * @return {@code this} 10^{@code n}.
+ * @since Android 1.0
*/
public BigDecimal movePointRight(int n) {
return movePoint(scale - (long)n);
}
/**
- * Returns a new {@code BigDecimal} whose value is {@code this} * 10^{@code n}.
- * The scale of the result is {@code this.scale()} - n. The precision of the
- * result is the precision of {@code this}.
- *
- * This method has the same effect as movePointLeft, except that the
- * precision is not changed.
+ * Returns a new {@code BigDecimal} whose value is {@code this} 10^{@code n}.
+ * The scale of the result is {@code this.scale()} - {@code n}.
+ * The precision of the result is the precision of {@code this}.
+ * <p>
+ * This method has the same effect as {@link #movePointRight}, except that
+ * the precision is not changed.
*
* @param n
- * number of placed the decimal point has to be moved.
- *
- * @return this * 10^{-n}.
+ * number of places the decimal point has to be moved.
+ * @return {@code this} 10^{@code n}
+ * @since Android 1.0
*/
public BigDecimal scaleByPowerOfTen(int n) {
long newScale = scale - (long)n;
@@ -2187,13 +2209,14 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
}
/**
- * Returns a new {@code BigDecimal} instance with the same value as this but
- * with a unscaled value where the trailing zeros have been removed. If the
- * unscaled value of {@code this} has n trailing zeros, then the scale and
- * the precision of the result has been reduced by n.
+ * Returns a new {@code BigDecimal} instance with the same value as {@code
+ * this} but with a unscaled value where the trailing zeros have been
+ * removed. If the unscaled value of {@code this} has n trailing zeros, then
+ * the scale and the precision of the result has been reduced by n.
*
* @return a new {@code BigDecimal} instance equivalent to this where the
* trailing zeros of the unscaled value have been removed.
+ * @since Android 1.0
*/
public BigDecimal stripTrailingZeros() {
int i = 1; // 1 <= i <= 18
@@ -2201,7 +2224,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
long newScale = scale;
if (isZero()) {
+ // BEGIN android-changed
return new BigDecimal("0");
+ // END android-changed
}
BigInteger strippedBI = getUnscaledValue();
BigInteger[] quotAndRem;
@@ -2233,20 +2258,20 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Compares this {@code BigDecimal} with {@code val}. Returns one of the
- * three values 1, 0, or -1. The method behaves as if this.subtract(val) is
- * computed. If this difference is > 0 then 1 is returned, if the difference
- * is < 0 then -1 is returned, and if the difference is 0 then 0 is
- * returned. This means, that if two decimal instances are compared which
- * are equal in value but differ in scale, then these two instances are
- * considered as equal.
+ * three values {@code 1}, {@code 0}, or {@code -1}. The method behaves as
+ * if {@code this.subtract(val)} is computed. If this difference is > 0 then
+ * 1 is returned, if the difference is < 0 then -1 is returned, and if the
+ * difference is 0 then 0 is returned. This means, that if two decimal
+ * instances are compared which are equal in value but differ in scale, then
+ * these two instances are considered as equal.
*
* @param val
* value to be compared with {@code this}.
- *
- * @return 1 if this > val, -1 if this < val, 0 if this == val.
- *
+ * @return {@code 1} if {@code this > val}, {@code -1} if {@code this < val},
+ * {@code 0} if {@code this == val}.
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}.
+ * @since Android 1.0
*/
public int compareTo(BigDecimal val) {
int thisSign = signum();
@@ -2281,16 +2306,16 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
}
/**
- * Returns {@code true} if {@code x} is a BigDecimal instance and if this
- * instance is equal to this {@code BigDecimal}. Two big decimals are equal
- * if their unscaled value and their scale is equal. For example, 1.0
+ * Returns {@code true} if {@code x} is a {@code BigDecimal} instance and if
+ * this instance is equal to this big decimal. Two big decimals are equal if
+ * their unscaled value and their scale is equal. For example, 1.0
* (10*10^(-1)) is not equal to 1.00 (100*10^(-2)). Similarly, zero
* instances are not equal if their scale differs.
*
* @param x
* object to be compared with {@code this}.
- *
- * @return true if x is a BigDecimal and this == x.
+ * @return true if {@code x} is a {@code BigDecimal} and {@code this == x}.
+ * @since Android 1.0
*/
@Override
public boolean equals(Object x) {
@@ -2298,14 +2323,15 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
return true;
}
if (x instanceof BigDecimal) {
- BigDecimal x1 = (BigDecimal) x;
- return x1.scale == scale
- && (bitLength < 64 ? (x1.smallValue == smallValue) : intVal
- .equals(x1.intVal));
-
- }
- return false;
- }
+ BigDecimal x1 = (BigDecimal) x;
+ return x1.scale == scale
+ && (bitLength < 64 ? (x1.smallValue == smallValue)
+ : intVal.equals(x1.intVal));
+
+
+ }
+ return false;
+ }
/**
* Returns the minimum of this {@code BigDecimal} and {@code val}.
@@ -2313,9 +2339,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* @param val
* value to be used to compute the minimum with this.
* @return {@code min(this, val}.
- *
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}.
+ * @since Android 1.0
*/
public BigDecimal min(BigDecimal val) {
return ((compareTo(val) <= 0) ? this : val);
@@ -2327,9 +2353,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* @param val
* value to be used to compute the maximum with this.
* @return {@code max(this, val}.
- *
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}.
+ * @since Android 1.0
*/
public BigDecimal max(BigDecimal val) {
return ((compareTo(val) >= 0) ? this : val);
@@ -2338,10 +2364,11 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a hash code for this {@code BigDecimal}.
*
- * @return hash code for this.
+ * @return hash code for {@code this}.
+ * @since Android 1.0
*/
@Override
- public int hashCode() {
+ public int hashCode() {
if (hashCode != 0) {
return hashCode;
}
@@ -2351,20 +2378,21 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
hashCode = 17 * hashCode + scale;
return hashCode;
}
- hashCode = 17 * intVal.hashCode() + scale;
- return hashCode;
+ hashCode = 17 * intVal.hashCode() + scale;
+ return hashCode;
}
/**
* Returns a canonical string representation of this {@code BigDecimal}. If
* necessary, scientific notation is used. This representation always prints
* all significant digits of this value.
- *
- * If the scale is negative or if scale - precision >= 6 then scientific
- * notation is used.
+ * <p>
+ * If the scale is negative or if {@code scale - precision >= 6} then
+ * scientific notation is used.
*
* @return a string representation of {@code this} in scientific notation if
* necessary.
+ * @since Android 1.0
*/
@Override
public String toString() {
@@ -2410,14 +2438,15 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Returns a string representation of this {@code BigDecimal}. This
* representation always prints all significant digits of this value.
- *
- * If the scale is negative or if scale - precision >= 6 then engineering
- * notation is used. Engineering notation is similar to the scientific
- * notation except that the exponent is made to be a multiple of 3 such that
- * the integer part is >= 1 and < 1000.
+ * <p>
+ * If the scale is negative or if {@code scale - precision >= 6} then
+ * engineering notation is used. Engineering notation is similar to the
+ * scientific notation except that the exponent is made to be a multiple of
+ * 3 such that the integer part is >= 1 and < 1000.
*
* @return a string representation of {@code this} in engineering notation
* if necessary.
+ * @since Android 1.0
*/
public String toEngineeringString() {
String intString = getUnscaledValue().toString();
@@ -2474,18 +2503,20 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
}
/**
- * Returns a string representation of this {@code BigDecimal}. No
- * scientific notation is used. This methods adds zeros where necessary.
- *
+ * Returns a string representation of this {@code BigDecimal}. No scientific
+ * notation is used. This methods adds zeros where necessary.
+ * <p>
* If this string representation is used to create a new instance, this
* instance is generally not identical to {@code this} as the precision
* changes.
- *
- * x.equals(new BigDecimal(x.toPlainString()) usually returns false.
- *
- * x.compareTo(new BigDecimal(x.toPlainString()) returns 0.
+ * <p>
+ * {@code x.equals(new BigDecimal(x.toPlainString())} usually returns
+ * {@code false}.
+ * <p>
+ * {@code x.compareTo(new BigDecimal(x.toPlainString())} returns {@code 0}.
*
* @return a string representation of {@code this} without exponent part.
+ * @since Android 1.0
*/
public String toPlainString() {
String intStr = getUnscaledValue().toString();
@@ -2498,7 +2529,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
StringBuffer result = new StringBuffer(intStr.length() + 1 + Math.abs(scale));
if (begin == 1) {
- // If the number is negative, we insert a '-' character at front
+ // If the number is negative, we insert a '-' character at front
result.append('-');
}
if (scale > 0) {
@@ -2533,6 +2564,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* part is discarded.
*
* @return this {@code BigDecimal} as a big integer instance.
+ * @since Android 1.0
*/
public BigInteger toBigInteger() {
if ((scale == 0) || (isZero())) {
@@ -2552,6 +2584,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* @return this {@code BigDecimal} as a big integer value.
* @throws ArithmeticException
* if rounding is necessary.
+ * @since Android 1.0
*/
public BigInteger toBigIntegerExact() {
if ((scale == 0) || (isZero())) {
@@ -2581,6 +2614,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* represented as an long, then {@code this} % 2^64 is returned.
*
* @return this {@code BigDecimal} as a long value.
+ * @since Android 1.0
*/
@Override
public long longValue() {
@@ -2601,6 +2635,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* @return this {@code BigDecimal} as a long value.
* @throws ArithmeticException
* if rounding is necessary or the number doesn't fit in a long.
+ * @since Android 1.0
*/
public long longValueExact() {
return valueExact(64);
@@ -2612,6 +2647,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* represented as an int, then {@code this} % 2^32 is returned.
*
* @return this {@code BigDecimal} as a int value.
+ * @since Android 1.0
*/
@Override
public int intValue() {
@@ -2620,7 +2656,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* 10^(-scale). If the scale is positive and very large the long value
* could be zero.
*/
- return ((scale <= -32) || (scale > aproxPrecision()) ? 0
+ return ((scale <= -32) || (scale > aproxPrecision())
+ ? 0
: toBigInteger().intValue());
}
@@ -2630,9 +2667,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* these conditions are not met, an {@code ArithmeticException} is thrown.
*
* @return this {@code BigDecimal} as a int value.
- *
* @throws ArithmeticException
* if rounding is necessary or the number doesn't fit in a int.
+ * @since Android 1.0
*/
public int intValueExact() {
return (int)valueExact(32);
@@ -2644,10 +2681,10 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* these conditions are not met, an {@code ArithmeticException} is thrown.
*
* @return this {@code BigDecimal} as a short value.
- *
* @throws ArithmeticException
* if rounding is necessary of the number doesn't fit in a
* short.
+ * @since Android 1.0
*/
public short shortValueExact() {
return (short)valueExact(16);
@@ -2659,9 +2696,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* conditions are not met, an {@code ArithmeticException} is thrown.
*
* @return this {@code BigDecimal} as a byte value.
- *
* @throws ArithmeticException
* if rounding is necessary or the number doesn't fit in a byte.
+ * @since Android 1.0
*/
public byte byteValueExact() {
return (byte)valueExact(8);
@@ -2671,19 +2708,20 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* Returns this {@code BigDecimal} as a float value. If {@code this} is too
* big to be represented as an float, then {@code Float.POSITIVE_INFINITY}
* or {@code Float.NEGATIVE_INFINITY} is returned.
- *
+ * <p>
* Note, that if the unscaled value has more than 24 significant digits,
* then this decimal cannot be represented exactly in a float variable. In
* this case the result is rounded.
- *
+ * <p>
* For example, if the instance {@code x1 = new BigDecimal("0.1")} cannot be
- * represented exactly as a float, and thus x1.equals(new
- * BigDecimal(x1.folatValue()) returns false for this case.
- *
+ * represented exactly as a float, and thus {@code x1.equals(new
+ * BigDecimal(x1.folatValue())} returns {@code false} for this case.
+ * <p>
* Similarly, if the instance {@code new BigDecimal(16777217)} is converted
- * to a float, the result is 1.6777216E7.
+ * to a float, the result is {@code 1.6777216E}7.
*
* @return this {@code BigDecimal} as a float value.
+ * @since Android 1.0
*/
@Override
public float floatValue() {
@@ -2707,19 +2745,21 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* Returns this {@code BigDecimal} as a double value. If {@code this} is too
* big to be represented as an float, then {@code Double.POSITIVE_INFINITY}
* or {@code Double.NEGATIVE_INFINITY} is returned.
- *
+ * <p>
* Note, that if the unscaled value has more than 53 significant digits,
* then this decimal cannot be represented exactly in a double variable. In
* this case the result is rounded.
- *
+ * <p>
* For example, if the instance {@code x1 = new BigDecimal("0.1")} cannot be
- * represented exactly as a double, and thus x1.equals(new
- * BigDecimal(x1.doubleValue()) returns false for this case.
- *
+ * represented exactly as a double, and thus {@code x1.equals(new
+ * BigDecimal(x1.doubleValue())} returns {@code false} for this case.
+ * <p>
* Similarly, if the instance {@code new BigDecimal(9007199254740993L)} is
- * converted to a double, the result is 9.007199254740992E15.
+ * converted to a double, the result is {@code 9.007199254740992E15}.
+ * <p>
*
* @return this {@code BigDecimal} as a double value.
+ * @since Android 1.0
*/
@Override
public double doubleValue() {
@@ -2771,13 +2811,13 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
// mantisa = (abs(u) * 10^s) >> (n - 54)
bits = mantisa.shiftRight(discardedSize).longValue();
tempBits = bits;
- // #bits = 54, to check if the discarded fraction produces a carry
+ // #bits = 54, to check if the discarded fraction produces a carry
if ((((bits & 1) == 1) && (lowestSetBit < discardedSize))
|| ((bits & 3) == 3)) {
bits += 2;
}
} else {// (n <= 54)
- // mantisa = (abs(u) * 10^s) << (54 - n)
+ // mantisa = (abs(u) * 10^s) << (54 - n)
bits = mantisa.longValue() << -discardedSize;
tempBits = bits;
// #bits = 54, to check if the discarded fraction produces a carry:
@@ -2795,7 +2835,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
bits >>= 2;
exponent += discardedSize + 1;
}
- // To test if the 53-bits number fits in 'double'
+ // To test if the 53-bits number fits in 'double'
if (exponent > 2046) {// (exponent - bias > 1023)
return (sign * Double.POSITIVE_INFINITY);
} else if (exponent <= 0) {// (exponent - bias <= -1023)
@@ -2803,7 +2843,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
if (exponent < -53) {// exponent - bias < -1076
return (sign * 0.0d);
}
- // -1076 <= exponent - bias <= -1023
+ // -1076 <= exponent - bias <= -1023
// To discard '- exponent + 1' bits
bits = tempBits >> 1;
tempBits = bits & (-1L >>> (63 + exponent));
@@ -2826,16 +2866,17 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
* Returns the unit in the last place (ULP) of this {@code BigDecimal}
* instance. An ULP is the distance to the nearest big decimal with the same
* precision.
- *
+ * <p>
* The amount of a rounding error in the evaluation of a floating-point
* operation is often expressed in ULPs. An error of 1 ULP is often seen as
* a tolerable error.
- *
- * For class BigDecimal, the ULP of a number is simply 10^{-scale}.
- *
+ * <p>
+ * For class {@code BigDecimal}, the ULP of a number is simply 10^(-scale).
+ * <p>
* For example, {@code new BigDecimal(0.1).ulp()} returns {@code 1E-55}.
*
* @return unit in the last place (ULP) of this {@code BigDecimal} instance.
+ * @since Android 1.0
*/
public BigDecimal ulp() {
return valueOf(1, scale);
@@ -2845,18 +2886,20 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* It does all rounding work of the public method
- * <code>round(MathContext)</code>, performing an inplace rounding
+ * {@code round(MathContext)}, performing an inplace rounding
* without creating a new object.
*
* @param mc
- * the <code>MathContext</code> for perform the rounding.
+ * the {@code MathContext} for perform the rounding.
* @see #round(MathContext)
*/
private void inplaceRound(MathContext mc) {
int mcPrecision = mc.getPrecision();
- if (aproxPrecision() - mcPrecision <= 0 || mcPrecision == 0) {
+ // BEGIN android-changed
+ if (aproxPrecision() < mcPrecision || mcPrecision == 0) {
return;
}
+ // END android-changed
int discardedPrecision = precision() - mcPrecision;
// If no rounding is necessary it returns immediately
if ((discardedPrecision <= 0)) {
@@ -2900,15 +2943,14 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
private static int longCompareTo(long value1, long value2) {
return value1 > value2 ? 1 : (value1 < value2 ? -1 : 0);
}
-
/**
* This method implements an efficient rounding for numbers which unscaled
- * value fits in the type <code>long</code>.
+ * value fits in the type {@code long}.
*
* @param mc
- * the context to use.
+ * the context to use
* @param discardedPrecision
- * the number of decimal digits that are discarded.
+ * the number of decimal digits that are discarded
* @see #round(MathContext)
*/
private void smallRound(MathContext mc, int discardedPrecision) {
@@ -2943,16 +2985,16 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* Return an increment that can be -1,0 or 1, depending of
- * <code>roundingMode</code>.
+ * {@code roundingMode}.
*
* @param parityBit
* can be 0 or 1, it's only used in the case
- * <code>HALF_EVEN</code>.
+ * {@code HALF_EVEN}
* @param fraction
- * the mantisa to be analyzed.
+ * the mantisa to be analyzed
* @param roundingMode
- * the type of rounding.
- * @return the carry propagated after rounding.
+ * the type of rounding
+ * @return the carry propagated after rounding
*/
private static int roundingBehavior(int parityBit, int fraction, RoundingMode roundingMode) {
int increment = 0; // the carry after rounding
@@ -2995,19 +3037,19 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
}
/**
- * If <code>intVal</code> has a fractional part throws an exception,
+ * If {@code intVal} has a fractional part throws an exception,
* otherwise it counts the number of bits of value and checks if it's out of
* the range of the primitive type. If the number fits in the primitive type
- * returns this number as <code>long</code>, otherwise throws an
+ * returns this number as {@code long}, otherwise throws an
* exception.
*
* @param bitLengthOfType
* number of bits of the type whose value will be calculated
- * exactly.
- * @return the exact value of the integer part of <code>BigDecimal</code>
- * when is possible.
- * @throws <code>ArithmeticException</code> when rounding is necessary or the
- * number don't fit in the primitive type.
+ * exactly
+ * @return the exact value of the integer part of {@code BigDecimal}
+ * when is possible
+ * @throws ArithmeticException when rounding is necessary or the
+ * number don't fit in the primitive type
*/
private long valueExact(int bitLengthOfType) {
BigInteger bigInteger = toBigIntegerExact();
@@ -3023,30 +3065,29 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* If the precision already was calculated it returns that value, otherwise
* it calculates a very good approximation efficiently . Note that this
- * value will be <code>precision()</code> or <code>precision()-1</code>
+ * value will be {@code precision()} or {@code precision()-1}
* in the worst case.
*
- * @return an approximation of <code>precision()</code> value
+ * @return an approximation of {@code precision()} value
*/
private int aproxPrecision() {
- // return ((precision > 0)
- // ? precision
- // : (int)((this.bitLength - 1) * LOG10_2)) + 1;
- return precision > 0
+ // BEGIN android-changed
+ return precision > 0
? precision
: (int) ((this.bitLength - 1) * LOG10_2) + 1;
+ // END android-changed
}
/**
- * It tests if a scale of type <code>long</code> fits in 32 bits. It
- * returns the same scale being casted to <code>int</code> type when is
+ * It tests if a scale of type {@code long} fits in 32 bits. It
+ * returns the same scale being casted to {@code int} type when is
* possible, otherwise throws an exception.
*
* @param longScale
- * a 64 bit scale.
- * @return a 32 bit scale when is possible.
- * @throws <code>ArithmeticException</code> when <code>scale</code> doesn't
- * fit in <code>int</code> type.
+ * a 64 bit scale
+ * @return a 32 bit scale when is possible
+ * @throws ArithmeticException when {@code scale} doesn't
+ * fit in {@code int} type
* @see #scale
*/
private static int toIntScale(long longScale) {
@@ -3063,15 +3104,15 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>, Serial
/**
* It returns the value 0 with the most approximated scale of type
- * <code>int</code>. if <code>longScale > Integer.MAX_VALUE</code> the
- * scale will be <code>Integer.MAX_VALUE</code>; if
- * <code>longScale < Integer.MIN_VALUE</code> the scale will be
- * <code>Integer.MIN_VALUE</code>; otherwise <code>longScale</code> is
- * casted to the type <code>int</code>.
+ * {@code int}. if {@code longScale > Integer.MAX_VALUE} the
+ * scale will be {@code Integer.MAX_VALUE}; if
+ * {@code longScale < Integer.MIN_VALUE} the scale will be
+ * {@code Integer.MIN_VALUE}; otherwise {@code longScale} is
+ * casted to the type {@code int}.
*
* @param longScale
* the scale to which the value 0 will be scaled.
- * @return the value 0 scaled by the closer scale of type <code>int</code>.
+ * @return the value 0 scaled by the closer scale of type {@code int}.
* @see #scale
*/
private static BigDecimal zeroScaledBy(long longScale) {
diff --git a/math/src/main/java/java/math/BigInt.java b/math/src/main/java/java/math/BigInt.java
index 4582e13..cb7990a 100644
--- a/math/src/main/java/java/math/BigInt.java
+++ b/math/src/main/java/java/math/BigInt.java
@@ -21,11 +21,11 @@ import org.openssl.NativeBN;
import java.util.Random;
-/**
+/*
* In contrast to BigIntegers this class doesn't fake two's complement representation.
* Any Bit-Operations, including Shifting, solely regard the unsigned magnitude.
* Moreover BigInt objects are mutable and offer efficient in-place-operations.
- **/
+ */
class BigInt
// extends Number
@@ -391,6 +391,12 @@ class BigInt
return r;
}
+ public static BigInt generatePrimeSafe(int bitLength, Random rnd, Context t) {
+ BigInt r = newBigInt();
+ Check(NativeBN.BN_generate_prime_ex(r.bignum, bitLength, true, 0, 0, 0));
+ return r;
+ }
+
public boolean isPrime(int certainty, Random rnd, Context t) {
return NativeBN.BN_is_prime_ex(bignum, certainty, getCtx(t), 0);
}
diff --git a/math/src/main/java/java/math/BigInteger.java b/math/src/main/java/java/math/BigInteger.java
index c66dff8..cfe9818 100644
--- a/math/src/main/java/java/math/BigInteger.java
+++ b/math/src/main/java/java/math/BigInteger.java
@@ -1,20 +1,4 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed 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.
- */
-
-/*
* 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.
@@ -30,13 +14,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
/*
- * Since the original Harmony Code of the BigInteger class was strongly modified,
- * in order to use the more efficient OpenSSL BIGNUM implementation,
- * no android-modification-tags were placed, at all.
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed 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.
*/
+// BEGIN android-note
+// Since the original Harmony Code of the BigInteger class was strongly modified,
+// in order to use the more efficient OpenSSL BIGNUM implementation,
+// no android-modification-tags were placed, at all.
+// END android-note
+
package java.math;
import java.io.IOException;
@@ -48,14 +47,29 @@ import java.io.Serializable;
import org.apache.harmony.math.internal.nls.Messages;
/**
- * Class which represents immutable arbitrary precision integer numbers.
- * This class provides methods for arithmetic operations and methods
- * for the comparison of two instances.
+ * This class represents immutable integer numbers of arbitrary length. Large
+ * numbers are typically used in security applications and therefore BigIntegers
+ * offer dedicated functionality like the generation of large prime numbers or
+ * the computation of modular inverse.
+ * <p>
+ * Since the class was modeled to offer all the functionality as the {@link Integer}
+ * class does, it provides even methods that operate bitwise on a two's
+ * complement representation of large integers. Note however that the
+ * implementations favors an internal representation where magnitude and sign
+ * are treated separately. Hence such operations are inefficient and should be
+ * discouraged. In simple words: Do NOT implement any bit fields based on
+ * BigInteger.
+ * <p>
+ * <b>Implementation Note:</b> <br>
+ * The native OpenSSL library with its BIGNUM operations covers all the
+ * meaningful functionality (everything but bit level operations).
+ *
+ * @since Android 1.0
*/
public class BigInteger extends Number implements Comparable<BigInteger>,
Serializable {
- /** This is the serialVersionUID used by the sun implementation */
+ /** This is the serialVersionUID used by the sun implementation. */
private static final long serialVersionUID = -8287574255936472291L;
transient BigInt bigInt;
@@ -64,8 +78,6 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
void establishOldRepresentation(String caller) {
if (!oldReprIsValid) {
-// System.out.print(" establishing OLD Repr NOW for ");
-// System.out.println(caller);
sign = bigInt.sign();
if (sign != 0) digits = bigInt.littleEndianIntsMagnitude();
else digits = new int[] { 0 };
@@ -79,8 +91,6 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
// It ensures that the new representation will be established on demand.
//
BigInteger withNewRepresentation(String caller) {
-// System.out.print("BigInteger.withNewRepresentation called by ");
-// System.out.println(caller);
bigIntIsValid = false;
return this;
}
@@ -93,55 +103,33 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
System.out.print("Claiming bigIntIsValid BUT bigInt.bignum == 0, ");
}
else {
-// System.out.print("Validating for ");
-// System.out.print(caller);
-// System.out.print(" @ ");
-// System.out.print(param);
-// System.out.print(": ");
-// System.out.print("bigInt is NOT valid, ");
-// if (bigInt == null) System.out.print("bigInt == null, ");
-// else if (bigInt.getNativeBIGNUM() == 0) System.out.print("bigInt.bignum == 0, ");
- if (oldReprIsValid) {
- // establishNewRepresentation();
-// System.out.println(" establishing NEW Repr FROM OLD NOW!");
-// if (bigInt != null) {
-// System.out.println(" EVENTHOUGH A NEW REPR ALREADY EXISTS!!!");
-// }
+ if (oldReprIsValid) { // establish new representation
if (bigInt == null) bigInt = new BigInt();
bigInt.putLittleEndianInts(digits, (sign < 0));
bigIntIsValid = true;
}
else {
-// System.out.println("AND oldRepr is NOT valid, either!");
throw new IllegalArgumentException(caller + ":" + param);
}
}
}
static void validate1(String caller, BigInteger a) {
-// System.out.print("Validating for ");
-// System.out.println(caller);
a.validate(caller, "1");
}
static void validate2(String caller, BigInteger a, BigInteger b) {
-// System.out.print("Validating for ");
-// System.out.println(caller);
a.validate(caller, "1");
b.validate(caller, "2");
}
static void validate3(String caller, BigInteger a, BigInteger b, BigInteger c) {
-// System.out.print("Validating for ");
-// System.out.println(caller);
a.validate(caller, "1");
b.validate(caller, "2");
c.validate(caller, "3");
}
static void validate4(String caller, BigInteger a, BigInteger b, BigInteger c, BigInteger d) {
-// System.out.print("Validating for ");
-// System.out.println(caller);
a.validate(caller, "1");
b.validate(caller, "2");
c.validate(caller, "3");
@@ -151,26 +139,29 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/** The magnitude of this in the little-endian representation. */
transient int digits[];
- /** The length of this in measured in ints. Can be less than digits.length(). */
+ /**
+ * The length of this in measured in ints. Can be less than digits.length().
+ */
transient int numberLength;
/** The sign of this. */
transient int sign;
-
/* Static Fields */
/**
* The {@code BigInteger} constant 0.
*
* @since 1.2
+ * @since Android 1.0
*/
public static final BigInteger ZERO = new BigInteger(0, 0);
/**
- * The {@code BigInteger} constatn 1.
+ * The {@code BigInteger} constant 1.
*
* @since 1.2
+ * @since Android 1.0
*/
public static final BigInteger ONE = new BigInteger(1, 1);
@@ -178,6 +169,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* The {@code BigInteger} constant 10.
*
* @since 1.5
+ * @since Android 1.0
*/
public static final BigInteger TEN = new BigInteger(1, 10);
@@ -202,15 +194,14 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/**/
private transient int firstNonzeroDigit = -2;
-
/* Serialized Fields */
- /** sign field, used for serialization */
+ /** sign field, used for serialization. */
private int signum;
/** absolute value field, used for serialization */
private byte[] magnitude;
-
+
/** Cache for the hash code. */
private transient int hashCode = 0;
@@ -233,15 +224,15 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/**
- * Constructs a number without to create new space. This construct should be
+ * Constructs a number without creating new space. This construct should be
* used only if the three fields of representation are known.
*
* @param sign
- * the sign of the number
+ * the sign of the number.
* @param numberLength
- * the length of the internal array
+ * the length of the internal array.
* @param digits
- * a reference of some array created before
+ * a reference of some array created before.
*/
BigInteger(int sign, int numberLength, int[] digits) {
this.sign = sign;
@@ -259,11 +250,13 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* [0, 2^(numBits)-1].
*
* @param numBits
- * maximum lenght of the new {@code BigInteger} in bits.
+ * maximum length of the new {@code BigInteger} in bits.
* @param rnd
- * random generator used to generate the new {@code BigInteger}.
+ * is an optional random generator to be used.
* @throws IllegalArgumentException
- * if numBits < 0
+ * if {@code numBits} < 0.
+ *
+ * @since Android 1.0
*/
public BigInteger(int numBits, Random rnd) {
if (numBits < 0) {
@@ -290,18 +283,27 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
}
/**
- * Constructs a random positive {@code BigInteger} instance in the range [0,
+ * Constructs a random {@code BigInteger} instance in the range [0,
* 2^(bitLength)-1] which is probably prime. The probability that the
* returned {@code BigInteger} is prime is beyond (1-1/2^certainty).
+ * <p>
+ * <b>Implementation Note:</b>
+ * Currently {@code rnd} is ignored. The implementation always uses
+ * method {@code bn_rand} from the OpenSSL library. {@code bn_rand}
+ * generates cryptographically strong pseudo-random numbers.
+ * @see <a href="http://www.openssl.org/docs/crypto/BN_rand.html">
+ * Specification of random generator used from OpenSSL library</a>
*
* @param bitLength
- * lenght of the new {@code BigInteger} in bits.
+ * length of the new {@code BigInteger} in bits.
* @param certainty
* tolerated primality uncertainty.
* @param rnd
- * random generator used to generate the new {@code BigInteger}.
- * @throws IllegalArgumentException
- * if bitLength < 2
+ * is an optional random generator to be used.
+ * @throws ArithmeticException
+ * if {@code bitLength} < 2.
+ *
+ * @since Android 1.0
*/
public BigInteger(int bitLength, int certainty, Random rnd) {
if (bitLength < 2) {
@@ -321,9 +323,12 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* @param val
* string representation of the new {@code BigInteger}.
* @throws NullPointerException
- * if val == null.
+ * if {@code val == null}.
* @throws NumberFormatException
- * if val is not a valid representation of a {@code BigInteger}.
+ * if {@code val} is not a valid representation of a {@code
+ * BigInteger}.
+ *
+ * @since Android 1.0
*/
public BigInteger(String val) {
bigInt = new BigInt();
@@ -344,11 +349,13 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* @param radix
* the base to be used for the conversion.
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}.
* @throws NumberFormatException
- * if val is not a valid representation of a {@code BigInteger}
- * or if radix < Character.MIN_RADIX or radix >
- * Character.MAX_RADIX.
+ * if {@code val} is not a valid representation of a {@code
+ * BigInteger} or if {@code radix < Character.MIN_RADIX} or
+ * {@code radix > Character.MAX_RADIX}.
+ *
+ * @since Android 1.0
*/
public BigInteger(String val, int radix) {
if (val == null) {
@@ -373,7 +380,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
// math.12=Zero length BigInteger
throw new NumberFormatException(Messages.getString("math.12")); //$NON-NLS-1$
}
- this.setFromString(this, val, radix);
+ BigInteger.setFromString(this, val, radix);
// oldReprIsValid == true;
}
}
@@ -390,12 +397,13 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* @param magnitude
* magnitude of the new {@code BigInteger} with the most
* significant byte first.
- *
* @throws NullPointerException
- * if magnitude == null
+ * if {@code magnitude == null}.
* @throws NumberFormatException
* if the sign is not one of -1, 0, 1 or if the sign is zero and
- * the magnitute contains non-zero entries.
+ * the magnitude contains non-zero entries.
+ *
+ * @since Android 1.0
*/
public BigInteger(int signum, byte[] magnitude) {
if (magnitude == null) {
@@ -421,16 +429,17 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/**
* Constructs a new {@code BigInteger} from the given two's complement
* representation. The most significant byte is the entry at index 0. The
- * most significant bit of this entry determines the sign of the new
- * {@code BigInteger} instance. The given array must not be empty.
+ * most significant bit of this entry determines the sign of the new {@code
+ * BigInteger} instance. The given array must not be empty.
*
* @param val
* two's complement representation of the new {@code BigInteger}.
- *
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}.
* @throws NumberFormatException
- * if the lenght of val == 0.
+ * if the length of {@code val} is zero.
+ *
+ * @since Android 1.0
*/
public BigInteger(byte[] val) {
if (val.length == 0) {
@@ -452,6 +461,8 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* @param val
* the value of the new {@code BigInteger}.
* @return {@code BigInteger} instance with the value {@code val}.
+ *
+ * @since Android 1.0
*/
public static BigInteger valueOf(long val) {
if (val < 0) {
@@ -471,10 +482,10 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* array.
*
* @return two's complement representation of {@code this}.
+ *
+ * @since Android 1.0
*/
public byte[] toByteArray() {
-// validate1("toByteArray()", this);
-// return bigInt.bigEndianTwosComplement();
return twosComplement();
}
@@ -482,7 +493,9 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* Returns a (new) {@code BigInteger} whose value is the absolute value of
* {@code this}.
*
- * @return {@code abs(this)}
+ * @return {@code abs(this)}.
+ *
+ * @since Android 1.0
*/
public BigInteger abs() {
validate1("abs()", this);
@@ -498,6 +511,8 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* Returns a new {@code BigInteger} whose value is the {@code -this}.
*
* @return {@code -this}.
+ *
+ * @since Android 1.0
*/
public BigInteger negate() {
validate1("negate()", this);
@@ -517,7 +532,9 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* value to be added to {@code this}.
* @return {@code this + val}.
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}.
+ *
+ * @since Android 1.0
*/
public BigInteger add(BigInteger val) {
validate2("add", this, val);
@@ -533,7 +550,9 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* value to be subtracted from {@code this}.
* @return {@code this - val}.
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}.
+ *
+ * @since Android 1.0
*/
public BigInteger subtract(BigInteger val) {
validate2("subtract", this, val);
@@ -544,8 +563,11 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/**
* Returns the sign of this {@code BigInteger}.
*
- * @return -1 if {@code this < 0}, 0 if {@code this == 0}, 1 if
- * {@code this > 0}.
+ * @return {@code -1} if {@code this < 0},
+ * {@code 0} if {@code this == 0},
+ * {@code 1} if {@code this > 0}.
+ *
+ * @since Android 1.0
*/
public int signum() {
// Optimization to avoid unnecessary duplicate representation:
@@ -559,10 +581,16 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* Returns a new {@code BigInteger} whose value is {@code this >> n}. For
* negative arguments, the result is also negative. The shift distance may
* be negative which means that {@code this} is shifted left.
+ * <p>
+ * <b>Implementation Note:</b> Usage of this method on negative values is
+ * not recommended as the current implementation is not efficient.
*
* @param n
- * shift distance.
- * @return this >> n if n >= 0; this << (-n) otherwise.
+ * shift distance
+ * @return {@code this >> n} if {@code n >= 0}; {@code this << (-n)}
+ * otherwise
+ *
+ * @since Android 1.0
*/
public BigInteger shiftRight(int n) {
return shiftLeft(-n);
@@ -570,13 +598,19 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/**
* Returns a new {@code BigInteger} whose value is {@code this << n}. The
- * result is equvalent to {@code this * 2^n} if n &geq; 0. The shift
- * distance may be negative which means that {@code this} is shifted right.
- * The result then corresponds to {@code floor(this / 2^(-n))}.
+ * result is equivalent to {@code this * 2^n} if n >= 0. The shift distance
+ * may be negative which means that {@code this} is shifted right. The
+ * result then corresponds to {@code floor(this / 2^(-n))}.
+ * <p>
+ * <b>Implementation Note:</b> Usage of this method on negative values is
+ * not recommended as the current implementation is not efficient.
*
* @param n
* shift distance.
- * @return this << n if n >= 0; this >> (-n) otherwise.
+ * @return {@code this << n} if {@code n >= 0}; {@code this >> (-n)}.
+ * otherwise
+ *
+ * @since Android 1.0
*/
public BigInteger shiftLeft(int n) {
if (n == 0) return this;
@@ -596,17 +630,20 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
}
/**
- * Returns the number of bits of the binary representation of {@code this}
- * without the sign bit. For positive values this is equivalent to the
- * number of bits, and for negative values this is equivalent to the number
- * of bits used to represent -value-1.
- * mc: In other words: the number a can be coded in
- * a.bitLength() + 1 bits two's complement.
- * E.g. for a.bitLength() == 31, an int will hold a correctly and
- * for a.bitLength() == 32 an int will NOT hold a correctly.
- *
- * @return number of bits of the binary representation of {@code this}
- * without the sign bit.
+ * Returns the length of the value's two's complement representation without
+ * leading zeros for positive numbers / without leading ones for negative
+ * values.
+ * <p>
+ * The two's complement representation of {@code this} will be at least
+ * {@code bitLength() + 1} bits long.
+ * <p>
+ * The value will fit into an {@code int} if {@code bitLength() < 32} or
+ * into a {@code long} if {@code bitLength() < 64}.
+ *
+ * @return the length of the minimal two's complement representation for
+ * {@code this} without the sign bit.
+ *
+ * @since Android 1.0
*/
public int bitLength() {
// Optimization to avoid unnecessary duplicate representation:
@@ -619,12 +656,17 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/**
* Tests whether the bit at position n in {@code this} is set. The result is
* equivalent to {@code this & (2^n) != 0}.
+ * <p>
+ * <b>Implementation Note:</b> Usage of this method is not recommended as
+ * the current implementation is not efficient.
*
* @param n
* position where the bit in {@code this} has to be inspected.
* @return {@code this & (2^n) != 0}.
* @throws ArithmeticException
- * if n < 0
+ * if {@code n < 0}.
+ *
+ * @since Android 1.0
*/
public boolean testBit(int n) {
if (n < 0) {
@@ -650,7 +692,6 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
return (sign < 0);
}
int digit = digits[intCount];
- int i;
n = (1 << (n & 31)); // int with 1 set to the needed position
if (sign < 0) {
int firstNonZeroDigit = getFirstNonzeroDigit();
@@ -670,19 +711,19 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* Returns a new {@code BigInteger} which has the same binary representation
* as {@code this} but with the bit at position n set. The result is
* equivalent to {@code this | 2^n}.
+ * <p>
+ * <b>Implementation Note:</b> Usage of this method is not recommended as
+ * the current implementation is not efficient.
*
* @param n
* position where the bit in {@code this} has to be set.
* @return {@code this | 2^n}.
* @throws ArithmeticException
- * if n < 0
+ * if {@code n < 0}.
+ *
+ * @since Android 1.0
*/
public BigInteger setBit(int n) {
-// validate1("setBit", this);
-// BigInt a = bigInt.copy();
-// a.modifyBit(n, 1);
-// return new BigInteger(a);
-
establishOldRepresentation("setBit");
if( !testBit( n ) ){
return BitLevel.flipBit(this, n);
@@ -695,23 +736,23 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* Returns a new {@code BigInteger} which has the same binary representation
* as {@code this} but with the bit at position n cleared. The result is
* equivalent to {@code this & ~(2^n)}.
+ * <p>
+ * <b>Implementation Note:</b> Usage of this method is not recommended as
+ * the current implementation is not efficient.
*
* @param n
* position where the bit in {@code this} has to be cleared.
* @return {@code this & ~(2^n)}.
* @throws ArithmeticException
- * if n < 0
+ * if {@code n < 0}.
+ *
+ * @since Android 1.0
*/
public BigInteger clearBit(int n) {
-// validate1("clearBit", this);
-// BigInt a = bigInt.copy();
-// a.modifyBit(n, 0);
-// return new BigInteger(a);
-
establishOldRepresentation("clearBit");
- if( testBit( n ) ){
+ if (testBit(n)) {
return BitLevel.flipBit(this, n);
- }else{
+ } else {
return this;
}
}
@@ -720,19 +761,19 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* Returns a new {@code BigInteger} which has the same binary representation
* as {@code this} but with the bit at position n flipped. The result is
* equivalent to {@code this ^ 2^n}.
+ * <p>
+ * <b>Implementation Note:</b> Usage of this method is not recommended as
+ * the current implementation is not efficient.
*
* @param n
* position where the bit in {@code this} has to be flipped.
* @return {@code this ^ 2^n}.
* @throws ArithmeticException
- * if n < 0
+ * if {@code n < 0}.
+ *
+ * @since Android 1.0
*/
public BigInteger flipBit(int n) {
-// validate1("flipBit", this);
-// BigInt a = bigInt.copy();
-// a.modifyBit(n, -1);
-// return new BigInteger(a);
-
establishOldRepresentation("flipBit");
if (n < 0) {
// math.15=Negative bit address
@@ -745,8 +786,13 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* Returns the position of the lowest set bit in the two's complement
* representation of this {@code BigInteger}. If all bits are zero (this=0)
* then -1 is returned as result.
+ * <p>
+ * <b>Implementation Note:</b> Usage of this method is not recommended as
+ * the current implementation is not efficient.
*
- * @return position of lowest bit if this != 0, -1 otherwise.
+ * @return position of lowest bit if {@code this != 0}, {@code -1} otherwise
+ *
+ * @since Android 1.0
*/
public int getLowestSetBit() {
establishOldRepresentation("getLowestSetBit");
@@ -759,14 +805,22 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
}
/**
+ * Use {@code bitLength(0)} if you want to know the length of the binary
+ * value in bits.
+ * <p>
* Returns the number of bits in the binary representation of {@code this}
- * wich differ from the sign bit. If {@code this} is positive the result is
+ * which differ from the sign bit. If {@code this} is positive the result is
* equivalent to the number of bits set in the binary representation of
- * {@code this}. If {@code this} is netative the result is equivalent to
- * the number of bits set in the binary representation of {@code -this-1}.
+ * {@code this}. If {@code this} is negative the result is equivalent to the
+ * number of bits set in the binary representation of {@code -this-1}.
+ * <p>
+ * <b>Implementation Note:</b> Usage of this method is not recommended as
+ * the current implementation is not efficient.
+ *
+ * @return number of bits in the binary representation of {@code this} which
+ * differ from the sign bit
*
- * @return number of bits in the binary representation of {@code this} wich
- * differ from the sign bit.
+ * @since Android 1.0
*/
public int bitCount() {
establishOldRepresentation("bitCount");
@@ -774,10 +828,15 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
}
/**
- * Returns a new {@code BigInteger} whose value is {@code ~this}. The
- * result of this operation is {@code -this-1}.
+ * Returns a new {@code BigInteger} whose value is {@code ~this}. The result
+ * of this operation is {@code -this-1}.
+ * <p>
+ * <b>Implementation Note:</b> Usage of this method is not recommended as
+ * the current implementation is not efficient.
*
* @return {@code ~this}.
+ *
+ * @since Android 1.0
*/
public BigInteger not() {
this.establishOldRepresentation("not");
@@ -786,12 +845,17 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/**
* Returns a new {@code BigInteger} whose value is {@code this & val}.
+ * <p>
+ * <b>Implementation Note:</b> Usage of this method is not recommended as
+ * the current implementation is not efficient.
*
* @param val
* value to be and'ed with {@code this}.
* @return {@code this & val}.
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}.
+ *
+ * @since Android 1.0
*/
public BigInteger and(BigInteger val) {
this.establishOldRepresentation("and1");
@@ -801,12 +865,17 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/**
* Returns a new {@code BigInteger} whose value is {@code this | val}.
+ * <p>
+ * <b>Implementation Note:</b> Usage of this method is not recommended as
+ * the current implementation is not efficient.
*
* @param val
* value to be or'ed with {@code this}.
* @return {@code this | val}.
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}.
+ *
+ * @since Android 1.0
*/
public BigInteger or(BigInteger val) {
this.establishOldRepresentation("or1");
@@ -816,12 +885,17 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/**
* Returns a new {@code BigInteger} whose value is {@code this ^ val}.
+ * <p>
+ * <b>Implementation Note:</b> Usage of this method is not recommended as
+ * the current implementation is not efficient.
*
* @param val
- * value to be xor'ed with {@code this}.
- * @return {@code this ^ val}.
+ * value to be xor'ed with {@code this}
+ * @return {@code this ^ val}
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}
+ *
+ * @since Android 1.0
*/
public BigInteger xor(BigInteger val) {
this.establishOldRepresentation("xor1");
@@ -831,14 +905,19 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/**
* Returns a new {@code BigInteger} whose value is {@code this & ~val}.
- * Evaluating {@code x.andNot(val)} returns the same result as
- * {@code x.and(val.not())}.
+ * Evaluating {@code x.andNot(val)} returns the same result as {@code
+ * x.and(val.not())}.
+ * <p>
+ * <b>Implementation Note:</b> Usage of this method is not recommended as
+ * the current implementation is not efficient.
*
* @param val
* value to be not'ed and then and'ed with {@code this}.
* @return {@code this & ~val}.
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}.
+ *
+ * @since Android 1.0
*/
public BigInteger andNot(BigInteger val) {
this.establishOldRepresentation("andNot1");
@@ -851,6 +930,8 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* big to be represented as an int, then {@code this} % 2^32 is returned.
*
* @return this {@code BigInteger} as an int value.
+ *
+ * @since Android 1.0
*/
@Override
public int intValue() {
@@ -868,6 +949,8 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* big to be represented as an long, then {@code this} % 2^64 is returned.
*
* @return this {@code BigInteger} as a long value.
+ *
+ * @since Android 1.0
*/
@Override
public long longValue() {
@@ -892,6 +975,8 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* 24. For example, 2^24+1 = 16777217 is returned as float 16777216.0.
*
* @return this {@code BigInteger} as a float value.
+ *
+ * @since Android 1.0
*/
@Override
public float floatValue() {
@@ -901,14 +986,16 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/**
* Returns this {@code BigInteger} as an double value. If {@code this} is
- * too big to be represented as an double, then
- * {@code Double.POSITIVE_INFINITY} or {@code Double.NEGATIVE_INFINITY} is
- * returned. Note, that not all integers x in the range [-Dobule.MAX_VALUE,
- * Dobule.MAX_VALUE] can be represented as a double. The double
+ * too big to be represented as an double, then {@code
+ * Double.POSITIVE_INFINITY} or {@code Double.NEGATIVE_INFINITY} is
+ * returned. Note, that not all integers x in the range [-Double.MAX_VALUE,
+ * Double.MAX_VALUE] can be represented as a double. The double
* representation has a mantissa of length 53. For example, 2^53+1 =
* 9007199254740993 is returned as double 9007199254740992.0.
*
- * @return this {@code BigInteger} as a double value.
+ * @return this {@code BigInteger} as a double value
+ *
+ * @since Android 1.0
*/
@Override
public double doubleValue() {
@@ -922,9 +1009,12 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
*
* @param val
* value to be compared with {@code this}.
- * @return 1 if this > val, -1 if this < val, 0 if this == val.
+ * @return {@code 1} if {@code this > val}, {@code -1} if {@code this < val}
+ * , {@code 0} if {@code this == val}.
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}.
+ *
+ * @since Android 1.0
*/
public int compareTo(BigInteger val) {
validate2("compareTo", this, val);
@@ -935,10 +1025,12 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* Returns the minimum of this {@code BigInteger} and {@code val}.
*
* @param val
- * value to be used to compute the minimum with this.
- * @return {@code min(this, val}.
+ * value to be used to compute the minimum with {@code this}.
+ * @return {@code min(this, val)}.
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}.
+ *
+ * @since Android 1.0
*/
public BigInteger min(BigInteger val) {
return ((this.compareTo(val) == -1) ? this : val);
@@ -948,10 +1040,12 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* Returns the maximum of this {@code BigInteger} and {@code val}.
*
* @param val
- * value to be used to compute the maximum with this.
- * @return {@code max(this, val}.
+ * value to be used to compute the maximum with {@code this}
+ * @return {@code max(this, val)}
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}
+ *
+ * @since Android 1.0
*/
public BigInteger max(BigInteger val) {
return ((this.compareTo(val) == 1) ? this : val);
@@ -960,7 +1054,9 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/**
* Returns a hash code for this {@code BigInteger}.
*
- * @return hash code for this.
+ * @return hash code for {@code this}.
+ *
+ * @since Android 1.0
*/
@Override
public int hashCode() {
@@ -982,7 +1078,10 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
*
* @param x
* object to be compared with {@code this}.
- * @return true if x is a BigInteger and this == x.
+ * @return true if {@code x} is a BigInteger and {@code this == x},
+ * {@code false} otherwise.
+ *
+ * @since Android 1.0
*/
@Override
public boolean equals(Object x) {
@@ -1000,6 +1099,8 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* form.
*
* @return a string representation of {@code this} in decimal form.
+ *
+ * @since Android 1.0
*/
@Override
public String toString() {
@@ -1008,15 +1109,17 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
}
/**
- * Returns a string containing a string representation of this
- * {@code BigInteger} with base radix. If radix < Character.MIN_RADIX or
- * radix > Character.MAX_RADIX then a decimal representation is returned.
- * The characters of the string representation are generated with method
- * {@code Character.forDigit}.
+ * Returns a string containing a string representation of this {@code
+ * BigInteger} with base radix. If {@code radix < Character.MIN_RADIX} or
+ * {@code radix > Character.MAX_RADIX} then a decimal representation is
+ * returned. The characters of the string representation are generated with
+ * method {@code Character.forDigit}.
*
* @param radix
* base to be used for the string representation.
* @return a string representation of this with radix 10.
+ *
+ * @since Android 1.0
*/
public String toString(int radix) {
validate1("toString(int radix)", this);
@@ -1032,14 +1135,16 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/**
* Returns a new {@code BigInteger} whose value is greatest common divisor
- * of {@code this} and {@code val}. If this==0 and val==0 then zero is
- * returned, otherwise the result is positive.
+ * of {@code this} and {@code val}. If {@code this==0} and {@code val==0}
+ * then zero is returned, otherwise the result is positive.
*
* @param val
* value with which the greatest common divisor is computed.
* @return {@code gcd(this, val)}.
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}.
+ *
+ * @since Android 1.0
*/
public BigInteger gcd(BigInteger val) {
validate2("gcd", this, val);
@@ -1053,7 +1158,9 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* value to be multiplied with {@code this}.
* @return {@code this * val}.
* @throws NullPointerException
- * if val == null
+ * if {@code val == null}.
+ *
+ * @since Android 1.0
*/
public BigInteger multiply(BigInteger val) {
validate2("multiply", this, val);
@@ -1067,7 +1174,9 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* exponent to which {@code this} is raised.
* @return {@code this ^ exp}.
* @throws ArithmeticException
- * if exp < 0
+ * if {@code exp < 0}.
+ *
+ * @since Android 1.0
*/
public BigInteger pow(int exp) {
if (exp < 0) {
@@ -1086,11 +1195,13 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* value by which {@code this} is divided.
* @return {@code [this / divisor, this % divisor]}.
* @throws NullPointerException
- * if divisor == null
+ * if {@code divisor == null}.
* @throws ArithmeticException
- * if divisor == 0
+ * if {@code divisor == 0}.
* @see #divide
* @see #remainder
+ *
+@since Android 1.0
*/
public BigInteger[] divideAndRemainder(BigInteger divisor) {
validate2("divideAndRemainder", this, divisor);
@@ -1112,9 +1223,11 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* value by which {@code this} is divided.
* @return {@code this / divisor}.
* @throws NullPointerException
- * if divisor == null
+ * if {@code divisor == null}.
* @throws ArithmeticException
- * if divisor == 0
+ * if {@code divisor == 0}.
+ *
+ * @since Android 1.0
*/
public BigInteger divide(BigInteger divisor) {
validate2("divide", this, divisor);
@@ -1132,9 +1245,11 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* value by which {@code this} is divided.
* @return {@code this % divisor}.
* @throws NullPointerException
- * if divisor == null
+ * if {@code divisor == null}.
* @throws ArithmeticException
- * if divisor == 0
+ * if {@code divisor == 0}.
+ *
+ * @since Android 1.0
*/
public BigInteger remainder(BigInteger divisor) {
validate2("remainder", this, divisor);
@@ -1144,18 +1259,21 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
}
/**
- * Returns a new {@code BigInteger} whose value is {@code 1/this mod m}.
- * The modulus {@code m} must be positive. The result is guaranteed to be in
- * the interval {@code [0, m)} (0 inclusive, m exclusive). If {@code this}
- * is not relatively prime to m, then an exception is thrown.
+ * Returns a new {@code BigInteger} whose value is {@code 1/this mod m}. The
+ * modulus {@code m} must be positive. The result is guaranteed to be in the
+ * interval {@code [0, m)} (0 inclusive, m exclusive). If {@code this} is
+ * not relatively prime to m, then an exception is thrown.
*
* @param m
* the modulus.
- * @return {@code this mod m}.
+ * @return {@code 1/this mod m}.
* @throws NullPointerException
- * if m == null
+ * if {@code m == null}
* @throws ArithmeticException
- * if m < 0 or if this is not relatively prime to m
+ * if {@code m < 0 or} if {@code this} is not relatively prime
+ * to {@code m}
+ *
+ * @since Android 1.0
*/
public BigInteger modInverse(BigInteger m) {
if (m.signum() <= 0) {
@@ -1167,13 +1285,12 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
}
/**
- * Returns a new {@code BigInteger} whose value is
- * {@code this^exponent mod m}. The modulus {@code m} must be positive. The
- * result is guaranteed to be in the interval {@code [0, m)} (0 inclusive, m
- * exclusive). If the exponent is negative, then
- * {@code this.modInverse(m)^(-exponent) mod m)} is computed. The inverse of
- * this only exists if {@code this} is relatively prime to m, otherwise an
- * exception is thrown.
+ * Returns a new {@code BigInteger} whose value is {@code this^exponent mod
+ * m}. The modulus {@code m} must be positive. The result is guaranteed to
+ * be in the interval {@code [0, m)} (0 inclusive, m exclusive). If the
+ * exponent is negative, then {@code this.modInverse(m)^(-exponent) mod m)}
+ * is computed. The inverse of this only exists if {@code this} is
+ * relatively prime to m, otherwise an exception is thrown.
*
* @param exponent
* the exponent.
@@ -1181,10 +1298,12 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* the modulus.
* @return {@code this^exponent mod val}.
* @throws NullPointerException
- * if m == null or exponent == null
+ * if {@code m == null} or {@code exponent == null}.
* @throws ArithmeticException
- * if m < 0 or if exponent<0 and this is not relatively prime
- * to m
+ * if {@code m < 0} or if {@code exponent<0} and this is not
+ * relatively prime to {@code m}.
+ *
+ * @since Android 1.0
*/
public BigInteger modPow(BigInteger exponent, BigInteger m) {
if (m.signum() <= 0) {
@@ -1213,9 +1332,11 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* the modulus.
* @return {@code this mod m}.
* @throws NullPointerException
- * if m == null
+ * if {@code m == null}.
* @throws ArithmeticException
- * if m < 0
+ * if {@code m < 0}.
+ *
+ * @since Android 1.0
*/
public BigInteger mod(BigInteger m) {
if (m.signum() <= 0) {
@@ -1230,13 +1351,15 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
* Tests whether this {@code BigInteger} is probably prime. If {@code true}
* is returned, then this is prime with a probability beyond
* (1-1/2^certainty). If {@code false} is returned, then this is definitely
- * composite. If the argument {@code certainty} &leq; 0, then this method
+ * composite. If the argument {@code certainty} <= 0, then this method
* returns true.
*
* @param certainty
* tolerated primality uncertainty.
- * @return {@code ture}, if {@code this} is probably prime, false
+ * @return {@code true}, if {@code this} is probably prime, {@code false}
* otherwise.
+ *
+ * @since Android 1.0
*/
public boolean isProbablePrime(int certainty) {
validate1("isProbablePrime", this);
@@ -1245,12 +1368,14 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/**
* Returns the smallest integer x > {@code this} which is probably prime as
- * a {@code BigInteger} instance. The probability that the returned
- * {@code BigInteger} is prime is beyond (1-1/2^100).
+ * a {@code BigInteger} instance. The probability that the returned {@code
+ * BigInteger} is prime is beyond (1-1/2^80).
*
- * @return smallest integer > {@code this} pwhich is robably prime.
+ * @return smallest integer > {@code this} which is robably prime.
* @throws ArithmeticException
- * if this < 0
+ * if {@code this < 0}.
+ *
+ * @since Android 1.0
*/
public BigInteger nextProbablePrime() {
if (sign < 0) {
@@ -1263,31 +1388,32 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/**
* Returns a random positive {@code BigInteger} instance in the range [0,
* 2^(bitLength)-1] which is probably prime. The probability that the
- * returned {@code BigInteger} is prime is beyond (1-1/2^100).
+ * returned {@code BigInteger} is prime is beyond (1-1/2^80).
+ * <p>
+ * <b>Implementation Note:</b> Currently {@code rnd} is ignored.
*
* @param bitLength
- * lenght of the new {@code BigInteger} in bits
+ * length of the new {@code BigInteger} in bits.
* @param rnd
* random generator used to generate the new {@code BigInteger}.
- * @return probably prime random {@code BigInteger} instance
+ * @return probably prime random {@code BigInteger} instance.
* @throws IllegalArgumentException
- * if bitLength < 2
+ * if {@code bitLength < 2}.
+ *
+ * @since Android 1.0
*/
public static BigInteger probablePrime(int bitLength, Random rnd) {
-// System.out.println("probablePrime");
return new BigInteger(bitLength, 100, rnd);
}
-
-
/* Private Methods */
/**
* Returns the two's complement representation of this BigInteger in a byte
* array.
*
- * @return two's complement representation of {@code this}.
+ * @return two's complement representation of {@code this}
*/
private byte[] twosComplement() {
establishOldRepresentation("twosComplement()");
@@ -1470,7 +1596,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>,
/*
* Returns a copy of the current instance to achieve immutability
*/
-// mc: Only used by Primality.nextProbablePrime()
+// Only used by Primality.nextProbablePrime()
BigInteger copy() {
establishOldRepresentation("copy()");
int[] copyDigits = new int[numberLength];
diff --git a/math/src/main/java/java/math/BitLevel.java b/math/src/main/java/java/math/BitLevel.java
index 1ba019e..ab4f9cc 100644
--- a/math/src/main/java/java/math/BitLevel.java
+++ b/math/src/main/java/java/math/BitLevel.java
@@ -1,20 +1,4 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed 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.
- */
-
-/*
* 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.
@@ -31,12 +15,6 @@
* limitations under the License.
*/
-/*
- * Since the original Harmony Code of the BigInteger class was strongly modified,
- * in order to use the more efficient OpenSSL BIGNUM implementation,
- * no android-modification-tags were placed, at all.
- */
-
package java.math;
/**
@@ -65,7 +43,9 @@ class BitLevel {
/** @see BigInteger#bitLength() */
static int bitLength(BigInteger val) {
+ // BEGIN android-added
val.establishOldRepresentation("BitLevel.bitLength");
+ // END android-added
if (val.sign == 0) {
return 0;
}
@@ -86,7 +66,9 @@ class BitLevel {
/** @see BigInteger#bitCount() */
static int bitCount(BigInteger val) {
+ // BEGIN android-added
val.establishOldRepresentation("BitLevel.bitCount");
+ // END android-added
int bCount = 0;
if (val.sign == 0) {
@@ -115,7 +97,9 @@ class BitLevel {
* must be in the range {@code [0, val.bitLength()-1]}
*/
static boolean testBit(BigInteger val, int n) {
+ // BEGIN android-added
val.establishOldRepresentation("BitLevel.testBit");
+ // END android-added
// PRE: 0 <= n < val.bitLength()
return ((val.digits[n >> 5] & (1 << (n & 31))) != 0);
}
@@ -137,10 +121,70 @@ class BitLevel {
return ((i != intCount) || (digits[i] << (32 - bitCount) != 0));
}
+ // BEGIN android-removed
+ // /** @see BigInteger#shiftLeft(int) */
+ // static BigInteger shiftLeft(BigInteger source, int count) {
+ // int intCount = count >> 5;
+ // count &= 31; // %= 32
+ // int resLength = source.numberLength + intCount
+ // + ( ( count == 0 ) ? 0 : 1 );
+ // int resDigits[] = new int[resLength];
+ //
+ // shiftLeft(resDigits, source.digits, intCount, count);
+ // BigInteger result = new BigInteger(source.sign, resLength, resDigits);
+ // result.cutOffLeadingZeroes();
+ // return result;
+ // }
+ //
+ // /**
+ // * Performs {@code val <<= count}.
+ // */
+ // // val should have enough place (and one digit more)
+ // static void inplaceShiftLeft(BigInteger val, int count) {
+ // int intCount = count >> 5; // count of integers
+ // val.numberLength += intCount
+ // + ( Integer
+ // .numberOfLeadingZeros(val.digits[val.numberLength - 1])
+ // - ( count & 31 ) >= 0 ? 0 : 1 );
+ // shiftLeft(val.digits, val.digits, intCount, count & 31);
+ // val.cutOffLeadingZeroes();
+ // val.unCache();
+ // }
+ //
+ // /**
+ // * Abstractly shifts left an array of integers in little endian (i.e. shift
+ // * it right). Total shift distance in bits is intCount * 32 + count
+ // *
+ // * @param result the destination array
+ // * @param source the source array
+ // * @param intCount the shift distance in integers
+ // * @param count an additional shift distance in bits
+ // */
+ // static void shiftLeft(int result[], int source[], int intCount, int count) {
+ // if (count == 0) {
+ // System.arraycopy(source, 0, result, intCount, result.length
+ // - intCount);
+ // } else {
+ // int rightShiftCount = 32 - count;
+ //
+ // result[result.length - 1] = 0;
+ // for (int i = result.length - 1; i > intCount; i--) {
+ // result[i] |= source[i - intCount - 1] >>> rightShiftCount;
+ // result[i - 1] = source[i - intCount - 1] << count;
+ // }
+ // }
+ //
+ // for (int i = 0; i < intCount; i++) {
+ // result[i] = 0;
+ // }
+ // }
+ // END android-removed
/** @see BigInteger#shiftRight(int) */
static BigInteger shiftRight(BigInteger source, int count) {
+ // BEGIN android-added
source.establishOldRepresentation("BitLevel.shiftRight");
+ // END android-added
int intCount = count >> 5; // count of integers
count &= 31; // count of remaining bits
if (intCount >= source.numberLength) {
@@ -178,7 +222,9 @@ class BitLevel {
* Performs {@code val >>= count} where {@code val} is a positive number.
*/
static void inplaceShiftRight(BigInteger val, int count) {
+ // BEGIN android-added
val.establishOldRepresentation("BitLevel.inplaceShiftRight");
+ // END android-added
int sign = val.signum();
if (count == 0 || val.signum() == 0)
return;
@@ -249,7 +295,9 @@ class BitLevel {
* @param bitNumber: the bit's position in the intCount element
*/
static BigInteger flipBit(BigInteger val, int n){
+ // BEGIN android-added
val.establishOldRepresentation("BitLevel.flipBit");
+ // END android-added
int resSign = (val.sign == 0) ? 1 : val.sign;
int intCount = n >> 5;
int bitN = n & 31;
diff --git a/math/src/main/java/java/math/Conversion.java b/math/src/main/java/java/math/Conversion.java
index 945af8f..65fc896 100644
--- a/math/src/main/java/java/math/Conversion.java
+++ b/math/src/main/java/java/math/Conversion.java
@@ -1,20 +1,4 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed 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.
- */
-
-/*
* 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.
@@ -70,7 +54,9 @@ class Conversion {
/** @see BigInteger#toString(int) */
static String bigInteger2String(BigInteger val, int radix) {
+ // BEGIN android-added
val.establishOldRepresentation("Conversion.bigInteger2String");
+ // END android-added
int sign = val.sign;
int numberLength = val.numberLength;
int digits[] = val.digits;
@@ -154,7 +140,9 @@ class Conversion {
* @see BigDecimal#toString()
*/
static String toDecimalScaledString(BigInteger val, int scale) {
+ // BEGIN android-added
val.establishOldRepresentation("Conversion.toDecimalScaledString");
+ // END android-added
int sign = val.sign;
int numberLength = val.numberLength;
int digits[] = val.digits;
@@ -435,7 +423,9 @@ class Conversion {
/** @see BigInteger#doubleValue() */
static double bigInteger2Double(BigInteger val) {
+ // BEGIN android-added
val.establishOldRepresentation("Conversion.bigInteger2Double");
+ // END android-added
// val.bitLength() < 64
if ((val.numberLength < 2)
|| ((val.numberLength == 2) && (val.digits[1] > 0))) {
diff --git a/math/src/main/java/java/math/Division.java b/math/src/main/java/java/math/Division.java
index 36c7c79..35e3650 100644
--- a/math/src/main/java/java/math/Division.java
+++ b/math/src/main/java/java/math/Division.java
@@ -1,20 +1,4 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed 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.
- */
-
-/*
* 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.
@@ -31,14 +15,11 @@
* limitations under the License.
*/
-/*
- * Since the original Harmony Code of the BigInteger class was strongly modified,
- * in order to use the more efficient OpenSSL BIGNUM implementation,
- * no android-modification-tags were placed, at all.
- */
-
package java.math;
+// BEGIN android-removed
+// import org.apache.harmony.math.internal.nls.Messages;
+// END android-removed
/**
* Static library that provides all operations related with division and modular
@@ -66,6 +47,11 @@ package java.math;
*/
class Division {
+ // BEGIN android-note
+ // The divide method has been dropped since this functionality
+ // is now available from OpenSSL BIGNUM.
+ // END android-note
+
/**
* Divides an array by an integer value. Implements the Knuth's division
* algorithm. See D. Knuth, The Art of Computer Programming, vol. 2.
@@ -150,7 +136,9 @@ class Division {
* @return divide % divisor
*/
static int remainder(BigInteger dividend, int divisor) {
+ // BEGIN android-added
dividend.establishOldRepresentation("Division.remainder");
+ // END android-added
return remainderArrayByInt(dividend.digits, dividend.numberLength,
divisor);
}
@@ -208,7 +196,9 @@ class Division {
*/
static BigInteger[] divideAndRemainderByInteger(BigInteger val,
int divisor, int divisorSign) {
+ // BEGIN android-added
val.establishOldRepresentation("Division.divideAndRemainderByInteger");
+ // END android-added
// res[0] is a quotient and res[1] is a remainder:
int[] valDigits = val.digits;
int valLen = val.numberLength;
@@ -241,4 +231,8 @@ class Division {
return new BigInteger[] { result0, result1 };
}
+ // BEGIN android-note
+ // A big part of this class that only has been used by the divide method
+ // has been dropped in favor of using the BIGNUM impl.
+ // END android-note
}
diff --git a/math/src/main/java/java/math/Logical.java b/math/src/main/java/java/math/Logical.java
index 3855aeb..a4c61e5 100644
--- a/math/src/main/java/java/math/Logical.java
+++ b/math/src/main/java/java/math/Logical.java
@@ -224,6 +224,8 @@ class Logical {
/** @see BigInteger#andNot(BigInteger) */
static BigInteger andNot(BigInteger val, BigInteger that) {
+ // BEGIN android-changed
+ // copied from newer version of harmony
if (that.sign == 0 ) {
return val;
}
@@ -252,6 +254,7 @@ class Logical {
return andNotNegative(val, that);
}
}
+ // END android-changed
}
/** @return sign = 1, magnitude = val.magnitude & ~that.magnitude*/
diff --git a/math/src/main/java/java/math/MathContext.java b/math/src/main/java/java/math/MathContext.java
index 5a483f1..9e1314f 100644
--- a/math/src/main/java/java/math/MathContext.java
+++ b/math/src/main/java/java/math/MathContext.java
@@ -25,39 +25,54 @@ import java.io.StreamCorruptedException;
import org.apache.harmony.math.internal.nls.Messages;
/**
- * Immutable objects describing settings as rounding mode and digit precision
- * for the numerical operations provided by class {@code BigDecimal}.
+ * Immutable objects describing settings such as rounding mode and digit
+ * precision for the numerical operations provided by class {@link BigDecimal}.
*
- * @author Intel Middleware Product Division
- * @author Instituto Tecnologico de Cordoba
+ * @since Android 1.0
*/
public final class MathContext implements Serializable {
+ // BEGIN android-note
+ // copied from newer version of harmony
+ // added final modifier
+ // END android-note
/* Fields */
/**
- * A MathContext wich corresponds to the IEEE 754r single decimal precision format:
- * 7 digit preicision and HALF_EVEN rounding.
+ * A {@code MathContext} which corresponds to the IEEE 754r quadruple
+ * decimal precision format: 34 digit precision and
+ * {@link RoundingMode#HALF_EVEN} rounding.
+ *
+ * @since Android 1.0
*/
- public static final MathContext DECIMAL32 = new MathContext(7,
+ public static final MathContext DECIMAL128 = new MathContext(34,
RoundingMode.HALF_EVEN);
/**
- * A MathContext wich corresponds to the IEEE 754r double decimal precision format:
- * 16 digit preicision and HALF_EVEN rounding.
+ * A {@code MathContext} which corresponds to the IEEE 754r single decimal
+ * precision format: 7 digit precision and {@link RoundingMode#HALF_EVEN}
+ * rounding.
+ *
+ * @since Android 1.0
*/
- public static final MathContext DECIMAL64 = new MathContext(16,
+ public static final MathContext DECIMAL32 = new MathContext(7,
RoundingMode.HALF_EVEN);
/**
- * A MathContext wich corresponds to the IEEE 754r quadruple decimal precision format:
- * 34 digit preicision and HALF_EVEN rounding.
+ * A {@code MathContext} which corresponds to the IEEE 754r double decimal
+ * precision format: 16 digit precision and {@link RoundingMode#HALF_EVEN}
+ * rounding.
+ *
+ * @since Android 1.0
*/
- public static final MathContext DECIMAL128 = new MathContext(34,
+ public static final MathContext DECIMAL64 = new MathContext(16,
RoundingMode.HALF_EVEN);
/**
- * A MathContext for unlimited precision with HALF_UP rounding.
+ * A {@code MathContext} for unlimited precision with
+ * {@link RoundingMode#HALF_UP} rounding.
+ *
+ * @since Android 1.0
*/
public static final MathContext UNLIMITED = new MathContext(0,
RoundingMode.HALF_UP);
@@ -66,33 +81,35 @@ public final class MathContext implements Serializable {
private static final long serialVersionUID = 5579720004786848255L;
/**
- * The number of digits to be used for an operation;
- * results are rounded to this precision.
+ * The number of digits to be used for an operation; results are rounded to
+ * this precision.
*/
private int precision;
/**
- * A {@code RoundingMode} object which specifies
- * the algorithm to be used for rounding.
+ * A {@code RoundingMode} object which specifies the algorithm to be used
+ * for rounding.
*/
private RoundingMode roundingMode;
- /**
- * An array of {@code char} containing:
- * {@code 'p','r','e','c','i','s','i','o','n','='}.
- * It's used to improve the methods related to {@code String} conversion.
+ /**
+ * An array of {@code char} containing: {@code
+ * 'p','r','e','c','i','s','i','o','n','='}. It's used to improve the
+ * methods related to {@code String} conversion.
+ *
* @see #MathContext(String)
- * @see #toString()
+ * @see #toString()
*/
private final static char[] chPrecision = { 'p', 'r', 'e', 'c', 'i', 's',
'i', 'o', 'n', '=' };
- /**
- * An array of {@code char} containing:
- * {@code 'r','o','u','n','d','i','n','g','M','o','d','e','='}.
- * It's used to improve the methods related to {@code String} conversion.
+ /**
+ * An array of {@code char} containing: {@code
+ * 'r','o','u','n','d','i','n','g','M','o','d','e','='}. It's used to
+ * improve the methods related to {@code String} conversion.
+ *
* @see #MathContext(String)
- * @see #toString()
+ * @see #toString()
*/
private final static char[] chRoundingMode = { 'r', 'o', 'u', 'n', 'd',
'i', 'n', 'g', 'M', 'o', 'd', 'e', '=' };
@@ -100,30 +117,46 @@ public final class MathContext implements Serializable {
/* Constructors */
/**
- * Constructs a new MathContext with the specified precision and with
- * the rounding mode HALF_UP. If the precision passed is zero, then
- * this implies that the computations have to be performed exact,
- * the rounding mode in this case is irrelevant.
+ * Constructs a new {@code MathContext} with the specified precision and
+ * with the rounding mode {@link RoundingMode#HALF_UP HALF_UP}. If the
+ * precision passed is zero, then this implies that the computations have to
+ * be performed exact, the rounding mode in this case is irrelevant.
+ *
+ * @param precision
+ * the precision for the new {@code MathContext}.
+ * @throws IllegalArgumentException
+ * if {@code precision < 0}.
*
- * @param precision the precision for the new MathContext
- * @throws IllegalArgumentException if precision < 0.
+ * @since Android 1.0
*/
public MathContext(int precision) {
+ // BEGIN android-note
+ // parameter names changed.
+ // END android-note
this(precision, RoundingMode.HALF_UP);
}
/**
- * Constructs a new MathContext with the specified precision and with
- * the specified rounding mode. If the precision passed is zero, then
- * this implies that the computations have to be performed exact,
- * the rounding mode in this case is irrelevant.
+ * Constructs a new {@code MathContext} with the specified precision and
+ * with the specified rounding mode. If the precision passed is zero, then
+ * this implies that the computations have to be performed exact, the
+ * rounding mode in this case is irrelevant.
*
- * @param precision the precision for the new MathContext
- * @param roundingMode the rounding mode for the new MathContext
- * @throws IllegalArgumentException if precision < 0.
- * @throws NullPointerException if roundingMode is null.
+ * @param precision
+ * the precision for the new {@code MathContext}.
+ * @param roundingMode
+ * the rounding mode for the new {@code MathContext}.
+ * @throws IllegalArgumentException
+ * if {@code precision < 0}.
+ * @throws NullPointerException
+ * if {@code roundingMode} is {@code null}.
+ *
+ * @since Android 1.0
*/
public MathContext(int precision, RoundingMode roundingMode) {
+ // BEGIN android-note
+ // parameter names changed.
+ // END android-note
if (precision < 0) {
// math.0C=Digits < 0
throw new IllegalArgumentException(Messages.getString("math.0C")); //$NON-NLS-1$
@@ -137,15 +170,20 @@ public final class MathContext implements Serializable {
}
/**
- * Constructs a new MathContext from a string. The string has to
- * specify the precision and the rounding mode to be used and has
- * to follow the following syntax:
- * "precision=<precision> roundingMode=<roundingMode>"
- * This is the same form as the one returned by the toString() method.
+ * Constructs a new {@code MathContext} from a string. The string has to
+ * specify the precision and the rounding mode to be used and has to follow
+ * the following syntax: "precision=&lt;precision&gt; roundingMode=&lt;roundingMode&gt;"
+ * This is the same form as the one returned by the {@link #toString}
+ * method.
+ *
+ * @param val
+ * a string describing the precision and rounding mode for the
+ * new {@code MathContext}.
+ * @throws IllegalArgumentException
+ * if the string is not in the correct format or if the
+ * precision specified is < 0.
*
- * @param val a string describing the precision and rounding mode for the new MathContext.
- * @throws IllegalArgumentException if the String is not in the correct
- * format or if the precision specified is < 0.
+ * @since Android 1.0
*/
public MathContext(String val) {
char[] charVal = val.toCharArray();
@@ -172,7 +210,9 @@ public final class MathContext implements Serializable {
// math.0E=bad string format
throw new IllegalArgumentException(Messages.getString("math.0E")); //$NON-NLS-1$
}
+ // BEGIN android-changed
this.precision = digit;
+ // END android-changed
i++;
do {
@@ -213,37 +253,52 @@ public final class MathContext implements Serializable {
/* Public Methods */
/**
- * Returns the precision. The precision is the number of digits used
- * for an operation. Results are rounded to this precision. The precision
- * is guaranteed to be non negative. If the precision is zero, then
- * the computations have to be performed exact, results are not rounded
- * in this case.
+ * Returns the precision. The precision is the number of digits used for an
+ * operation. Results are rounded to this precision. The precision is
+ * guaranteed to be non negative. If the precision is zero, then the
+ * computations have to be performed exact, results are not rounded in this
+ * case.
*
* @return the precision.
+ *
+ * @since Android 1.0
*/
public int getPrecision() {
return precision;
}
/**
- * Returns the rounding mode. The rounding mode is the strategy to be
- * used to round results. The rounding mode is one of RoundingMode.UP,
- * RoundingMode.DOWN, RoundingMode.CEILING, RoundingMode.FLOOR,
- * RoundingMode.HALF_UP, RoundingMode.HALF_DOWN, RoundingMode.HALF_EVEN,
- * or oundingMode.UNNECESSARY.
+ * Returns the rounding mode. The rounding mode is the strategy to be used
+ * to round results.
+ * <p>
+ * The rounding mode is one of
+ * {@link RoundingMode#UP},
+ * {@link RoundingMode#DOWN},
+ * {@link RoundingMode#CEILING},
+ * {@link RoundingMode#FLOOR},
+ * {@link RoundingMode#HALF_UP},
+ * {@link RoundingMode#HALF_DOWN},
+ * {@link RoundingMode#HALF_EVEN}, or
+ * {@link RoundingMode#UNNECESSARY}.
*
* @return the rounding mode.
+ *
+ * @since Android 1.0
*/
public RoundingMode getRoundingMode() {
return roundingMode;
}
/**
- * Returns true if x is a MathContext with the same precision setting
- * and the same rounding mode as this MathContext instance.
+ * Returns true if x is a {@code MathContext} with the same precision
+ * setting and the same rounding mode as this {@code MathContext} instance.
+ *
+ * @param x
+ * object to be compared.
+ * @return {@code true} if this {@code MathContext} instance is equal to the
+ * {@code x} argument; {@code false} otherwise.
*
- * @param x object to be compared
- * @return true if this MathContext instance is equal to the x argument; false otherwise.
+ * @since Android 1.0
*/
@Override
public boolean equals(Object x) {
@@ -253,9 +308,11 @@ public final class MathContext implements Serializable {
}
/**
- * Returns the hash code for this MathContext instance.
+ * Returns the hash code for this {@code MathContext} instance.
+ *
+ * @return the hash code for this {@code MathContext}.
*
- * @return the hash code for this MathContext
+ * @since Android 1.0
*/
@Override
public int hashCode() {
@@ -264,16 +321,16 @@ public final class MathContext implements Serializable {
}
/**
- * Returns the string representation for this MathContext instance.
+ * Returns the string representation for this {@code MathContext} instance.
* The string has the form
+ * {@code
+ * "precision=&lt;precision&gt; roundingMode=&lt;roundingMode&gt;"
+ * } where {@code &lt;precision&gt;} is an integer describing the number
+ * of digits used for operations and {@code &lt;roundingMode&gt;} is the
+ * string representation of the rounding mode.
*
- * "precision=<precision> roundingMode=<roundingMode>"
- *
- * where <precision> is an int describing the number of digits used for
- * operations and <roundingMode> is the string representation of the
- * rounding mode.
- *
- * @return a string representation for this MathContext instance.
+ * @return a string representation for this {@code MathContext} instance
+ * @since Android 1.0
*/
@Override
public String toString() {
@@ -289,12 +346,12 @@ public final class MathContext implements Serializable {
/**
* Makes checks upon deserialization of a {@code MathContext} instance.
- * Checks whether precision >= 0 and the roundingMode != null
+ * Checks whether {@code precision >= 0} and {@code roundingMode != null}
*
* @throws StreamCorruptedException
- * if precision < 0
+ * if {@code precision < 0}
* @throws StreamCorruptedException
- * if roundingMode == null
+ * if {@code roundingMode == null}
*/
private void readObject(ObjectInputStream s) throws IOException,
ClassNotFoundException {
diff --git a/math/src/main/java/java/math/Multiplication.java b/math/src/main/java/java/math/Multiplication.java
index 2eb3229..ec22207 100644
--- a/math/src/main/java/java/math/Multiplication.java
+++ b/math/src/main/java/java/math/Multiplication.java
@@ -1,20 +1,4 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed 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.
- */
-
-/*
* 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.
@@ -31,12 +15,6 @@
* limitations under the License.
*/
-/*
- * Since the original Harmony Code of the BigInteger class was strongly modified,
- * in order to use the more efficient OpenSSL BIGNUM implementation,
- * no android-modification-tags were placed, at all.
- */
-
package java.math;
import org.apache.harmony.math.internal.nls.Messages;
@@ -52,6 +30,14 @@ class Multiplication {
/** Just to denote that this class can't be instantiated. */
private Multiplication() {}
+ // BEGIN android-removed
+ // /**
+ // * Break point in digits (number of {@code int} elements)
+ // * between Karatsuba and Pencil and Paper multiply.
+ // */
+ // static final int whenUseKaratsuba = 63; // an heuristic value
+ // END android-removed
+
/**
* An array with powers of ten that fit in the type {@code int}.
* ({@code 10^0,10^1,...,10^9})
@@ -81,10 +67,12 @@ class Multiplication {
*/
static final BigInteger bigFivePows[] = new BigInteger[32];
+
static {
int i;
long fivePow = 1L;
+
for (i = 0; i <= 18; i++) {
bigFivePows[i] = BigInteger.valueOf(fivePow);
bigTenPows[i] = BigInteger.valueOf(fivePow << i);
@@ -96,6 +84,10 @@ class Multiplication {
}
}
+ // BEGIN android-note
+ // The method multiply has been removed in favor of using OpenSSL BIGNUM
+ // END android-note
+
/**
* Multiplies a number by a positive integer.
* @param val an arbitrary {@code BigInteger}
@@ -103,9 +95,11 @@ class Multiplication {
* @return {@code val * factor}
*/
static BigInteger multiplyByPositiveInt(BigInteger val, int factor) {
+ // BEGIN android-changed
BigInt bi = val.bigInt.copy();
bi.multiplyByPositiveInt(factor);
return new BigInteger(bi);
+ // END android-changed
}
/**
diff --git a/math/src/main/java/java/math/Primality.java b/math/src/main/java/java/math/Primality.java
index e17aafd..fd06b3b 100644
--- a/math/src/main/java/java/math/Primality.java
+++ b/math/src/main/java/java/math/Primality.java
@@ -1,20 +1,4 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed 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.
- */
-
-/*
* 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.
@@ -30,17 +14,31 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
/*
- * Since the original Harmony Code of the BigInteger class was strongly modified,
- * in order to use the more efficient OpenSSL BIGNUM implementation,
- * no android-modification-tags were placed, at all.
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed 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.
*/
+// BEGIN android-note
+// Since the original Harmony Code of the BigInteger class was strongly modified,
+// in order to use the more efficient OpenSSL BIGNUM implementation,
+// no android-modification-tags were placed, at all.
+// END android-note
+
package java.math;
import java.util.Arrays;
-import java.util.Random;
class Primality {
@@ -96,7 +94,6 @@ class Primality {
}
}
-
/* Package Methods */
/**
@@ -115,8 +112,6 @@ class Primality {
int gapSize = 1024; // for searching of the next probable prime number
int modules[] = new int[primes.length];
boolean isDivisible[] = new boolean[gapSize];
- BigInt startPoint;
- BigInt probPrime;
BigInt ni = n.bigInt;
// If n < "last prime of table" searches next prime in the table
if (ni.bitLength() <= 10) {
@@ -126,15 +121,12 @@ class Primality {
return BIprimes[i];
}
}
- /*
- * Creates a "N" enough big to hold the next probable prime Note that: N <
- * "next prime" < 2*N
- */
- startPoint = ni.copy();
- probPrime = new BigInt();
-
- // To fix N to the "next odd number"
- ni.addPositiveInt(BigInt.remainderByPositiveInt(ni, 2) + 1);
+
+ BigInt startPoint = ni.copy();
+ BigInt probPrime = new BigInt();
+
+ // Fix startPoint to "next odd number":
+ startPoint.addPositiveInt(BigInt.remainderByPositiveInt(ni, 2) + 1);
// // To set the improved certainty of Miller-Rabin
// j = startPoint.bitLength();
diff --git a/math/src/main/java/java/math/RoundingMode.java b/math/src/main/java/java/math/RoundingMode.java
index 8aac012..84dcc52 100644
--- a/math/src/main/java/java/math/RoundingMode.java
+++ b/math/src/main/java/java/math/RoundingMode.java
@@ -20,61 +20,75 @@ package java.math;
import org.apache.harmony.math.internal.nls.Messages;
/**
- * An enum to specify the rounding behaviour for operations whose results
- * cannot be represented exactly.
+ * Specifies the rounding behavior for operations whose results cannot be
+ * represented exactly.
*
- * @author Intel Middleware Product Division
- * @author Instituto Tecnologico de Cordoba
+ * @since Android 1.0
*/
public enum RoundingMode {
/**
* Rounding mode where positive values are rounded towards positive infinity
* and negative values towards negative infinity.
+ * <br>
+ * Rule: {@code x.round().abs() >= x.abs()}
*
- * Rule: x.round().abs() >= x.abs()
+ * @since Android 1.0
*/
UP(BigDecimal.ROUND_UP),
/**
* Rounding mode where the values are rounded towards zero.
+ * <br>
+ * Rule: {@code x.round().abs() <= x.abs()}
*
- * Rule: x.round().abs() <= x.abs()
+ * @since Android 1.0
*/
DOWN(BigDecimal.ROUND_DOWN),
/**
* Rounding mode to round towards positive infinity. For positive values
- * this rounding mode behaves as UP, for negative values as
- * DOWN.
+ * this rounding mode behaves as {@link #UP}, for negative values as
+ * {@link #DOWN}.
+ * <br>
+ * Rule: {@code x.round() >= x}
*
- * Rule: x.round() >= x
+ * @since Android 1.0
*/
CEILING(BigDecimal.ROUND_CEILING),
/**
* Rounding mode to round towards negative infinity. For positive values
- * this rounding mode behaves as DOWN, for negative values as UP.
+ * this rounding mode behaves as {@link #DOWN}, for negative values as
+ * {@link #UP}.
+ * <br>
+ * Rule: {@code x.round() <= x}
*
- * Rule: x.round() <= x
+ * @since Android 1.0
*/
FLOOR(BigDecimal.ROUND_FLOOR),
/**
- * Rounding mode where values are rounded towards the nearest neighbour.
- * Ties are broken by rounding up.
+ * Rounding mode where values are rounded towards the nearest neighbor. Ties
+ * are broken by rounding up.
+ *
+ * @since Android 1.0
*/
HALF_UP(BigDecimal.ROUND_HALF_UP),
/**
- * Rounding mode where values are rounded towards the nearest neighbour.
- * Ties are broken by rounding down.
+ * Rounding mode where values are rounded towards the nearest neighbor. Ties
+ * are broken by rounding down.
+ *
+ * @since Android 1.0
*/
HALF_DOWN(BigDecimal.ROUND_HALF_DOWN),
/**
- * Rounding mode where values are rounded towards the nearest neighbour.
- * Ties are broken by rounding to the even neighbour.
+ * Rounding mode where values are rounded towards the nearest neighbor. Ties
+ * are broken by rounding to the even neighbor.
+ *
+ * @since Android 1.0
*/
HALF_EVEN(BigDecimal.ROUND_HALF_EVEN),
@@ -82,6 +96,8 @@ public enum RoundingMode {
* Rounding mode where the rounding operations throws an ArithmeticException
* for the case that rounding is necessary, i.e. for the case that the value
* cannot be represented exactly.
+ *
+ * @since Android 1.0
*/
UNNECESSARY(BigDecimal.ROUND_UNNECESSARY);
@@ -94,14 +110,20 @@ public enum RoundingMode {
}
/**
- * Converts rounding mode constants from class BigDecimal into
- * RoundingMode values.
+ * Converts rounding mode constants from class {@code BigDecimal} into
+ * {@code RoundingMode} values.
*
- * @param rM rounding mode constant as defined in class BigDecimal
+ * @param mode
+ * rounding mode constant as defined in class {@code BigDecimal}
* @return corresponding rounding mode object
+ *
+ * @since Android 1.0
*/
- public static RoundingMode valueOf(int rM) {
- switch (rM) {
+ public static RoundingMode valueOf(int mode) {
+ // BEGIN android-note
+ // parameter name changed.
+ // END android-note
+ switch (mode) {
case BigDecimal.ROUND_CEILING:
return CEILING;
case BigDecimal.ROUND_DOWN:
diff --git a/math/src/main/java/java/math/package.html b/math/src/main/java/java/math/package.html
index 2d25ed0..f6450d0 100644
--- a/math/src/main/java/java/math/package.html
+++ b/math/src/main/java/java/math/package.html
@@ -1,15 +1,13 @@
<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
-</head>
-<html>
-<body>
-<p>
-This package provides arbitrary-precision integers and decimals.
-Class {@link java.math.BigInteger} provides integers which are limited by the available memory only.
-Class {@link java.math.BigDecimal} provides arbitrary-precision signed decimal numbers. These numbers
-are suitable for currency calculations. The user has full control over the rounding behavior (comparable
-with the IEEE754R rounding modes.
-</p>
-</body>
+ <body>
+ Provides arbitrary-precision integers and decimals.
+ Class {@link java.math.BigInteger} provides integers which are limited
+ by the available memory only.
+ Class {@link java.math.BigDecimal} provides arbitrary-precision signed
+ decimal numbers. These numbers are suitable for currency calculations.
+ The user has full control over the rounding behavior (comparable with
+ the IEEE754R rounding modes).
+ <p>
+ @since Android 1.0
+ </body>
</html>
diff --git a/math/src/main/java/org/apache/harmony/math/internal/nls/Messages.java b/math/src/main/java/org/apache/harmony/math/internal/nls/Messages.java
index b1682a9..4b0075a 100644
--- a/math/src/main/java/org/apache/harmony/math/internal/nls/Messages.java
+++ b/math/src/main/java/org/apache/harmony/math/internal/nls/Messages.java
@@ -21,6 +21,10 @@
* if this tool runs again. Better make changes in the template file.
*/
+// BEGIN android-note
+// Redundant code has been removed and is now called from MsgHelp.
+// END android-note
+
package org.apache.harmony.math.internal.nls;
// BEGIN android-added
@@ -129,4 +133,8 @@ public class Messages {
return MsgHelp.getString(sResource, msg, args);
// END android-changed
}
+
+ // BEGIN android-note
+ // Duplicate code was dropped in favor of using MsgHelp.
+ // END android-note
}
diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/AllTests.java b/math/src/test/java/org/apache/harmony/tests/java/math/AllTests.java
new file mode 100644
index 0000000..e61b8f0
--- /dev/null
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/AllTests.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed 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 org.apache.harmony.tests.java.math;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * This is autogenerated source file. Includes tests for package org.apache.harmony.tests.java.math;
+ */
+
+public class AllTests {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(AllTests.suite());
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("All tests for package org.apache.harmony.tests.java.math;");
+ // $JUnit-BEGIN$
+
+ suite.addTestSuite(BigDecimalArithmeticTest.class);
+ suite.addTestSuite(BigDecimalCompareTest.class);
+ suite.addTestSuite(BigDecimalConstructorsTest.class);
+ suite.addTestSuite(BigDecimalConvertTest.class);
+ suite.addTestSuite(BigDecimalScaleOperationsTest.class);
+ suite.addTestSuite(BigIntegerAddTest.class);
+ suite.addTestSuite(BigIntegerAndTest.class);
+ suite.addTestSuite(BigIntegerCompareTest.class);
+ suite.addTestSuite(BigIntegerConstructorsTest.class);
+ suite.addTestSuite(BigIntegerConvertTest.class);
+ suite.addTestSuite(BigIntegerDivideTest.class);
+ suite.addTestSuite(BigIntegerHashCodeTest.class);
+ suite.addTestSuite(BigIntegerModPowTest.class);
+ suite.addTestSuite(BigIntegerMultiplyTest.class);
+ suite.addTestSuite(BigIntegerNotTest.class);
+ suite.addTestSuite(BigIntegerOperateBitsTest.class);
+ suite.addTestSuite(BigIntegerOrTest.class);
+ suite.addTestSuite(BigIntegerSubtractTest.class);
+ suite.addTestSuite(BigIntegerToStringTest.class);
+ suite.addTestSuite(BigIntegerXorTest.class);
+
+ // $JUnit-END$
+ return suite;
+ }
+}
diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalArithmeticTest.java b/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalArithmeticTest.java
index aa0bac1..929a85f 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalArithmeticTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalArithmeticTest.java
@@ -17,13 +17,19 @@
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: add, subtract, multiply, divide
@@ -33,6 +39,15 @@ 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}
+ )
+ })
public void testAddEqualScalePosPos() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 10;
@@ -50,6 +65,15 @@ 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}
+ )
+ })
public void testAddMathContextEqualScalePosPos() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 10;
@@ -68,6 +92,15 @@ 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}
+ )
+ })
public void testAddEqualScaleNegNeg() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = -10;
@@ -85,6 +118,15 @@ 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}
+ )
+ })
public void testAddMathContextEqualScaleNegNeg() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = -10;
@@ -103,6 +145,15 @@ 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}
+ )
+ })
public void testAddDiffScalePosNeg() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 15;
@@ -120,6 +171,15 @@ 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}
+ )
+ })
public void testAddMathContextDiffScalePosNeg() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 15;
@@ -138,6 +198,15 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* 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}
+ )
+ })
public void testAddDiffScaleNegPos() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = -15;
@@ -155,6 +224,15 @@ 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}
+ )
+ })
public void testAddDiffScaleZeroZero() {
String a = "0";
int aScale = -15;
@@ -172,6 +250,15 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* 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}
+ )
+ })
public void testSubtractEqualScalePosPos() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 10;
@@ -189,6 +276,15 @@ 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}
+ )
+ })
public void testSubtractMathContextEqualScalePosPos() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 10;
@@ -207,6 +303,15 @@ 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}
+ )
+ })
public void testSubtractEqualScaleNegNeg() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = -10;
@@ -224,6 +329,15 @@ 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}
+ )
+ })
public void testSubtractDiffScalePosNeg() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 15;
@@ -242,6 +356,15 @@ 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}
+ )
+ })
public void testSubtractMathContextDiffScalePosNeg() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 15;
@@ -260,6 +383,15 @@ 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}
+ )
+ })
public void testSubtractDiffScaleNegPos() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = -15;
@@ -278,6 +410,15 @@ 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}
+ )
+ })
public void testSubtractMathContextDiffScaleNegPos() {
String a = "986798656676789766678767876078779810457634781384756794987";
int aScale = -15;
@@ -296,6 +437,15 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* 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}
+ )
+ })
public void testMultiplyScalePosPos() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 15;
@@ -313,6 +463,15 @@ 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}
+ )
+ })
public void testMultiplyMathContextScalePosPos() {
String a = "97665696756578755423325476545428779810457634781384756794987";
int aScale = -25;
@@ -331,6 +490,15 @@ 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}
+ )
+ })
public void testMultiplyEqualScaleNegNeg() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = -15;
@@ -348,6 +516,15 @@ 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}
+ )
+ })
public void testMultiplyDiffScalePosNeg() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 10;
@@ -365,6 +542,15 @@ 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}
+ )
+ })
public void testMultiplyMathContextDiffScalePosNeg() {
String a = "987667796597975765768768767866756808779810457634781384756794987";
int aScale = 100;
@@ -383,6 +569,15 @@ 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}
+ )
+ })
public void testMultiplyDiffScaleNegPos() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = -15;
@@ -400,6 +595,15 @@ 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}
+ )
+ })
public void testMultiplyMathContextDiffScaleNegPos() {
String a = "488757458676796558668876576576579097029810457634781384756794987";
int aScale = -63;
@@ -418,6 +622,15 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* pow(int)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "ArithmeticException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "pow",
+ methodArgs = {int.class}
+ )
+ })
public void testPow() {
String a = "123121247898748298842980";
int aScale = 10;
@@ -436,6 +649,15 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* pow(0)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "ArithmeticException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "pow",
+ methodArgs = {int.class}
+ )
+ })
public void testPow0() {
String a = "123121247898748298842980";
int aScale = 10;
@@ -451,6 +673,15 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* ZERO.pow(0)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "ArithmeticException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "pow",
+ methodArgs = {int.class}
+ )
+ })
public void testZeroPow0() {
String c = "1";
int cScale = 0;
@@ -462,6 +693,15 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* pow(int, MathContext)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "ArithmeticException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "pow",
+ methodArgs = {int.class, java.math.MathContext.class}
+ )
+ })
public void testPowMathContext() {
String a = "123121247898748298842980";
int aScale = 10;
@@ -478,6 +718,15 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* Divide by zero
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "ArithmeticException checked.",
+ targets = {
+ @TestTarget(
+ methodName = "divide",
+ methodArgs = {java.math.BigDecimal.class}
+ )
+ })
public void testDivideByZero() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 15;
@@ -494,6 +743,15 @@ 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}
+ )
+ })
public void testDivideExceptionRM() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 15;
@@ -512,6 +770,15 @@ 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}
+ )
+ })
public void testDivideExceptionInvalidRM() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 15;
@@ -530,6 +797,15 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* 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}
+ )
+ })
public void testDivideExpLessZero() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 15;
@@ -547,6 +823,15 @@ 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}
+ )
+ })
public void testDivideExpEqualsZero() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = -15;
@@ -564,6 +849,15 @@ 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}
+ )
+ })
public void testDivideExpGreaterZero() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = -15;
@@ -581,6 +875,15 @@ 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}
+ )
+ })
public void testDivideRemainderIsZero() {
String a = "8311389578904553209874735431110";
int aScale = -15;
@@ -598,6 +901,15 @@ 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}
+ )
+ })
public void testDivideRoundUpNeg() {
String a = "-92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -615,6 +927,15 @@ 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}
+ )
+ })
public void testDivideRoundUpPos() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -632,6 +953,15 @@ 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}
+ )
+ })
public void testDivideRoundDownNeg() {
String a = "-92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -649,6 +979,15 @@ 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}
+ )
+ })
public void testDivideRoundDownPos() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -666,6 +1005,15 @@ 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}
+ )
+ })
public void testDivideRoundFloorPos() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -683,6 +1031,15 @@ 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}
+ )
+ })
public void testDivideRoundFloorNeg() {
String a = "-92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -700,6 +1057,15 @@ 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}
+ )
+ })
public void testDivideRoundCeilingPos() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -717,6 +1083,15 @@ 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}
+ )
+ })
public void testDivideRoundCeilingNeg() {
String a = "-92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -734,6 +1109,15 @@ 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}
+ )
+ })
public void testDivideRoundHalfUpPos() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -751,7 +1135,16 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* Divide: rounding mode is ROUND_HALF_UP, result is negative; distance = -1
*/
- public void testDivideRoundHalfUpNeg() {
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "ROUND_UNNECESSARY and exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "divide",
+ methodArgs = {java.math.BigDecimal.class, int.class, int.class}
+ )
+ })
+ public void testDivideRoundHalfUpNeg() {
String a = "-92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
String b = "7472334223847623782375469293018787918347987234564568";
@@ -768,6 +1161,15 @@ 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}
+ )
+ })
public void testDivideRoundHalfUpPos1() {
String a = "92948782094488478231212478987482988798104576347813847567949855464535634534563456";
int aScale = -24;
@@ -785,6 +1187,15 @@ 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}
+ )
+ })
public void testDivideRoundHalfUpNeg1() {
String a = "-92948782094488478231212478987482988798104576347813847567949855464535634534563456";
int aScale = -24;
@@ -802,6 +1213,15 @@ 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}
+ )
+ })
public void testDivideRoundHalfUpNeg2() {
String a = "-37361671119238118911893939591735";
int aScale = 10;
@@ -819,6 +1239,15 @@ 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}
+ )
+ })
public void testDivideRoundHalfDownPos() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -836,6 +1265,15 @@ 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}
+ )
+ })
public void testDivideRoundHalfDownNeg() {
String a = "-92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -853,6 +1291,15 @@ 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}
+ )
+ })
public void testDivideRoundHalfDownPos1() {
String a = "92948782094488478231212478987482988798104576347813847567949855464535634534563456";
int aScale = -24;
@@ -870,6 +1317,15 @@ 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}
+ )
+ })
public void testDivideRoundHalfDownNeg1() {
String a = "-92948782094488478231212478987482988798104576347813847567949855464535634534563456";
int aScale = -24;
@@ -887,6 +1343,15 @@ 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}
+ )
+ })
public void testDivideRoundHalfDownNeg2() {
String a = "-37361671119238118911893939591735";
int aScale = 10;
@@ -904,6 +1369,15 @@ 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}
+ )
+ })
public void testDivideRoundHalfEvenPos() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -921,6 +1395,15 @@ 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}
+ )
+ })
public void testDivideRoundHalfEvenNeg() {
String a = "-92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -938,6 +1421,15 @@ 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}
+ )
+ })
public void testDivideRoundHalfEvenPos1() {
String a = "92948782094488478231212478987482988798104576347813847567949855464535634534563456";
int aScale = -24;
@@ -955,6 +1447,15 @@ 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}
+ )
+ })
public void testDivideRoundHalfEvenNeg1() {
String a = "-92948782094488478231212478987482988798104576347813847567949855464535634534563456";
int aScale = -24;
@@ -972,6 +1473,15 @@ 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}
+ )
+ })
public void testDivideRoundHalfEvenNeg2() {
String a = "-37361671119238118911893939591735";
int aScale = 10;
@@ -989,6 +1499,15 @@ 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}
+ )
+ })
public void testDivideBigDecimal1() {
String a = "-37361671119238118911893939591735";
int aScale = 10;
@@ -1006,6 +1525,15 @@ 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}
+ )
+ })
public void testDivideBigDecimal2() {
String a = "-37361671119238118911893939591735";
int aScale = 10;
@@ -1023,6 +1551,15 @@ 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}
+ )
+ })
public void testDivideBigDecimalScaleRoundingModeUP() {
String a = "-37361671119238118911893939591735";
int aScale = 10;
@@ -1041,6 +1578,15 @@ 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}
+ )
+ })
public void testDivideBigDecimalScaleRoundingModeDOWN() {
String a = "-37361671119238118911893939591735";
int aScale = 10;
@@ -1059,6 +1605,15 @@ 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}
+ )
+ })
public void testDivideBigDecimalScaleRoundingModeCEILING() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 100;
@@ -1077,6 +1632,15 @@ 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}
+ )
+ })
public void testDivideBigDecimalScaleRoundingModeFLOOR() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 100;
@@ -1095,6 +1659,15 @@ 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}
+ )
+ })
public void testDivideBigDecimalScaleRoundingModeHALF_UP() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = -51;
@@ -1115,6 +1688,15 @@ 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}
+ )
+ })
public void testDivideBigDecimalScaleRoundingModeHALF_DOWN() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 5;
@@ -1133,6 +1715,15 @@ 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}
+ )
+ })
public void testDivideBigDecimalScaleRoundingModeHALF_EVEN() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 5;
@@ -1151,6 +1742,15 @@ 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}
+ )
+ })
public void testDivideBigDecimalScaleMathContextUP() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 15;
@@ -1171,6 +1771,15 @@ 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}
+ )
+ })
public void testDivideBigDecimalScaleMathContextDOWN() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 15;
@@ -1191,6 +1800,15 @@ 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}
+ )
+ })
public void testDivideBigDecimalScaleMathContextCEILING() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 15;
@@ -1211,6 +1829,15 @@ 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}
+ )
+ })
public void testDivideBigDecimalScaleMathContextFLOOR() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 15;
@@ -1231,6 +1858,15 @@ 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}
+ )
+ })
public void testDivideBigDecimalScaleMathContextHALF_UP() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 45;
@@ -1251,6 +1887,15 @@ 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}
+ )
+ })
public void testDivideBigDecimalScaleMathContextHALF_DOWN() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 45;
@@ -1271,6 +1916,15 @@ 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}
+ )
+ })
public void testDivideBigDecimalScaleMathContextHALF_EVEN() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 45;
@@ -1291,6 +1945,15 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* divideToIntegralValue(BigDecimal)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "ArithmeticException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "divideToIntegralValue",
+ methodArgs = {java.math.BigDecimal.class}
+ )
+ })
public void testDivideToIntegralValue() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 45;
@@ -1308,6 +1971,15 @@ 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}
+ )
+ })
public void testDivideToIntegralValueMathContextUP() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 45;
@@ -1328,6 +2000,15 @@ 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}
+ )
+ })
public void testDivideToIntegralValueMathContextDOWN() {
String a = "3736186567876876578956958769675785435673453453653543654354365435675671119238118911893939591735";
int aScale = 45;
@@ -1348,6 +2029,15 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* divideAndRemainder(BigDecimal)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "ArithmeticException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "divideAndRemainder",
+ methodArgs = {java.math.BigDecimal.class}
+ )
+ })
public void testDivideAndRemainder1() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 45;
@@ -1369,6 +2059,15 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* divideAndRemainder(BigDecimal)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "ArithmeticException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "divideAndRemainder",
+ methodArgs = {java.math.BigDecimal.class}
+ )
+ })
public void testDivideAndRemainder2() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = -45;
@@ -1392,6 +2091,15 @@ 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}
+ )
+ })
public void testDivideAndRemainderMathContextUP() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 45;
@@ -1416,6 +2124,15 @@ 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}
+ )
+ })
public void testDivideAndRemainderMathContextDOWN() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 45;
@@ -1440,6 +2157,15 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* remainder(BigDecimal)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "ArithmeticException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "remainder",
+ methodArgs = {java.math.BigDecimal.class}
+ )
+ })
public void testRemainder1() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 45;
@@ -1457,6 +2183,15 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* remainder(BigDecimal)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "ArithmeticException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "remainder",
+ methodArgs = {java.math.BigDecimal.class}
+ )
+ })
public void testRemainder2() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = -45;
@@ -1474,6 +2209,15 @@ 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}
+ )
+ })
public void testRemainderMathContextHALF_UP() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 45;
@@ -1494,6 +2238,15 @@ 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}
+ )
+ })
public void testRemainderMathContextHALF_DOWN() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = -45;
@@ -1514,6 +2267,15 @@ 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}
+ )
+ })
public void testRoundMathContextHALF_DOWN() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = -45;
@@ -1531,6 +2293,15 @@ 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}
+ )
+ })
public void testRoundMathContextHALF_UP() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 45;
@@ -1548,6 +2319,15 @@ 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}
+ )
+ })
public void testRoundMathContextPrecision0() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 45;
@@ -1564,6 +2344,15 @@ public class BigDecimalArithmeticTest extends TestCase {
/**
* 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 = {}
+ )
+ })
public void testUlpPos() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = -45;
@@ -1578,6 +2367,15 @@ 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 = {}
+ )
+ })
public void testUlpNeg() {
String a = "-3736186567876876578956958765675671119238118911893939591735";
int aScale = 45;
@@ -1592,6 +2390,15 @@ 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 = {}
+ )
+ })
public void testUlpZero() {
String a = "0";
int aScale = 2;
@@ -1608,6 +2415,15 @@ 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}
+ )
+ })
public void test_addBigDecimal() {
BigDecimal add1 = new BigDecimal("23.456");
BigDecimal add2 = new BigDecimal("3849.235");
@@ -1626,6 +2442,15 @@ 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}
+ )
+ })
public void test_DivideBigDecimalRoundingModeUP() {
String a = "-37361671119238118911893939591735";
String b = "74723342238476237823787879183470";
@@ -1641,6 +2466,15 @@ 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}
+ )
+ })
public void test_DivideBigDecimalRoundingModeDOWN() {
String a = "-37361671119238118911893939591735";
String b = "74723342238476237823787879183470";
@@ -1656,6 +2490,15 @@ 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}
+ )
+ })
public void test_DivideBigDecimalRoundingModeCEILING() {
String a = "3736186567876876578956958765675671119238118911893939591735";
String b = "74723342238476237823787879183470";
@@ -1671,6 +2514,15 @@ 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}
+ )
+ })
public void test_DivideBigDecimalRoundingModeFLOOR() {
String a = "3736186567876876578956958765675671119238118911893939591735";
String b = "74723342238476237823787879183470";
@@ -1686,6 +2538,15 @@ 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}
+ )
+ })
public void test_DivideBigDecimalRoundingModeHALF_UP() {
String a = "3736186567876876578956958765675671119238118911893939591735";
String b = "74723342238476237823787879183470";
@@ -1701,6 +2562,15 @@ 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}
+ )
+ })
public void test_DivideBigDecimalRoundingModeHALF_DOWN() {
String a = "3736186567876876578956958765675671119238118911893939591735";
int aScale = 5;
@@ -1720,6 +2590,15 @@ 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}
+ )
+ })
public void test_DivideBigDecimalRoundingModeHALF_EVEN() {
String a = "3736186567876876578956958765675671119238118911893939591735";
String b = "74723342238476237823787879183470";
@@ -1735,6 +2614,15 @@ 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}
+ )
+ })
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/tests/java/math/BigDecimalCompareTest.java
index b0b5e22..fe19a93 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalCompareTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalCompareTest.java
@@ -21,13 +21,18 @@
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: abs, compareTo, equals, hashCode,
@@ -37,6 +42,15 @@ 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 = {}
+ )
+ })
public void testAbsNeg() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -47,6 +61,15 @@ 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 = {}
+ )
+ })
public void testAbsPos() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -57,6 +80,15 @@ 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}
+ )
+ })
public void testAbsMathContextNeg() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -73,6 +105,15 @@ public class BigDecimalCompareTest extends TestCase {
/**
* Abs(MathContext) of a positive BigDecimal
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "ArithmeticException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "abs",
+ methodArgs = {java.math.MathContext.class}
+ )
+ })
public void testAbsMathContextPos() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -89,6 +130,15 @@ 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}
+ )
+ })
public void testCompareEqualScale1() {
String a = "12380964839238475457356735674573563567890295784902768787678287";
int aScale = 18;
@@ -103,6 +153,15 @@ 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}
+ )
+ })
public void testCompareEqualScale2() {
String a = "12380964839238475457356735674573563567890295784902768787678287";
int aScale = 18;
@@ -117,6 +176,15 @@ 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}
+ )
+ })
public void testCompareGreaterScale1() {
String a = "12380964839238475457356735674573563567890295784902768787678287";
int aScale = 28;
@@ -131,6 +199,15 @@ 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}
+ )
+ })
public void testCompareGreaterScale2() {
String a = "12380964839238475457356735674573563567890295784902768787678287";
int aScale = 48;
@@ -145,6 +222,15 @@ 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}
+ )
+ })
public void testCompareLessScale1() {
String a = "12380964839238475457356735674573563567890295784902768787678287";
int aScale = 18;
@@ -159,6 +245,15 @@ 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}
+ )
+ })
public void testCompareLessScale2() {
String a = "12380964839238475457356735674573";
int aScale = 36;
@@ -173,6 +268,15 @@ 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}
+ )
+ })
public void testEqualsUnequal1() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -186,6 +290,15 @@ 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}
+ )
+ })
public void testEqualsUnequal2() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -199,6 +312,15 @@ 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}
+ )
+ })
public void testEqualsUnequal3() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -210,6 +332,15 @@ 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}
+ )
+ })
public void testEqualsEqual() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -223,6 +354,15 @@ 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}
+ )
+ })
public void testEqualsNull() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -233,6 +373,15 @@ 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 = {}
+ )
+ })
public void testHashCodeEqual() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = -24;
@@ -246,6 +395,15 @@ 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 = {}
+ )
+ })
public void testHashCodeUnequal() {
String a = "8478231212478987482988429808779810457634781384756794987";
int aScale = 41;
@@ -259,6 +417,15 @@ 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}
+ )
+ })
public void testMaxEqual() {
String a = "8478231212478987482988429808779810457634781384756794987";
int aScale = 41;
@@ -275,6 +442,15 @@ 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}
+ )
+ })
public void testMaxUnequal1() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = 24;
@@ -291,6 +467,15 @@ 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}
+ )
+ })
public void testMaxUnequal2() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = 41;
@@ -307,6 +492,15 @@ 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}
+ )
+ })
public void testMinEqual() {
String a = "8478231212478987482988429808779810457634781384756794987";
int aScale = 41;
@@ -323,6 +517,15 @@ 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}
+ )
+ })
public void testMinUnequal1() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = 24;
@@ -339,6 +542,15 @@ 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}
+ )
+ })
public void testMinUnequal2() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = 41;
@@ -355,6 +567,15 @@ 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 = {}
+ )
+ })
public void testPlusPositive() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = 41;
@@ -368,6 +589,15 @@ 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}
+ )
+ })
public void testPlusMathContextPositive() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = 41;
@@ -385,6 +615,15 @@ 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 = {}
+ )
+ })
public void testPlusNegative() {
String a = "-92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = 41;
@@ -398,6 +637,15 @@ 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}
+ )
+ })
public void testPlusMathContextNegative() {
String a = "-92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = 49;
@@ -415,6 +663,15 @@ 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 = {}
+ )
+ })
public void testNegatePositive() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = 41;
@@ -428,6 +685,15 @@ 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}
+ )
+ })
public void testNegateMathContextPositive() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = 41;
@@ -445,6 +711,15 @@ public class BigDecimalCompareTest extends TestCase {
/**
* 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 = {}
+ )
+ })
public void testNegateNegative() {
String a = "-92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = 41;
@@ -458,6 +733,15 @@ 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}
+ )
+ })
public void testNegateMathContextNegative() {
String a = "-92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = 49;
@@ -475,6 +759,15 @@ 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 = {}
+ )
+ })
public void testSignumPositive() {
String a = "92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = 41;
@@ -485,6 +778,15 @@ 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 = {}
+ )
+ })
public void testSignumNegative() {
String a = "-92948782094488478231212478987482988429808779810457634781384756794987";
int aScale = 41;
@@ -495,6 +797,15 @@ 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 = {}
+ )
+ })
public void testSignumZero() {
String a = "0";
int aScale = 41;
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
index c0e30a2..44966e3 100644
--- 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
@@ -21,13 +21,18 @@
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
@@ -66,6 +71,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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);
@@ -84,6 +98,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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);
@@ -96,6 +119,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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);
@@ -112,6 +144,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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);
@@ -129,6 +170,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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);
@@ -148,6 +198,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -169,6 +228,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -193,6 +261,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -210,6 +287,16 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -227,6 +314,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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
@@ -239,6 +335,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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 {
@@ -253,6 +358,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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 {
@@ -267,6 +381,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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 {
@@ -281,6 +404,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -293,6 +425,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -308,6 +449,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -320,6 +470,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -332,6 +491,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -344,6 +512,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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";
@@ -356,6 +533,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -371,6 +557,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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";
@@ -383,6 +578,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -398,6 +602,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -411,6 +624,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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 {
@@ -424,6 +646,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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 {
@@ -436,6 +667,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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 {
@@ -449,6 +689,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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 {
@@ -462,6 +711,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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 {
@@ -475,6 +733,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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;
@@ -488,6 +755,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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 {
@@ -502,6 +778,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -514,6 +799,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -526,6 +820,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -539,6 +842,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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;
@@ -552,6 +864,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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;
@@ -565,6 +886,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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;
@@ -578,6 +908,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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;
@@ -591,6 +930,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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;
@@ -604,6 +952,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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;
@@ -617,6 +974,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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;
@@ -630,6 +996,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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;
@@ -643,6 +1018,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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;
@@ -656,6 +1040,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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;
@@ -669,6 +1062,15 @@ public class BigDecimalConstructorsTest extends TestCase {
* 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;
@@ -681,6 +1083,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* 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;
@@ -698,6 +1109,15 @@ public class BigDecimalConstructorsTest extends 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}
+ )
+ })
public void test_Constructor_java_math_BigInteger_int() {
BigInteger value = new BigInteger("12345908");
BigDecimal big = new BigDecimal(value);
@@ -717,6 +1137,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* @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
@@ -745,6 +1174,15 @@ public class BigDecimalConstructorsTest extends TestCase {
/**
* @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(
diff --git a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConvertTest.java b/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConvertTest.java
index ecc1dfa..9fb353f 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConvertTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConvertTest.java
@@ -21,12 +21,18 @@
package org.apache.harmony.tests.java.math;
-import junit.framework.TestCase;
+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.RoundingMode;
import java.math.MathContext;
+import junit.framework.TestCase;
+@TestTargetClass(BigDecimal.class)
/**
* Class: java.math.BigDecimal
* Methods: doubleValue, floatValue, intValue, longValue,
@@ -36,6 +42,15 @@ 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 = {}
+ )
+ })
public void testDoubleValueNeg() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -46,6 +61,15 @@ 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 = {}
+ )
+ })
public void testDoubleValuePos() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -56,6 +80,15 @@ 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 = {}
+ )
+ })
public void testDoubleValuePosInfinity() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E+400";
BigDecimal aNumber = new BigDecimal(a);
@@ -66,6 +99,15 @@ 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 = {}
+ )
+ })
public void testDoubleValueNegInfinity() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E+400";
BigDecimal aNumber = new BigDecimal(a);
@@ -76,6 +118,15 @@ 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 = {}
+ )
+ })
public void testDoubleValueMinusZero() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E-400";
BigDecimal aNumber = new BigDecimal(a);
@@ -87,6 +138,15 @@ 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 = {}
+ )
+ })
public void testDoubleValuePlusZero() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E-400";
BigDecimal aNumber = new BigDecimal(a);
@@ -98,6 +158,15 @@ 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 = {}
+ )
+ })
public void testFloatValueNeg() {
String a = "-1238096483923847.6356789029578E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -108,6 +177,15 @@ 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 = {}
+ )
+ })
public void testFloatValuePos() {
String a = "1238096483923847.6356789029578E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -118,6 +196,15 @@ 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 = {}
+ )
+ })
public void testFloatValuePosInfinity() {
String a = "123809648373567356745735.6356789787678287E+200";
BigDecimal aNumber = new BigDecimal(a);
@@ -128,6 +215,15 @@ 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 = {}
+ )
+ })
public void testFloatValueNegInfinity() {
String a = "-123809648392384755735.63567887678287E+200";
BigDecimal aNumber = new BigDecimal(a);
@@ -138,6 +234,15 @@ 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 = {}
+ )
+ })
public void testFloatValueMinusZero() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E-400";
BigDecimal aNumber = new BigDecimal(a);
@@ -149,6 +254,15 @@ 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 = {}
+ )
+ })
public void testFloatValuePlusZero() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E-400";
BigDecimal aNumber = new BigDecimal(a);
@@ -160,6 +274,15 @@ 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 = {}
+ )
+ })
public void testIntValueNeg() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -170,6 +293,15 @@ 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 = {}
+ )
+ })
public void testIntValuePos() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -180,6 +312,15 @@ 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 = {}
+ )
+ })
public void testLongValueNeg() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -190,6 +331,15 @@ 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 = {}
+ )
+ })
public void testLongValuePos() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -200,6 +350,15 @@ public class BigDecimalConvertTest extends TestCase {
/**
* scaleByPowerOfTen(int n)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "ArithmeticException checking missed",
+ targets = {
+ @TestTarget(
+ methodName = "scaleByPowerOfTen",
+ methodArgs = {int.class}
+ )
+ })
public void testScaleByPowerOfTen1() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 13;
@@ -214,6 +373,15 @@ public class BigDecimalConvertTest extends TestCase {
/**
* scaleByPowerOfTen(int n)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "ArithmeticException checking missed",
+ targets = {
+ @TestTarget(
+ methodName = "scaleByPowerOfTen",
+ methodArgs = {int.class}
+ )
+ })
public void testScaleByPowerOfTen2() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = -13;
@@ -228,6 +396,15 @@ 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 = {}
+ )
+ })
public void testToBigIntegerPos1() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E+21";
BigInteger bNumber = new BigInteger("123809648392384754573567356745735635678902957849027687");
@@ -239,6 +416,15 @@ 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 = {}
+ )
+ })
public void testToBigIntegerPos2() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E+15";
BigInteger bNumber = new BigInteger("123809648392384754573567356745735635678902957849");
@@ -250,6 +436,15 @@ 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 = {}
+ )
+ })
public void testToBigIntegerPos3() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E+45";
BigInteger bNumber = new BigInteger("123809648392384754573567356745735635678902957849027687876782870000000000000000");
@@ -261,6 +456,15 @@ 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 = {}
+ )
+ })
public void testToBigIntegerNeg1() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21";
BigInteger bNumber = new BigInteger("-123809648392384754573567356745735635678902957849027687");
@@ -272,6 +476,15 @@ 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 = {}
+ )
+ })
public void testToBigIntegerNeg2() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E+15";
BigInteger bNumber = new BigInteger("-123809648392384754573567356745735635678902957849");
@@ -283,6 +496,15 @@ 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 = {}
+ )
+ })
public void testToBigIntegerNeg3() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E+45";
BigInteger bNumber = new BigInteger("-123809648392384754573567356745735635678902957849027687876782870000000000000000");
@@ -294,6 +516,15 @@ 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 = {}
+ )
+ })
public void testToBigIntegerZero() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E-500";
BigInteger bNumber = new BigInteger("0");
@@ -305,6 +536,15 @@ 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 = {}
+ )
+ })
public void testToBigIntegerExact1() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E+45";
BigDecimal aNumber = new BigDecimal(a);
@@ -316,6 +556,15 @@ 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 = {}
+ )
+ })
public void testToBigIntegerExactException() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E-10";
BigDecimal aNumber = new BigDecimal(a);
@@ -330,6 +579,15 @@ 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 = {}
+ )
+ })
public void testToEngineeringStringPos() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E-501";
BigDecimal aNumber = new BigDecimal(a);
@@ -340,6 +598,15 @@ 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 = {}
+ )
+ })
public void testToEngineeringStringNeg() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E-501";
BigDecimal aNumber = new BigDecimal(a);
@@ -350,6 +617,15 @@ 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 = {}
+ )
+ })
public void testToEngineeringStringZeroPosExponent() {
String a = "0.0E+16";
BigDecimal aNumber = new BigDecimal(a);
@@ -360,6 +636,15 @@ 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 = {}
+ )
+ })
public void testToEngineeringStringZeroNegExponent() {
String a = "0.0E-16";
BigDecimal aNumber = new BigDecimal(a);
@@ -371,6 +656,15 @@ 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 = {}
+ )
+ })
public void testToPlainStringNegNegExp() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E-100";
BigDecimal aNumber = new BigDecimal(a);
@@ -383,6 +677,15 @@ 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 = {}
+ )
+ })
public void testToPlainStringNegPosExp() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E100";
BigDecimal aNumber = new BigDecimal(a);
@@ -395,6 +698,15 @@ 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 = {}
+ )
+ })
public void testToPlainStringPosNegExp() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E-100";
BigDecimal aNumber = new BigDecimal(a);
@@ -407,6 +719,15 @@ 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 = {}
+ )
+ })
public void testToPlainStringPosPosExp() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E+100";
BigDecimal aNumber = new BigDecimal(a);
@@ -418,6 +739,15 @@ 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 = {}
+ )
+ })
public void testToStringZeroScale() {
String a = "-123809648392384754573567356745735635678902957849027687876782870";
BigDecimal aNumber = new BigDecimal(new BigInteger(a));
@@ -428,6 +758,15 @@ 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 = {}
+ )
+ })
public void testToStringPos() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E-500";
BigDecimal aNumber = new BigDecimal(a);
@@ -438,6 +777,15 @@ 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 = {}
+ )
+ })
public void testToStringNeg() {
String a = "-123.4564563673567380964839238475457356735674573563567890295784902768787678287E-5";
BigDecimal aNumber = new BigDecimal(a);
@@ -448,6 +796,15 @@ 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 = {}
+ )
+ })
public void testValueOfPosZeroScale() {
long a = 98374823947823578L;
BigDecimal aNumber = BigDecimal.valueOf(a);
@@ -458,6 +815,15 @@ 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 = {}
+ )
+ })
public void testValueOfNegZeroScale() {
long a = -98374823947823578L;
BigDecimal aNumber = BigDecimal.valueOf(a);
@@ -468,6 +834,15 @@ 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 = {}
+ )
+ })
public void testValueOfNegScalePos() {
long a = -98374823947823578L;
int scale = 12;
@@ -479,6 +854,15 @@ 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 = {}
+ )
+ })
public void testValueOfNegScaleNeg() {
long a = -98374823947823578L;
int scale = -12;
@@ -490,6 +874,15 @@ 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 = {}
+ )
+ })
public void testValueOfPosScalePos() {
long a = 98374823947823578L;
int scale = 12;
@@ -501,6 +894,15 @@ 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 = {}
+ )
+ })
public void testValueOfPosScaleNeg() {
long a = 98374823947823578L;
int scale = -12;
@@ -512,6 +914,15 @@ 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 = {}
+ )
+ })
public void testValueOfDoubleNeg() {
double a = -65678765876567576.98788767;
BigDecimal result = BigDecimal.valueOf(a);
@@ -524,6 +935,15 @@ 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 = {}
+ )
+ })
public void testValueOfDoublePos1() {
double a = 65678765876567576.98788767;
BigDecimal result = BigDecimal.valueOf(a);
@@ -536,6 +956,15 @@ 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 = {}
+ )
+ })
public void testValueOfDoublePos2() {
double a = 12321237576.98788767;
BigDecimal result = BigDecimal.valueOf(a);
@@ -548,6 +977,15 @@ 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 = {}
+ )
+ })
public void testValueOfDoublePos3() {
double a = 12321237576.9878838;
BigDecimal result = BigDecimal.valueOf(a);
@@ -560,6 +998,15 @@ public class BigDecimalConvertTest extends TestCase {
/**
* valueOf(Double.NaN)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Checks NumberFormatException",
+ targets = {
+ @TestTarget(
+ methodName = "valueOf",
+ methodArgs = {double.class}
+ )
+ })
public void testValueOfDoubleNaN() {
double a = Double.NaN;
try {
@@ -576,6 +1023,15 @@ 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 = {}
+ )
+ })
public void test_IntValueExactNeg() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -591,6 +1047,15 @@ 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 = {}
+ )
+ })
public void test_IntValueExactPos() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -606,6 +1071,15 @@ 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 = {}
+ )
+ })
public void test_IntValueExactFloatNeg() {
BigDecimal aNumber = new BigDecimal("-2147483647.999");
try {
@@ -620,6 +1094,15 @@ 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 = {}
+ )
+ })
public void test_IntValueExactFloatPos() {
float a = 2147483646.99999F;
BigDecimal aNumber = new BigDecimal(a);
@@ -635,6 +1118,15 @@ 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 = {}
+ )
+ })
public void test_IntValueExactLongPos() {
long a = 2147483647L;
BigDecimal aNumber = new BigDecimal(a);
@@ -646,6 +1138,15 @@ 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 = {}
+ )
+ })
public void test_IntValueExactLongNeg() {
long a = -2147483648L;
BigDecimal aNumber = new BigDecimal(a);
@@ -657,6 +1158,15 @@ 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 = {}
+ )
+ })
public void test_LongValueExactNeg() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -672,6 +1182,15 @@ 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 = {}
+ )
+ })
public void test_LongValueExactPos() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -687,6 +1206,15 @@ 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 = {}
+ )
+ })
public void test_LongValueExactFloatNeg() {
BigDecimal aNumber = new BigDecimal("-9223372036854775807.99999");
try {
@@ -701,6 +1229,15 @@ 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 = {}
+ )
+ })
public void test_LongValueExactFloatPos() {
float a = 9223372036854775806.99999F;
BigDecimal aNumber = new BigDecimal(a);
@@ -716,6 +1253,15 @@ 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 = {}
+ )
+ })
public void test_ByteValueExactPos() {
int i = 127;
BigDecimal bdNumber = new BigDecimal(i);
@@ -727,6 +1273,15 @@ 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 = {}
+ )
+ })
public void test_ByteValueExactNeg() {
String sNumber = "-127.56789";
int iNumber = -128;
@@ -742,6 +1297,15 @@ 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 = {}
+ )
+ })
public void test_ByteValueExactCharZero() {
char[] cNumber = {
'-', '0', '.', '0'
@@ -759,6 +1323,15 @@ 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 = {}
+ )
+ })
public void test_ByteValueExactStringZero() {
String sNumber = "00000000000000";
int iNumber = 0;
@@ -774,6 +1347,15 @@ 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 = {}
+ )
+ })
public void test_ByteValueExactDoubleMax() {
double dNumber = Double.MAX_VALUE;
BigDecimal bdNumber = new BigDecimal(dNumber);
@@ -790,6 +1372,15 @@ 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 = {}
+ )
+ })
public void test_ByteValueExactDoubleMin() {
double dNumber = Double.MIN_VALUE;
BigDecimal bdNumber = new BigDecimal(dNumber);
@@ -806,6 +1397,15 @@ 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 = {}
+ )
+ })
public void test_ByteValueExactFloatPos() {
float fNumber = 123.5445F;
BigDecimal bdNumber = new BigDecimal(fNumber);
@@ -822,6 +1422,15 @@ 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 = {}
+ )
+ })
public void test_ByteValueExactFloatNeg() {
float fNumber = -12.987654321F;
BigDecimal bdNumber = new BigDecimal(fNumber);
@@ -838,6 +1447,15 @@ 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 = {}
+ )
+ })
public void test_ByteValueExactDouble() {
double dNumber = 123.0000D;
BigDecimal bdNumber = new BigDecimal(dNumber);
@@ -850,6 +1468,15 @@ 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 = {}
+ )
+ })
public void test_ByteValueExactLongMin() {
long lNumber = Long.MIN_VALUE;
BigDecimal bdNumber = new BigDecimal(lNumber);
@@ -866,6 +1493,15 @@ 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 = {}
+ )
+ })
public void test_ByteValueExactIntMax() {
int iNumber = Integer.MAX_VALUE;
BigDecimal bdNumber = new BigDecimal(iNumber);
@@ -1050,6 +1686,15 @@ 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 = {}
+ )
+ })
public void test_ShortValueExactNeg() {
String a = "-123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -1065,6 +1710,15 @@ 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 = {}
+ )
+ })
public void test_ShortValueExactPos() {
String a = "123809648392384754573567356745735.63567890295784902768787678287E+21";
BigDecimal aNumber = new BigDecimal(a);
@@ -1080,6 +1734,15 @@ 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 = {}
+ )
+ })
public void test_ShortValueExactFloatNeg() {
BigDecimal aNumber = new BigDecimal("-32766.99999");
try {
@@ -1094,6 +1757,15 @@ 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 = {}
+ )
+ })
public void test_ShortValueExactFloatPos() {
float a = 32767.99999F;
BigDecimal aNumber = new BigDecimal(a);
@@ -1109,6 +1781,15 @@ 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 = {}
+ )
+ })
public void test_ShortValueExactLongPos() {
long a = 12345L;
BigDecimal aNumber = new BigDecimal(a);
@@ -1120,6 +1801,15 @@ 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 = {}
+ )
+ })
public void test_ShortValueExactLongNeg() {
long a = -12345L;
BigDecimal aNumber = new BigDecimal(a);
@@ -1131,6 +1821,15 @@ 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 = {}
+ )
+ })
public void test_stripTrailingZerosZeros() {
BigDecimal bdNumber = new BigDecimal("0000000");
@@ -1153,6 +1852,15 @@ 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 = {}
+ )
+ })
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/tests/java/math/BigDecimalScaleOperationsTest.java
index 0b0d165..4c618df 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalScaleOperationsTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalScaleOperationsTest.java
@@ -21,9 +21,15 @@
package org.apache.harmony.tests.java.math;
-import junit.framework.TestCase;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+
import java.math.*;
+import junit.framework.TestCase;
+@TestTargetClass(BigDecimal.class)
/**
* Class: java.math.BigDecimal
* Methods: movePointLeft, movePointRight, scale, setScale, unscaledValue *
@@ -32,6 +38,15 @@ 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 = {}
+ )
+ })
public void testScaleDefault() {
String a = "1231212478987482988429808779810457634781384756794987";
int cScale = 0;
@@ -42,6 +57,15 @@ 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 = {}
+ )
+ })
public void testScaleNeg() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = -10;
@@ -53,6 +77,15 @@ 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 = {}
+ )
+ })
public void testScalePos() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 10;
@@ -64,6 +97,15 @@ 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 = {}
+ )
+ })
public void testScaleZero() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 0;
@@ -75,6 +117,15 @@ public class BigDecimalScaleOperationsTest extends TestCase {
/**
* Check the unscaled value
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "unscaledValue",
+ methodArgs = {}
+ )
+ })
public void testUnscaledValue() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 100;
@@ -86,6 +137,15 @@ 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}
+ )
+ })
public void testSetScaleGreater() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 18;
@@ -99,6 +159,15 @@ 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}
+ )
+ })
public void testSetScaleLess() {
String a = "2.345726458768760000E+10";
int newScale = 5;
@@ -111,6 +180,15 @@ 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}
+ )
+ })
public void testSetScaleException() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 28;
@@ -127,6 +205,15 @@ 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}
+ )
+ })
public void testSetScaleSame() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 18;
@@ -140,6 +227,15 @@ 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}
+ )
+ })
public void testSetScaleRoundUp() {
String a = "1231212478987482988429808779810457634781384756794987";
String b = "123121247898748298842980877981045763478139";
@@ -154,6 +250,15 @@ 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}
+ )
+ })
public void testSetScaleRoundDown() {
String a = "1231212478987482988429808779810457634781384756794987";
String b = "123121247898748298842980877981045763478138";
@@ -168,6 +273,15 @@ 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}
+ )
+ })
public void testSetScaleRoundCeiling() {
String a = "1231212478987482988429808779810457634781384756794987";
String b = "123121247898748298842980877981045763478139";
@@ -182,6 +296,15 @@ 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}
+ )
+ })
public void testSetScaleRoundFloor() {
String a = "1231212478987482988429808779810457634781384756794987";
String b = "123121247898748298842980877981045763478138";
@@ -196,6 +319,15 @@ 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}
+ )
+ })
public void testSetScaleRoundHalfUp() {
String a = "1231212478987482988429808779810457634781384756794987";
String b = "123121247898748298842980877981045763478138";
@@ -210,6 +342,15 @@ 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}
+ )
+ })
public void testSetScaleRoundHalfDown() {
String a = "1231212478987482988429808779810457634781384756794987";
String b = "123121247898748298842980877981045763478138";
@@ -224,6 +365,15 @@ 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}
+ )
+ })
public void testSetScaleRoundHalfEven() {
String a = "1231212478987482988429808779810457634781384756794987";
String b = "123121247898748298842980877981045763478138";
@@ -238,6 +388,15 @@ 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}
+ )
+ })
public void testSetScaleIntRoundingMode() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 28;
@@ -253,6 +412,15 @@ 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}
+ )
+ })
public void testMovePointLeftPos() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 28;
@@ -267,6 +435,15 @@ 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}
+ )
+ })
public void testMovePointLeftNeg() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 28;
@@ -281,6 +458,15 @@ 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}
+ )
+ })
public void testMovePointRightPosGreater() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 28;
@@ -295,6 +481,15 @@ 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}
+ )
+ })
public void testMovePointRightPosLess() {
String a = "1231212478987482988429808779810457634781384756794987";
String b = "123121247898748298842980877981045763478138475679498700";
@@ -310,6 +505,15 @@ 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}
+ )
+ })
public void testMovePointRightNeg() {
String a = "1231212478987482988429808779810457634781384756794987";
int aScale = 28;
@@ -324,6 +528,15 @@ 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}
+ )
+ })
public void testMovePointRightException() {
String a = "12312124789874829887348723648726347429808779810457634781384756794987";
int aScale = Integer.MAX_VALUE; //2147483647
@@ -340,6 +553,15 @@ public class BigDecimalScaleOperationsTest extends TestCase {
/**
* precision()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "precision",
+ methodArgs = {}
+ )
+ })
public void testPrecision() {
String a = "12312124789874829887348723648726347429808779810457634781384756794987";
int aScale = 14;
@@ -354,6 +576,15 @@ 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 = {}
+ )
+ })
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/tests/java/math/BigIntegerAddTest.java
index 7049cf4..b67389f 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAddTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAddTest.java
@@ -21,9 +21,15 @@
package org.apache.harmony.tests.java.math;
-import junit.framework.TestCase;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestTargetClass;
+
import java.math.BigInteger;
+import junit.framework.TestCase;
+@TestTargetClass(BigInteger.class)
/**
* Class: java.math.BigInteger
* Method: add
@@ -32,6 +38,15 @@ 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}
+ )
+ })
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};
@@ -52,6 +67,15 @@ 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}
+ )
+ })
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};
@@ -74,6 +98,15 @@ 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}
+ )
+ })
public void testCase3() {
byte aBytes[] = {3, 4, 5, 6, 7, 8, 9};
byte bBytes[] = {1, 2, 3, 4, 5, 6, 7};
@@ -96,6 +129,15 @@ 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}
+ )
+ })
public void testCase4() {
byte aBytes[] = {3, 4, 5, 6, 7, 8, 9};
byte bBytes[] = {1, 2, 3, 4, 5, 6, 7};
@@ -118,6 +160,15 @@ 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}
+ )
+ })
public void testCase5() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7};
byte bBytes[] = {3, 4, 5, 6, 7, 8, 9};
@@ -140,6 +191,15 @@ 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}
+ )
+ })
public void testCase6() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7};
byte bBytes[] = {3, 4, 5, 6, 7, 8, 9};
@@ -161,6 +221,15 @@ 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}
+ )
+ })
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};
@@ -182,6 +251,15 @@ 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}
+ )
+ })
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};
@@ -201,6 +279,15 @@ 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}
+ )
+ })
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};
@@ -222,6 +309,15 @@ 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}
+ )
+ })
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};
@@ -244,6 +340,15 @@ 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}
+ )
+ })
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};
@@ -266,6 +371,15 @@ 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}
+ )
+ })
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};
@@ -288,6 +402,15 @@ 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}
+ )
+ })
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};
@@ -310,6 +433,15 @@ 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}
+ )
+ })
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};
@@ -330,6 +462,15 @@ 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}
+ )
+ })
public void testCase15() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7};
byte bBytes[] = {1, 2, 3, 4, 5, 6, 7};
@@ -349,6 +490,15 @@ 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}
+ )
+ })
public void testCase16() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7};
byte bBytes[] = {0};
@@ -369,6 +519,15 @@ 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}
+ )
+ })
public void testCase17() {
byte aBytes[] = {0};
byte bBytes[] = {1, 2, 3, 4, 5, 6, 7};
@@ -389,6 +548,15 @@ 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}
+ )
+ })
public void testCase18() {
byte aBytes[] = {0};
byte bBytes[] = {0};
@@ -409,6 +577,15 @@ 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}
+ )
+ })
public void testCase19() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7};
byte rBytes[] = {1, 2, 3, 4, 5, 6, 7};
@@ -427,6 +604,15 @@ 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}
+ )
+ })
public void testCase20() {
byte bBytes[] = {1, 2, 3, 4, 5, 6, 7};
byte rBytes[] = {1, 2, 3, 4, 5, 6, 7};
@@ -445,6 +631,15 @@ 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}
+ )
+ })
public void testCase21() {
byte rBytes[] = {0};
BigInteger aNumber = BigInteger.ZERO;
@@ -461,6 +656,15 @@ 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}
+ )
+ })
public void testCase22() {
byte rBytes[] = {2};
BigInteger aNumber = BigInteger.ONE;
@@ -477,6 +681,15 @@ 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}
+ )
+ })
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/tests/java/math/BigIntegerAndTest.java
index 43d0556..f25dd6d 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAndTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAndTest.java
@@ -21,9 +21,15 @@
package org.apache.harmony.tests.java.math;
-import junit.framework.TestCase;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+
import java.math.BigInteger;
+import junit.framework.TestCase;
+@TestTargetClass(BigInteger.class)
/**
* Class: java.math.BigInteger
* Method: and
@@ -32,6 +38,15 @@ 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}
+ )
+ })
public void testZeroPos() {
byte aBytes[] = {0};
byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
@@ -52,6 +67,15 @@ 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}
+ )
+ })
public void testZeroNeg() {
byte aBytes[] = {0};
byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
@@ -72,6 +96,15 @@ 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}
+ )
+ })
public void testPosZero() {
byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
byte bBytes[] = {0};
@@ -92,6 +125,15 @@ 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}
+ )
+ })
public void testNegPos() {
byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
byte bBytes[] = {0};
@@ -112,6 +154,15 @@ 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}
+ )
+ })
public void testZeroZero() {
byte aBytes[] = {0};
byte bBytes[] = {0};
@@ -132,6 +183,15 @@ 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}
+ )
+ })
public void testZeroOne() {
BigInteger aNumber = BigInteger.ZERO;
BigInteger bNumber = BigInteger.ONE;
@@ -143,6 +203,15 @@ 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}
+ )
+ })
public void testOneOne() {
BigInteger aNumber = BigInteger.ONE;
BigInteger bNumber = BigInteger.ONE;
@@ -154,6 +223,15 @@ 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}
+ )
+ })
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};
@@ -174,6 +252,15 @@ 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}
+ )
+ })
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};
@@ -194,6 +281,15 @@ 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}
+ )
+ })
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};
@@ -214,6 +310,15 @@ 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}
+ )
+ })
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};
@@ -234,6 +339,15 @@ 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}
+ )
+ })
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};
@@ -254,6 +368,15 @@ 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}
+ )
+ })
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};
@@ -274,6 +397,15 @@ 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}
+ )
+ })
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};
@@ -294,6 +426,15 @@ 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}
+ )
+ })
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};
@@ -314,6 +455,15 @@ 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}
+ )
+ })
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};
@@ -334,6 +484,15 @@ 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}
+ )
+ })
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};
@@ -354,6 +513,15 @@ 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}
+ )
+ })
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};
@@ -374,6 +542,15 @@ 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}
+ )
+ })
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};
@@ -394,6 +571,15 @@ 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}
+ )
+ })
public void testSpecialCase1() {
byte aBytes[] = {-1, -1, -1, -1};
byte bBytes[] = {5, -4, -3, -2};
@@ -414,6 +600,15 @@ 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}
+ )
+ })
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/tests/java/math/BigIntegerCompareTest.java
index b700d62..153a002 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerCompareTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerCompareTest.java
@@ -21,9 +21,15 @@
package org.apache.harmony.tests.java.math;
-import junit.framework.TestCase;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+
import java.math.BigInteger;
+import junit.framework.TestCase;
+@TestTargetClass(BigInteger.class)
/**
* Class: java.math.BigInteger
* Methods: abs, compareTo, equals, max, min, negate, signum
@@ -32,6 +38,15 @@ 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 = {}
+ )
+ })
public void testAbsPositive() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7};
int aSign = 1;
@@ -49,6 +64,15 @@ 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 = {}
+ )
+ })
public void testAbsNegative() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7};
int aSign = -1;
@@ -68,6 +92,15 @@ 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}
+ )
+ })
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};
@@ -83,6 +116,15 @@ 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}
+ )
+ })
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};
@@ -97,6 +139,15 @@ 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}
+ )
+ })
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};
@@ -112,6 +163,15 @@ 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}
+ )
+ })
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};
@@ -127,6 +187,15 @@ 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}
+ )
+ })
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};
@@ -141,6 +210,15 @@ 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}
+ )
+ })
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};
@@ -156,6 +234,15 @@ 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}
+ )
+ })
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};
@@ -171,6 +258,15 @@ 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}
+ )
+ })
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};
@@ -185,6 +281,15 @@ 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}
+ )
+ })
public void testCompareToPosZero() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91};
int aSign = 1;
@@ -197,6 +302,15 @@ 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}
+ )
+ })
public void testCompareToZeroPos() {
byte bBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91};
int bSign = 1;
@@ -209,6 +323,15 @@ 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}
+ )
+ })
public void testCompareToNegZero() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91};
int aSign = -1;
@@ -221,6 +344,15 @@ 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}
+ )
+ })
public void testCompareToZeroNeg() {
byte bBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91};
int bSign = -1;
@@ -233,6 +365,15 @@ 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}
+ )
+ })
public void testCompareToZeroZero() {
BigInteger aNumber = BigInteger.ZERO;
BigInteger bNumber = BigInteger.ZERO;
@@ -243,6 +384,15 @@ 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}
+ )
+ })
public void testEqualsObject() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91};
int aSign = 1;
@@ -254,6 +404,15 @@ 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}
+ )
+ })
public void testEqualsNull() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91};
int aSign = 1;
@@ -266,6 +425,15 @@ 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}
+ )
+ })
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};
@@ -281,6 +449,15 @@ 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}
+ )
+ })
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};
@@ -295,6 +472,15 @@ 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}
+ )
+ })
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};
@@ -316,6 +502,15 @@ 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}
+ )
+ })
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};
@@ -337,6 +532,15 @@ 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}
+ )
+ })
public void testMaxEqual() {
byte aBytes[] = {45, 91, 3, -15, 35, 26, 3, 91};
byte bBytes[] = {45, 91, 3, -15, 35, 26, 3, 91};
@@ -358,6 +562,15 @@ 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}
+ )
+ })
public void testMaxNegZero() {
byte aBytes[] = {45, 91, 3, -15, 35, 26, 3, 91};
int aSign = -1;
@@ -377,6 +590,15 @@ 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}
+ )
+ })
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};
@@ -398,6 +620,15 @@ 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}
+ )
+ })
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};
@@ -419,6 +650,15 @@ 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}
+ )
+ })
public void testMinEqual() {
byte aBytes[] = {45, 91, 3, -15, 35, 26, 3, 91};
byte bBytes[] = {45, 91, 3, -15, 35, 26, 3, 91};
@@ -440,6 +680,15 @@ 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}
+ )
+ })
public void testMinPosZero() {
byte aBytes[] = {45, 91, 3, -15, 35, 26, 3, 91};
int aSign = 1;
@@ -458,6 +707,15 @@ 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 = {}
+ )
+ })
public void testNegatePositive() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91};
int aSign = 1;
@@ -475,6 +733,15 @@ 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 = {}
+ )
+ })
public void testNegateNegative() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91};
int aSign = -1;
@@ -492,6 +759,15 @@ 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 = {}
+ )
+ })
public void testNegateZero() {
byte rBytes[] = {0};
BigInteger aNumber = BigInteger.ZERO;
@@ -507,6 +783,15 @@ 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 = {}
+ )
+ })
public void testSignumPositive() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91};
int aSign = 1;
@@ -517,6 +802,15 @@ 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 = {}
+ )
+ })
public void testSignumNegative() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91};
int aSign = -1;
@@ -527,6 +821,15 @@ 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 = {}
+ )
+ })
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/tests/java/math/BigIntegerConstructorsTest.java
index ad9b118..3a7d081 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConstructorsTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConstructorsTest.java
@@ -21,10 +21,16 @@
package org.apache.harmony.tests.java.math;
-import junit.framework.TestCase;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+
import java.math.BigInteger;
import java.util.Random;
+import junit.framework.TestCase;
+@TestTargetClass(BigInteger.class)
/**
* Class: java.math.BigInteger
* Constructors: BigInteger(byte[] a), BigInteger(int sign, byte[] a),
@@ -35,6 +41,15 @@ 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}
+ )
+ })
public void testConstructorBytesException() {
byte aBytes[] = {};
try {
@@ -49,6 +64,15 @@ 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}
+ )
+ })
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};
@@ -65,6 +89,15 @@ 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}
+ )
+ })
public void testConstructorBytesPositive2() {
byte aBytes[] = {12, 56, 100};
byte rBytes[] = {12, 56, 100};
@@ -81,6 +114,15 @@ 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}
+ )
+ })
public void testConstructorBytesPositive3() {
byte aBytes[] = {127, 56, 100, -1};
byte rBytes[] = {127, 56, 100, -1};
@@ -97,6 +139,15 @@ 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}
+ )
+ })
public void testConstructorBytesPositive() {
byte aBytes[] = {127, 56, 100, -1, 14, 75, -24, -100};
byte rBytes[] = {127, 56, 100, -1, 14, 75, -24, -100};
@@ -113,6 +164,15 @@ 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}
+ )
+ })
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};
@@ -129,6 +189,15 @@ 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}
+ )
+ })
public void testConstructorBytesNegative2() {
byte aBytes[] = {-12, 56, 100};
byte rBytes[] = {-12, 56, 100};
@@ -145,6 +214,15 @@ 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}
+ )
+ })
public void testConstructorBytesNegative3() {
byte aBytes[] = {-128, -12, 56, 100};
byte rBytes[] = {-128, -12, 56, 100};
@@ -161,6 +239,15 @@ 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}
+ )
+ })
public void testConstructorBytesNegative4() {
byte aBytes[] = {-128, -12, 56, 100, -13, 56, 93, -78};
byte rBytes[] = {-128, -12, 56, 100, -13, 56, 93, -78};
@@ -176,6 +263,15 @@ 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}
+ )
+ })
public void testConstructorBytesZero() {
byte aBytes[] = {0, 0, 0, -0, +0, 0, -0};
byte rBytes[] = {0};
@@ -192,6 +288,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesException1() {
byte aBytes[] = {123, 45, -3, -76};
int aSign = 3;
@@ -207,6 +312,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesException2() {
byte aBytes[] = {123, 45, -3, -76};
int aSign = 0;
@@ -223,6 +337,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesPositive1() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15};
int aSign = 1;
@@ -241,6 +364,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesPositive2() {
byte aBytes[] = {-12, 56, 100, -2, -76, 89, 45, 91, 3, -15};
int aSign = 1;
@@ -258,6 +390,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesPositive3() {
byte aBytes[] = {-12, 56, 100};
int aSign = 1;
@@ -276,6 +417,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesPositive4() {
byte aBytes[] = {127, 56, 100, -2};
int aSign = 1;
@@ -294,6 +444,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesPositive5() {
byte aBytes[] = {-127, 56, 100, -2};
int aSign = 1;
@@ -312,6 +471,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesPositive6() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 23, -101};
int aSign = 1;
@@ -330,6 +498,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesPositive7() {
byte aBytes[] = {-12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 23, -101};
int aSign = 1;
@@ -348,6 +525,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesNegative1() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15};
int aSign = -1;
@@ -366,6 +552,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesNegative2() {
byte aBytes[] = {-12, 56, 100, -2, -76, 89, 45, 91, 3, -15};
int aSign = -1;
@@ -383,6 +578,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesNegative3() {
byte aBytes[] = {-12, 56, 100};
int aSign = -1;
@@ -401,6 +605,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesNegative4() {
byte aBytes[] = {127, 56, 100, -2};
int aSign = -1;
@@ -419,6 +632,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesNegative5() {
byte aBytes[] = {-127, 56, 100, -2};
int aSign = -1;
@@ -437,6 +659,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesNegative6() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 23, -101};
int aSign = -1;
@@ -455,6 +686,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesNegative7() {
byte aBytes[] = {-12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 23, -101};
int aSign = -1;
@@ -472,6 +712,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesZero1() {
byte aBytes[] = {-0, 0, +0, 0, 0, 00, 000};
int aSign = -1;
@@ -489,6 +738,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesZero2() {
byte aBytes[] = {-0, 0, +0, 0, 0, 00, 000};
int aSign = 0;
@@ -506,6 +764,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesZero3() {
byte aBytes[] = {-0, 0, +0, 0, 0, 00, 000};
int aSign = 1;
@@ -523,6 +790,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesZeroNull1() {
byte aBytes[] = {};
int aSign = -1;
@@ -540,6 +816,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesZeroNull2() {
byte aBytes[] = {};
int aSign = 0;
@@ -557,6 +842,15 @@ 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}
+ )
+ })
public void testConstructorSignBytesZeroNull3() {
byte aBytes[] = {};
int aSign = 1;
@@ -574,6 +868,15 @@ 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}
+ )
+ })
public void testConstructorStringException1() {
String value = "9234853876401";
int radix = 45;
@@ -589,6 +892,15 @@ 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}
+ )
+ })
public void testConstructorStringException2() {
String value = " 9234853876401";
int radix = 10;
@@ -603,6 +915,15 @@ 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}
+ )
+ })
public void testConstructorStringException3() {
String value = "92348$*#78987";
int radix = 34;
@@ -617,6 +938,15 @@ 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}
+ )
+ })
public void testConstructorStringException4() {
String value = "98zv765hdsaiy";
int radix = 20;
@@ -630,6 +960,15 @@ 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}
+ )
+ })
public void testConstructorStringRadix2() {
String value = "10101010101010101";
int radix = 2;
@@ -646,6 +985,15 @@ 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}
+ )
+ })
public void testConstructorStringRadix8() {
String value = "76356237071623450";
int radix = 8;
@@ -662,6 +1010,15 @@ 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}
+ )
+ })
public void testConstructorStringRadix10() {
String value = "987328901348934898";
int radix = 10;
@@ -678,6 +1035,15 @@ 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}
+ )
+ })
public void testConstructorStringRadix16() {
String value = "fe2340a8b5ce790";
int radix = 16;
@@ -694,6 +1060,15 @@ 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}
+ )
+ })
public void testConstructorStringRadix36() {
String value = "skdjgocvhdjfkl20jndjkf347ejg457";
int radix = 36;
@@ -710,6 +1085,15 @@ 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}
+ )
+ })
public void testConstructorStringRadix10Negative() {
String value = "-234871376037";
int radix = 36;
@@ -726,6 +1110,15 @@ 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}
+ )
+ })
public void testConstructorStringRadix10Zero() {
String value = "-00000000000000";
int radix = 10;
@@ -742,6 +1135,15 @@ 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}
+ )
+ })
public void testConstructorRandom() {
int bitLen = 75;
Random rnd = new Random();
@@ -752,6 +1154,15 @@ 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}
+ )
+ })
public void testConstructorPrime() {
int bitLen = 25;
Random rnd = new Random();
@@ -782,6 +1193,15 @@ 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}
+ )
+ })
public void test_ConstrString1() {
String s = "0";
BigInteger bi_s = new BigInteger(s);
@@ -792,6 +1212,15 @@ 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}
+ )
+ })
public void test_ConstrString2() {
String s = "-2147483648";
BigInteger bi_s = new BigInteger(s);
@@ -803,6 +1232,15 @@ 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}
+ )
+ })
public void test_ConstrString3() {
String s = "2147483647";
BigInteger bi_s = new BigInteger(s);
@@ -814,6 +1252,15 @@ 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}
+ )
+ })
public void test_ConstrStringExc1() {
try {
new BigInteger("01234 56");
@@ -825,6 +1272,15 @@ 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}
+ )
+ })
public void test_ConstrStringExc2() {
try {
new BigInteger("1234#56");
@@ -836,6 +1292,15 @@ 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}
+ )
+ })
public void test_ConstrStringExc3() {
try {
new BigInteger("1234.56");
@@ -847,6 +1312,15 @@ 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}
+ )
+ })
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/tests/java/math/BigIntegerConvertTest.java
index 70966b5..c784d88 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConvertTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConvertTest.java
@@ -21,9 +21,15 @@
package org.apache.harmony.tests.java.math;
-import junit.framework.TestCase;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+
import java.math.BigInteger;
+import junit.framework.TestCase;
+@TestTargetClass(BigInteger.class)
/**
* Class: java.math.BigInteger
* Methods: intValue, longValue, toByteArray(), valueOf(long val),
@@ -33,6 +39,15 @@ 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 = {}
+ )
+ })
public void testDoubleValueZero() {
String a = "0";
double result = 0.0;
@@ -44,6 +59,15 @@ 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 = {}
+ )
+ })
public void testDoubleValuePositive1() {
String a = "27467238945";
double result = 2.7467238945E10;
@@ -55,6 +79,15 @@ 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 = {}
+ )
+ })
public void testDoubleValuePositive2() {
String a = "2746723894572364578265426346273456972";
double result = 2.7467238945723645E36;
@@ -66,6 +99,15 @@ 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 = {}
+ )
+ })
public void testDoubleValueNegative1() {
String a = "-27467238945";
double result = -2.7467238945E10;
@@ -77,6 +119,15 @@ 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 = {}
+ )
+ })
public void testDoubleValueNegative2() {
String a = "-2746723894572364578265426346273456972";
double result = -2.7467238945723645E36;
@@ -89,6 +140,15 @@ 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 = {}
+ )
+ })
public void testDoubleValuePosRounded1() {
byte[] a = {-128, 1, 2, 3, 4, 5, 60, 23, 1, -3, -5};
int aSign = 1;
@@ -103,6 +163,15 @@ 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 = {}
+ )
+ })
public void testDoubleValuePosRounded2() {
byte[] a = {-128, 1, 2, 3, 4, 5, 36, 23, 1, -3, -5};
int aSign = 1;
@@ -114,6 +183,15 @@ 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 = {}
+ )
+ })
public void testDoubleValuePosNotRounded() {
byte[] a = {-128, 1, 2, 3, 4, 5, -128, 23, 1, -3, -5};
int aSign = 1;
@@ -126,6 +204,15 @@ 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 = {}
+ )
+ })
public void testDoubleValueNegRounded1() {
byte[] a = {-128, 1, 2, 3, 4, 5, 60, 23, 1, -3, -5};
int aSign = -1;
@@ -140,6 +227,15 @@ 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 = {}
+ )
+ })
public void testDoubleValueNegRounded2() {
byte[] a = {-128, 1, 2, 3, 4, 5, 36, 23, 1, -3, -5};
int aSign = -1;
@@ -152,6 +248,15 @@ 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 = {}
+ )
+ })
public void testDoubleValueNegNotRounded() {
byte[] a = {-128, 1, 2, 3, 4, 5, -128, 23, 1, -3, -5};
int aSign = -1;
@@ -166,6 +271,15 @@ 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 = {}
+ )
+ })
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,
@@ -186,6 +300,15 @@ 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 = {}
+ )
+ })
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,
@@ -207,6 +330,15 @@ 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 = {}
+ )
+ })
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,
@@ -226,6 +358,15 @@ 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 = {}
+ )
+ })
public void testDoubleValuePositiveInfinity2() {
String a = "2746723894572364578265426346273456972283746872364768676747462342342342342342342342323423423423423423426767456345745293762384756238475634563456845634568934568347586346578648576478568456457634875673845678456786587345873645767456834756745763457863485768475678465783456702897830296720476846578634576384567845678346573465786457863";
double aNumber = new BigInteger(a).doubleValue();
@@ -236,6 +377,15 @@ 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 = {}
+ )
+ })
public void testDoubleValueNegativeInfinity1() {
String a = "-2746723894572364578265426346273456972283746872364768676747462342342342342342342342323423423423423423426767456345745293762384756238475634563456845634568934568347586346578648576478568456457634875673845678456786587345873645767456834756745763457863485768475678465783456702897830296720476846578634576384567845678346573465786457863";
double aNumber = new BigInteger(a).doubleValue();
@@ -248,6 +398,15 @@ 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 = {}
+ )
+ })
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,
@@ -268,6 +427,15 @@ 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 = {}
+ )
+ })
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,
@@ -289,6 +457,15 @@ 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 = {}
+ )
+ })
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,
@@ -307,6 +484,15 @@ 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 = {}
+ )
+ })
public void testFloatValueZero() {
String a = "0";
float result = 0.0f;
@@ -318,6 +504,15 @@ 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 = {}
+ )
+ })
public void testFloatValuePositive1() {
String a = "27467238";
float result = 2.7467238E7f;
@@ -329,6 +524,15 @@ 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 = {}
+ )
+ })
public void testFloatValuePositive2() {
String a = "27467238945723645782";
float result = 2.7467239E19f;
@@ -340,6 +544,15 @@ 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 = {}
+ )
+ })
public void testFloatValueNegative1() {
String a = "-27467238";
float result = -2.7467238E7f;
@@ -351,6 +564,15 @@ 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 = {}
+ )
+ })
public void testFloatValueNegative2() {
String a = "-27467238945723645782";
float result = -2.7467239E19f;
@@ -363,6 +585,15 @@ 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 = {}
+ )
+ })
public void testFloatValuePosRounded1() {
byte[] a = {-128, 1, -1, -4, 4, 5, 60, 23, 1, -3, -5};
int aSign = 1;
@@ -377,6 +608,15 @@ 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 = {}
+ )
+ })
public void testFloatValuePosRounded2() {
byte[] a = {-128, 1, 2, -128, 4, 5, 60, 23, 1, -3, -5};
int aSign = 1;
@@ -388,6 +628,15 @@ 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 = {}
+ )
+ })
public void testFloatValuePosNotRounded() {
byte[] a = {-128, 1, 2, 3, 4, 5, 60, 23, 1, -3, -5};
int aSign = 1;
@@ -400,6 +649,15 @@ 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 = {}
+ )
+ })
public void testFloatValueNegRounded1() {
byte[] a = {-128, 1, -1, -4, 4, 5, 60, 23, 1, -3, -5};
int aSign = -1;
@@ -414,6 +672,15 @@ 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 = {}
+ )
+ })
public void testFloatValueNegRounded2() {
byte[] a = {-128, 1, 2, -128, 4, 5, 60, 23, 1, -3, -5};
int aSign = -1;
@@ -426,6 +693,15 @@ 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 = {}
+ )
+ })
public void testFloatValueNegNotRounded() {
byte[] a = {-128, 1, 2, 3, 4, 5, 60, 23, 1, -3, -5};
int aSign = -1;
@@ -440,6 +716,15 @@ 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 = {}
+ )
+ })
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;
@@ -453,6 +738,15 @@ 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 = {}
+ )
+ })
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;
@@ -466,6 +760,15 @@ 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 = {}
+ )
+ })
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;
@@ -477,6 +780,15 @@ 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 = {}
+ )
+ })
public void testFloatValuePositiveInfinity2() {
String a = "2746723894572364578265426346273456972283746872364768676747462342342342342342342342323423423423423423426767456345745293762384756238475634563456845634568934568347586346578648576478568456457634875673845678456786587345873645767456834756745763457863485768475678465783456702897830296720476846578634576384567845678346573465786457863";
float aNumber = new BigInteger(a).floatValue();
@@ -487,6 +799,15 @@ 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 = {}
+ )
+ })
public void testFloatValueNegativeInfinity1() {
String a = "-2746723894572364578265426346273456972283746872364768676747462342342342342342342342323423423423423423426767456345745293762384756238475634563456845634568934568347586346578648576478568456457634875673845678456786587345873645767456834756745763457863485768475678465783456702897830296720476846578634576384567845678346573465786457863";
float aNumber = new BigInteger(a).floatValue();
@@ -499,6 +820,15 @@ 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 = {}
+ )
+ })
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;
@@ -511,6 +841,15 @@ 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 = {}
+ )
+ })
public void testFloatValuePosMantissaIsZero() {
byte[] a = {-128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int aSign = 1;
@@ -524,6 +863,15 @@ 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 = {}
+ )
+ })
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;
@@ -535,6 +883,15 @@ 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 = {}
+ )
+ })
public void testFloatValueBug2482() {
String a = "2147483649";
float result = 2.14748365E9f;
@@ -546,6 +903,15 @@ 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 = {}
+ )
+ })
public void testIntValuePositive1() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3};
int resInt = 1496144643;
@@ -557,6 +923,15 @@ 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 = {}
+ )
+ })
public void testIntValuePositive2() {
byte aBytes[] = {12, 56, 100};
int resInt = 800868;
@@ -568,6 +943,15 @@ 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 = {}
+ )
+ })
public void testIntValuePositive3() {
byte aBytes[] = {56, 13, 78, -12, -5, 56, 100};
int sign = 1;
@@ -580,6 +964,15 @@ 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 = {}
+ )
+ })
public void testIntValueNegative1() {
byte aBytes[] = {12, 56, 100, -2, -76, -128, 45, 91, 3};
int sign = -1;
@@ -592,6 +985,15 @@ 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 = {}
+ )
+ })
public void testIntValueNegative2() {
byte aBytes[] = {-12, 56, 100};
int result = -771996;
@@ -603,6 +1005,15 @@ 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 = {}
+ )
+ })
public void testIntValueNegative3() {
byte aBytes[] = {12, 56, 100, -2, -76, 127, 45, 91, 3};
int sign = -1;
@@ -615,6 +1026,15 @@ 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 = {}
+ )
+ })
public void testLongValuePositive1() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, 120, -34, -12, 45, 98};
long result = 3268209772258930018L;
@@ -626,6 +1046,15 @@ 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 = {}
+ )
+ })
public void testLongValuePositive2() {
byte aBytes[] = {12, 56, 100, 18, -105, 34, -18, 45};
long result = 880563758158769709L;
@@ -637,6 +1066,15 @@ 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 = {}
+ )
+ })
public void testLongValueNegative1() {
byte aBytes[] = {12, -1, 100, -2, -76, -128, 45, 91, 3};
long result = -43630045168837885L;
@@ -648,6 +1086,15 @@ 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 = {}
+ )
+ })
public void testLongValueNegative2() {
byte aBytes[] = {-12, 56, 100, 45, -101, 45, 98};
long result = -3315696807498398L;
@@ -658,6 +1105,15 @@ 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}
+ )
+ })
public void testValueOfIntegerMax() {
long longVal = Integer.MAX_VALUE;
BigInteger aNumber = BigInteger.valueOf(longVal);
@@ -673,6 +1129,15 @@ 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}
+ )
+ })
public void testValueOfIntegerMin() {
long longVal = Integer.MIN_VALUE;
BigInteger aNumber = BigInteger.valueOf(longVal);
@@ -688,6 +1153,15 @@ 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}
+ )
+ })
public void testValueOfLongMax() {
long longVal = Long.MAX_VALUE;
BigInteger aNumber = BigInteger.valueOf(longVal);
@@ -703,6 +1177,15 @@ 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}
+ )
+ })
public void testValueOfLongMin() {
long longVal = Long.MIN_VALUE;
BigInteger aNumber = BigInteger.valueOf(longVal);
@@ -718,6 +1201,15 @@ 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}
+ )
+ })
public void testValueOfLongPositive1() {
long longVal = 268209772258930018L;
BigInteger aNumber = BigInteger.valueOf(longVal);
@@ -734,6 +1226,15 @@ 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}
+ )
+ })
public void testValueOfLongPositive2() {
long longVal = 58930018L;
BigInteger aNumber = BigInteger.valueOf(longVal);
@@ -749,6 +1250,15 @@ 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}
+ )
+ })
public void testValueOfLongNegative1() {
long longVal = -268209772258930018L;
BigInteger aNumber = BigInteger.valueOf(longVal);
@@ -765,6 +1275,15 @@ 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}
+ )
+ })
public void testValueOfLongNegative2() {
long longVal = -58930018L;
BigInteger aNumber = BigInteger.valueOf(longVal);
@@ -779,6 +1298,15 @@ 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}
+ )
+ })
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/tests/java/math/BigIntegerDivideTest.java
index 10bf147..64ca989 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerDivideTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerDivideTest.java
@@ -21,9 +21,15 @@
package org.apache.harmony.tests.java.math;
-import junit.framework.TestCase;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+
import java.math.BigInteger;
+import junit.framework.TestCase;
+@TestTargetClass(BigInteger.class)
/**
* Class: java.math.BigInteger
* Methods: divide, remainder, mod, and divideAndRemainder
@@ -32,6 +38,15 @@ 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}
+ )
+ })
public void testCase1() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7};
byte bBytes[] = {0};
@@ -50,6 +65,15 @@ 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}
+ )
+ })
public void testCase2() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7};
int aSign = 1;
@@ -66,6 +90,15 @@ 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}
+ )
+ })
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};
@@ -86,6 +119,15 @@ 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}
+ )
+ })
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};
@@ -107,6 +149,15 @@ 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}
+ )
+ })
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};
@@ -128,6 +179,15 @@ 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}
+ )
+ })
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};
@@ -148,6 +208,15 @@ 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}
+ )
+ })
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};
@@ -168,6 +237,15 @@ 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}
+ )
+ })
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};
@@ -188,6 +266,15 @@ 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}
+ )
+ })
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};
@@ -208,6 +295,15 @@ 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}
+ )
+ })
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};
@@ -228,6 +324,15 @@ 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}
+ )
+ })
public void testCase11() {
byte aBytes[] = {0};
byte bBytes[] = {15, 48, -29, 7, 98, -1, 39, -128};
@@ -248,6 +353,15 @@ 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}
+ )
+ })
public void testCase12() {
byte bBytes[] = {15, 48, -29, 7, 98, -1, 39, -128};
int bSign = -1;
@@ -266,6 +380,15 @@ 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}
+ )
+ })
public void testCase13() {
byte aBytes[] = {15, 48, -29, 7, 98, -1, 39, -128};
int aSign = 1;
@@ -284,6 +407,15 @@ 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}
+ )
+ })
public void testCase14() {
byte rBytes[] = {1};
BigInteger aNumber = BigInteger.ONE;
@@ -300,6 +432,15 @@ 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}
+ )
+ })
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};
@@ -320,6 +461,15 @@ 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}
+ )
+ })
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};
@@ -341,6 +491,15 @@ 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}
+ )
+ })
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};
@@ -361,6 +520,15 @@ 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}
+ )
+ })
public void testDivisionKnuthOneDigitByOneDigit() {
byte aBytes[] = {113, -83, 123, -5};
byte bBytes[] = {2, -3, -4, -5};
@@ -381,6 +549,15 @@ 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}
+ )
+ })
public void testDivisionKnuthMultiDigitsByOneDigit() {
byte aBytes[] = {113, -83, 123, -5, 18, -34, 67, 39, -29};
byte bBytes[] = {2, -3, -4, -5};
@@ -401,6 +578,15 @@ 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}
+ )
+ })
public void testCase15() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7};
byte bBytes[] = {0};
@@ -419,6 +605,15 @@ 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}
+ )
+ })
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};
@@ -439,6 +634,15 @@ 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}
+ )
+ })
public void testCase17() {
byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75};
byte bBytes[] = {27, -15, 65, 39, 100};
@@ -459,6 +663,15 @@ 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}
+ )
+ })
public void testCase18() {
byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75};
byte bBytes[] = {27, -15, 65, 39, 100};
@@ -480,6 +693,15 @@ 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}
+ )
+ })
public void testCase19() {
byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75};
byte bBytes[] = {27, -15, 65, 39, 100};
@@ -501,6 +723,15 @@ 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}
+ )
+ })
public void testCase20() {
byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75};
byte bBytes[] = {27, -15, 65, 39, 100};
@@ -521,6 +752,15 @@ 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}
+ )
+ })
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};
@@ -541,6 +781,15 @@ 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}
+ )
+ })
public void testRemainderKnuthOneDigitByOneDigit() {
byte aBytes[] = {113, -83, 123, -5};
byte bBytes[] = {2, -3, -4, -50};
@@ -561,6 +810,15 @@ 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}
+ )
+ })
public void testRemainderKnuthMultiDigitsByOneDigit() {
byte aBytes[] = {113, -83, 123, -5, 18, -34, 67, 39, -29};
byte bBytes[] = {2, -3, -4, -50};
@@ -582,6 +840,15 @@ 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}
+ )
+ })
public void testCase21() {
byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75};
byte bBytes[] = {27, -15, 65, 39, 100};
@@ -614,6 +881,15 @@ public class BigIntegerDivideTest extends TestCase {
/**
* 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}
+ )
+ })
public void testCase22() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7};
byte bBytes[] = {1, 30, 40, 56, -1, 45};
@@ -632,6 +908,15 @@ 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}
+ )
+ })
public void testCase23() {
byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75};
byte bBytes[] = {27, -15, 65, 39, 100};
@@ -652,6 +937,15 @@ 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}
+ )
+ })
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/tests/java/math/BigIntegerHashCodeTest.java
index f6c17a8..b8b776c 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerHashCodeTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerHashCodeTest.java
@@ -21,10 +21,15 @@
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.BigInteger;
import junit.framework.TestCase;
-
+@TestTargetClass(BigInteger.class)
/**
* Class: java.math.BigInteger
* Method: hashCode()
@@ -33,6 +38,15 @@ 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 = {}
+ )
+ })
public void testSameObject() {
String value1 = "12378246728727834290276457386374882976782849";
String value2 = "-5634562095872038262928728727834290276457386374882976782849";
@@ -51,6 +65,15 @@ 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 = {}
+ )
+ })
public void testEqualObjects() {
String value1 = "12378246728727834290276457386374882976782849";
String value2 = "12378246728727834290276457386374882976782849";
@@ -67,6 +90,15 @@ 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 = {}
+ )
+ })
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/tests/java/math/BigIntegerModPowTest.java
index b2bd801..43f128a 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerModPowTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerModPowTest.java
@@ -21,9 +21,15 @@
package org.apache.harmony.tests.java.math;
-import junit.framework.TestCase;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+
import java.math.BigInteger;
+import junit.framework.TestCase;
+@TestTargetClass(BigInteger.class)
/**
* Class: java.math.BigInteger
* Methods: modPow, modInverse, and gcd
@@ -32,6 +38,15 @@ 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}
+ )
+ })
public void testModPowException() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7};
byte eBytes[] = {1, 2, 3, 4, 5};
@@ -53,6 +68,15 @@ 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}
+ )
+ })
public void testModPowPosExp() {
byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75, 48, -7};
byte eBytes[] = {27, -15, 65, 39};
@@ -76,6 +100,15 @@ 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}
+ )
+ })
public void testModPowNegExp() {
byte aBytes[] = {-127, 100, 56, 7, 98, -1, 39, -128, 127, 75, 48, -7};
byte eBytes[] = {27, -15, 65, 39};
@@ -99,6 +132,15 @@ 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}
+ )
+ })
public void testmodInverseException() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7};
byte mBytes[] = {1, 2, 3};
@@ -117,6 +159,15 @@ 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}
+ )
+ })
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};
@@ -135,6 +186,15 @@ 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}
+ )
+ })
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};
@@ -155,6 +215,15 @@ 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}
+ )
+ })
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};
@@ -175,6 +244,15 @@ 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}
+ )
+ })
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};
@@ -195,6 +273,15 @@ 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}
+ )
+ })
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};
@@ -213,6 +300,15 @@ 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}
+ )
+ })
public void testGcdSecondZero() {
byte aBytes[] = {15, 24, 123, 57, -15, 24, 123, 57, -15, 24, 123, 57};
byte bBytes[] = {0};
@@ -233,6 +329,15 @@ 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}
+ )
+ })
public void testGcdFirstZero() {
byte aBytes[] = {0};
byte bBytes[] = {15, 24, 123, 57, -15, 24, 123, 57, -15, 24, 123, 57};
@@ -253,6 +358,15 @@ 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}
+ )
+ })
public void testGcdFirstZERO() {
byte bBytes[] = {15, 24, 123, 57, -15, 24, 123, 57, -15, 24, 123, 57};
int bSign = 1;
@@ -271,6 +385,15 @@ 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}
+ )
+ })
public void testGcdBothZeros() {
byte rBytes[] = {0};
BigInteger aNumber = new BigInteger("0");
@@ -286,6 +409,15 @@ 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}
+ )
+ })
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};
@@ -306,6 +438,15 @@ 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}
+ )
+ })
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/tests/java/math/BigIntegerMultiplyTest.java
index cbd15e9..b78c941 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerMultiplyTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerMultiplyTest.java
@@ -21,9 +21,15 @@
package org.apache.harmony.tests.java.math;
-import junit.framework.TestCase;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+
import java.math.BigInteger;
+import junit.framework.TestCase;
+@TestTargetClass(BigInteger.class)
/**
* Class: java.math.BigInteger
* Method: multiply
@@ -32,6 +38,15 @@ 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}
+ )
+ })
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};
@@ -53,6 +68,15 @@ 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}
+ )
+ })
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};
@@ -74,6 +98,15 @@ 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}
+ )
+ })
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};
@@ -96,6 +129,15 @@ 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}
+ )
+ })
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};
@@ -119,6 +161,15 @@ 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}
+ )
+ })
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};
@@ -142,6 +193,15 @@ 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}
+ )
+ })
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};
@@ -163,6 +223,15 @@ 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}
+ )
+ })
public void testCase7() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 1, 2, 3, 4, 5};
byte bBytes[] = {0};
@@ -183,6 +252,15 @@ 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}
+ )
+ })
public void testCase8() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 1, 2, 3, 4, 5};
int aSign = 1;
@@ -201,6 +279,15 @@ 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}
+ )
+ })
public void testCase9() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 1, 2, 3, 4, 5};
int aSign = 1;
@@ -219,6 +306,15 @@ 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}
+ )
+ })
public void testCase10() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 1, 2, 3, 4, 5};
int aSign = -1;
@@ -237,6 +333,15 @@ 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}
+ )
+ })
public void testIntbyInt1() {
byte aBytes[] = {10, 20, 30, 40};
byte bBytes[] = {1, 2, 3, 4};
@@ -257,6 +362,15 @@ 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}
+ )
+ })
public void testIntbyInt2() {
byte aBytes[] = {-1, -1, -1, -1};
byte bBytes[] = {-1, -1, -1, -1};
@@ -277,6 +391,15 @@ 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}
+ )
+ })
public void testPowException() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7};
int aSign = 1;
@@ -293,6 +416,15 @@ 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}
+ )
+ })
public void testPowNegativeNumToOddExp() {
byte aBytes[] = {50, -26, 90, 69, 120, 32, 63, -103, -14, 35};
int aSign = -1;
@@ -314,6 +446,15 @@ 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}
+ )
+ })
public void testPowNegativeNumToEvenExp() {
byte aBytes[] = {50, -26, 90, 69, 120, 32, 63, -103, -14, 35};
int aSign = -1;
@@ -334,6 +475,15 @@ 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}
+ )
+ })
public void testPowNegativeNumToZeroExp() {
byte aBytes[] = {50, -26, 90, 69, 120, 32, 63, -103, -14, 35};
int aSign = -1;
@@ -352,6 +502,15 @@ 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}
+ )
+ })
public void testPowPositiveNum() {
byte aBytes[] = {50, -26, 90, 69, 120, 32, 63, -103, -14, 35};
int aSign = 1;
@@ -373,6 +532,15 @@ 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}
+ )
+ })
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/tests/java/math/BigIntegerNotTest.java
index 3305571..a2523cb 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerNotTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerNotTest.java
@@ -21,9 +21,15 @@
package org.apache.harmony.tests.java.math;
-import junit.framework.TestCase;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+
import java.math.BigInteger;
+import junit.framework.TestCase;
+@TestTargetClass(BigInteger.class)
/**
* Class: java.math.BigInteger
* Methods: and, andNot
@@ -32,6 +38,15 @@ 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}
+ )
+ })
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};
@@ -52,6 +67,15 @@ 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}
+ )
+ })
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};
@@ -72,6 +96,15 @@ 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}
+ )
+ })
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};
@@ -92,6 +125,15 @@ 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}
+ )
+ })
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};
@@ -112,6 +154,15 @@ 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 = {}
+ )
+ })
public void testNotZero() {
byte rBytes[] = {-1};
BigInteger aNumber = BigInteger.ZERO;
@@ -127,6 +178,15 @@ 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 = {}
+ )
+ })
public void testNotOne() {
byte rBytes[] = {-2};
BigInteger aNumber = BigInteger.ONE;
@@ -142,6 +202,15 @@ 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 = {}
+ )
+ })
public void testNotPos() {
byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117};
int aSign = 1;
@@ -159,6 +228,15 @@ 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 = {}
+ )
+ })
public void testNotNeg() {
byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117};
int aSign = -1;
@@ -177,6 +255,15 @@ 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 = {}
+ )
+ })
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/tests/java/math/BigIntegerOperateBitsTest.java
index 3a05e31..41f20e5 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOperateBitsTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOperateBitsTest.java
@@ -21,9 +21,15 @@
package org.apache.harmony.tests.java.math;
-import junit.framework.TestCase;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+
import java.math.BigInteger;
+import junit.framework.TestCase;
+@TestTargetClass(BigInteger.class)
/**
* Class: java.math.BigInteger
* Methods: bitLength, shiftLeft, shiftRight,
@@ -33,6 +39,15 @@ 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 = {}
+ )
+ })
public void testBitCountZero() {
BigInteger aNumber = new BigInteger("0");
assertEquals(0, aNumber.bitCount());
@@ -41,6 +56,15 @@ 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 = {}
+ )
+ })
public void testBitCountNeg() {
BigInteger aNumber = new BigInteger("-12378634756382937873487638746283767238657872368748726875");
assertEquals(87, aNumber.bitCount());
@@ -49,6 +73,15 @@ 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 = {}
+ )
+ })
public void testBitCountPos() {
BigInteger aNumber = new BigInteger("12378634756343564757582937873487638746283767238657872368748726875");
assertEquals(107, aNumber.bitCount());
@@ -57,6 +90,15 @@ 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 = {}
+ )
+ })
public void testBitLengthZero() {
BigInteger aNumber = new BigInteger("0");
assertEquals(0, aNumber.bitLength());
@@ -65,6 +107,15 @@ 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 = {}
+ )
+ })
public void testBitLengthPositive1() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91};
int aSign = 1;
@@ -75,6 +126,15 @@ 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 = {}
+ )
+ })
public void testBitLengthPositive2() {
byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -85,6 +145,15 @@ 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 = {}
+ )
+ })
public void testBitLengthPositive3() {
byte aBytes[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int aSign = 1;
@@ -95,6 +164,15 @@ 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 = {}
+ )
+ })
public void testBitLengthNegative1() {
byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91};
int aSign = -1;
@@ -105,6 +183,15 @@ 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 = {}
+ )
+ })
public void testBitLengthNegative2() {
byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -115,6 +202,15 @@ 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 = {}
+ )
+ })
public void testBitLengthNegative3() {
byte aBytes[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int aSign = -1;
@@ -125,6 +221,15 @@ 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}
+ )
+ })
public void testClearBitException() {
byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -141,6 +246,15 @@ 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}
+ )
+ })
public void testClearBitZero() {
byte aBytes[] = {0};
int aSign = 0;
@@ -159,6 +273,15 @@ 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}
+ )
+ })
public void testClearBitZeroOutside1() {
byte aBytes[] = {0};
int aSign = 0;
@@ -177,6 +300,15 @@ 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}
+ )
+ })
public void testClearBitNegativeInside1() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -195,6 +327,15 @@ 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}
+ )
+ })
public void testClearBitNegativeInside2() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -213,6 +354,15 @@ 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}
+ )
+ })
public void testClearBitNegativeInside3() {
String as = "-18446744073709551615";
int number = 2;
@@ -226,6 +376,15 @@ 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}
+ )
+ })
public void testClearBitNegativeInside4() {
String as = "-4294967295";
String res = "-4294967296";
@@ -240,6 +399,15 @@ 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}
+ )
+ })
public void testClearBitNegativeInside5() {
String as = "-18446744073709551615";
String res = "-18446744073709551616";
@@ -252,6 +420,15 @@ 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}
+ )
+ })
public void testClearBitNegativeOutside1() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -270,6 +447,15 @@ 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}
+ )
+ })
public void testClearBitNegativeOutside2() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -288,6 +474,15 @@ 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}
+ )
+ })
public void testClearBitPositiveInside1() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -306,6 +501,15 @@ 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}
+ )
+ })
public void testClearBitPositiveInside2() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -324,6 +528,15 @@ 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}
+ )
+ })
public void testClearBitPositiveInside3() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -342,6 +555,15 @@ 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}
+ )
+ })
public void testClearBitPositiveInside4 () {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -360,6 +582,15 @@ 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}
+ )
+ })
public void testClearBitPositiveInside5 () {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -378,6 +609,15 @@ 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}
+ )
+ })
public void testClearBitPositiveOutside1() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -396,6 +636,15 @@ 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}
+ )
+ })
public void testClearBitPositiveOutside2() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -414,6 +663,15 @@ 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}
+ )
+ })
public void testClearBitTopNegative() {
byte aBytes[] = {1, -128, 56, 100, -15, 35, 26};
int aSign = -1;
@@ -432,6 +690,15 @@ 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}
+ )
+ })
public void testFlipBitException() {
byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -448,6 +715,15 @@ 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}
+ )
+ })
public void testFlipBitZero() {
byte aBytes[] = {0};
int aSign = 0;
@@ -466,6 +742,15 @@ 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}
+ )
+ })
public void testFlipBitZeroOutside1() {
byte aBytes[] = {0};
int aSign = 0;
@@ -484,6 +769,15 @@ 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}
+ )
+ })
public void testFlipBitZeroOutside2() {
byte aBytes[] = {0};
int aSign = 0;
@@ -502,6 +796,15 @@ 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}
+ )
+ })
public void testFlipBitLeftmostNegative() {
byte aBytes[] = {1, -128, 56, 100, -15, 35, 26};
int aSign = -1;
@@ -520,6 +823,15 @@ 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}
+ )
+ })
public void testFlipBitLeftmostPositive() {
byte aBytes[] = {1, -128, 56, 100, -15, 35, 26};
int aSign = 1;
@@ -538,6 +850,15 @@ 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}
+ )
+ })
public void testFlipBitNegativeInside1() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -556,6 +877,15 @@ 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}
+ )
+ })
public void testFlipBitNegativeInside2() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -574,6 +904,15 @@ 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}
+ )
+ })
public void testFlipBitNegativeInside3() {
String as = "-18446744073709551615";
String res = "-18446744073709551611";
@@ -588,6 +927,15 @@ 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}
+ )
+ })
public void testFlipBitNegativeInside4() {
String as = "-4294967295";
String res = "-4294967296";
@@ -602,6 +950,15 @@ 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}
+ )
+ })
public void testFlipBitNegativeInside5() {
String as = "-18446744073709551615";
String res = "-18446744073709551616";
@@ -614,6 +971,15 @@ 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}
+ )
+ })
public void testFlipBitNegativeOutside1() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -632,6 +998,15 @@ 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}
+ )
+ })
public void testFlipBitNegativeOutside2() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -650,6 +1025,15 @@ 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}
+ )
+ })
public void testFlipBitPositiveInside1() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -668,6 +1052,15 @@ 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}
+ )
+ })
public void testFlipBitPositiveInside2() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -686,6 +1079,15 @@ 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}
+ )
+ })
public void testFlipBitPositiveOutside1() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -704,6 +1106,15 @@ 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}
+ )
+ })
public void testFlipBitPositiveOutside2() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -722,6 +1133,15 @@ 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}
+ )
+ })
public void testSetBitException() {
byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -738,6 +1158,15 @@ 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}
+ )
+ })
public void testSetBitZero() {
byte aBytes[] = {0};
int aSign = 0;
@@ -756,6 +1185,15 @@ 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}
+ )
+ })
public void testSetBitZeroOutside1() {
byte aBytes[] = {0};
int aSign = 0;
@@ -774,6 +1212,15 @@ 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}
+ )
+ })
public void testSetBitPositiveInside1() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -792,6 +1239,15 @@ 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}
+ )
+ })
public void testSetBitPositiveInside2() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -810,6 +1266,15 @@ 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}
+ )
+ })
public void testSetBitPositiveInside3() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -828,6 +1293,15 @@ 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}
+ )
+ })
public void testSetBitPositiveInside4 () {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -846,6 +1320,15 @@ 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}
+ )
+ })
public void testSetBitPositiveOutside1() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -864,6 +1347,15 @@ 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}
+ )
+ })
public void testSetBitPositiveOutside2() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -882,6 +1374,15 @@ 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}
+ )
+ })
public void testSetBitTopPositive() {
byte aBytes[] = {1, -128, 56, 100, -15, 35, 26};
int aSign = 1;
@@ -900,6 +1401,15 @@ 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}
+ )
+ })
public void testSetBitLeftmostNegative() {
byte aBytes[] = {1, -128, 56, 100, -15, 35, 26};
int aSign = -1;
@@ -918,6 +1428,15 @@ 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}
+ )
+ })
public void testSetBitNegativeInside1() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -936,6 +1455,15 @@ 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}
+ )
+ })
public void testSetBitNegativeInside2() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -954,6 +1482,15 @@ 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}
+ )
+ })
public void testSetBitNegativeInside3() {
String as = "-18446744073709551615";
String res = "-18446744073709551611";
@@ -968,6 +1505,15 @@ 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}
+ )
+ })
public void testSetBitNegativeInside4() {
String as = "-4294967295";
int number = 0;
@@ -981,6 +1527,15 @@ 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}
+ )
+ })
public void testSetBitNegativeInside5() {
String as = "-18446744073709551615";
int number = 0;
@@ -992,6 +1547,15 @@ 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}
+ )
+ })
public void testSetBitNegativeOutside1() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -1010,6 +1574,15 @@ 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}
+ )
+ })
public void testSetBitNegativeOutside2() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -1030,6 +1603,15 @@ 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}
+ )
+ })
public void testSetBitBug1331() {
BigInteger result = BigInteger.valueOf(0L).setBit(191);
assertEquals("incorrect value", "3138550867693340381917894711603833208051177722232017256448", result.toString());
@@ -1039,6 +1621,15 @@ 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}
+ )
+ })
public void testShiftLeft1() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -1057,6 +1648,15 @@ 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}
+ )
+ })
public void testShiftLeft2() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -1075,6 +1675,15 @@ 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}
+ )
+ })
public void testShiftLeft3() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -1093,6 +1702,15 @@ 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}
+ )
+ })
public void testShiftLeft4() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -1111,6 +1729,15 @@ 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}
+ )
+ })
public void testShiftLeft5() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -1129,6 +1756,15 @@ 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}
+ )
+ })
public void testShiftRight1() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -1147,6 +1783,15 @@ 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}
+ )
+ })
public void testShiftRight2() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -1165,6 +1810,15 @@ 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}
+ )
+ })
public void testShiftRight3() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -1183,6 +1837,15 @@ 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}
+ )
+ })
public void testShiftRight4() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -1201,6 +1864,15 @@ 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}
+ )
+ })
public void testShiftRight5() {
byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -1221,6 +1893,15 @@ 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}
+ )
+ })
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;
@@ -1241,6 +1922,15 @@ 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}
+ )
+ })
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;
@@ -1261,6 +1951,15 @@ 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}
+ )
+ })
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;
@@ -1281,6 +1980,15 @@ 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}
+ )
+ })
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;
@@ -1299,6 +2007,15 @@ 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}
+ )
+ })
public void testTestBitException() {
byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -1315,6 +2032,15 @@ 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}
+ )
+ })
public void testTestBitPositive1() {
byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -1326,6 +2052,15 @@ 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}
+ )
+ })
public void testTestBitPositive2() {
byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -1337,6 +2072,15 @@ 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}
+ )
+ })
public void testTestBitPositive3() {
byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = 1;
@@ -1348,6 +2092,15 @@ 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}
+ )
+ })
public void testTestBitNegative1() {
byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -1359,6 +2112,15 @@ 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}
+ )
+ })
public void testTestBitNegative2() {
byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -1370,6 +2132,15 @@ 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}
+ )
+ })
public void testTestBitNegative3() {
byte aBytes[] = {-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26};
int aSign = -1;
@@ -1384,6 +2155,15 @@ 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 = {}
+ )
+ })
public void test_getLowestSetBitNeg() {
byte aBytes[] = {
-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26
@@ -1399,6 +2179,15 @@ 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 = {}
+ )
+ })
public void test_getLowestSetBitPos() {
byte aBytes[] = {
-1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26
@@ -1430,6 +2219,15 @@ 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 = {}
+ )
+ })
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/tests/java/math/BigIntegerOrTest.java
index 4b5ae83..e6efeb0 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOrTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOrTest.java
@@ -21,9 +21,15 @@
package org.apache.harmony.tests.java.math;
-import junit.framework.TestCase;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+
import java.math.BigInteger;
+import junit.framework.TestCase;
+@TestTargetClass(BigInteger.class)
/**
* Class: java.math.BigInteger
* Method: or
@@ -32,6 +38,15 @@ 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}
+ )
+ })
public void testZeroPos() {
byte aBytes[] = {0};
byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
@@ -52,6 +67,15 @@ 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}
+ )
+ })
public void testZeroNeg() {
byte aBytes[] = {0};
byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
@@ -72,6 +96,15 @@ 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}
+ )
+ })
public void testPosZero() {
byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
byte bBytes[] = {0};
@@ -92,6 +125,15 @@ 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}
+ )
+ })
public void testNegPos() {
byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
byte bBytes[] = {0};
@@ -112,6 +154,15 @@ 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}
+ )
+ })
public void testZeroZero() {
byte aBytes[] = {0};
byte bBytes[] = {0};
@@ -132,6 +183,15 @@ 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}
+ )
+ })
public void testZeroOne() {
byte aBytes[] = {0};
byte bBytes[] = {1};
@@ -152,6 +212,15 @@ 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}
+ )
+ })
public void testOneOne() {
byte aBytes[] = {1};
byte bBytes[] = {1};
@@ -172,6 +241,15 @@ 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}
+ )
+ })
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};
@@ -192,6 +270,15 @@ 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}
+ )
+ })
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};
@@ -212,6 +299,15 @@ 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}
+ )
+ })
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};
@@ -232,6 +328,15 @@ 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}
+ )
+ })
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};
@@ -252,6 +357,15 @@ 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}
+ )
+ })
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};
@@ -272,6 +386,15 @@ 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}
+ )
+ })
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};
@@ -292,6 +415,15 @@ 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}
+ )
+ })
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};
@@ -312,6 +444,15 @@ 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}
+ )
+ })
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};
@@ -332,6 +473,15 @@ 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}
+ )
+ })
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};
@@ -352,6 +502,15 @@ 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}
+ )
+ })
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};
@@ -372,6 +531,15 @@ 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}
+ )
+ })
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};
@@ -392,6 +560,15 @@ 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}
+ )
+ })
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};
@@ -409,6 +586,15 @@ 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}
+ )
+ })
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/tests/java/math/BigIntegerSubtractTest.java
index f0a6332..7750fc0 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerSubtractTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerSubtractTest.java
@@ -21,9 +21,15 @@
package org.apache.harmony.tests.java.math;
-import junit.framework.TestCase;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+
import java.math.BigInteger;
+import junit.framework.TestCase;
+@TestTargetClass(BigInteger.class)
/**
* Class: java.math.BigInteger
* Method: subtract
@@ -33,6 +39,15 @@ 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}
+ )
+ })
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};
@@ -54,6 +69,15 @@ 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}
+ )
+ })
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};
@@ -76,6 +100,15 @@ 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}
+ )
+ })
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};
@@ -98,6 +131,15 @@ 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}
+ )
+ })
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};
@@ -119,6 +161,15 @@ 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}
+ )
+ })
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};
@@ -140,6 +191,15 @@ 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}
+ )
+ })
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};
@@ -162,6 +222,15 @@ 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}
+ )
+ })
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};
@@ -184,6 +253,15 @@ 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}
+ )
+ })
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};
@@ -205,6 +283,15 @@ 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}
+ )
+ })
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};
@@ -226,6 +313,15 @@ 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}
+ )
+ })
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};
@@ -248,6 +344,15 @@ 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}
+ )
+ })
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};
@@ -270,6 +375,15 @@ 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}
+ )
+ })
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};
@@ -292,6 +406,15 @@ 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}
+ )
+ })
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};
@@ -314,6 +437,15 @@ 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}
+ )
+ })
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};
@@ -335,6 +467,15 @@ 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}
+ )
+ })
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};
@@ -356,6 +497,15 @@ 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}
+ )
+ })
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};
@@ -376,6 +526,15 @@ 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}
+ )
+ })
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};
@@ -397,6 +556,15 @@ 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}
+ )
+ })
public void testCase18() {
byte aBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3};
byte bBytes[] = {0};
@@ -418,6 +586,15 @@ 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}
+ )
+ })
public void testCase19() {
byte aBytes[] = {0};
byte bBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3};
@@ -438,6 +615,15 @@ 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}
+ )
+ })
public void testCase20() {
byte aBytes[] = {0};
byte bBytes[] = {0};
@@ -459,6 +645,15 @@ 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}
+ )
+ })
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};
@@ -478,6 +673,15 @@ 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}
+ )
+ })
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};
@@ -496,6 +700,15 @@ 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}
+ )
+ })
public void testCase23() {
byte rBytes[] = {0};
BigInteger aNumber = BigInteger.ZERO;
@@ -512,6 +725,15 @@ 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}
+ )
+ })
public void testCase24() {
byte rBytes[] = {0};
BigInteger aNumber = BigInteger.ONE;
@@ -528,6 +750,15 @@ 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}
+ )
+ })
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/tests/java/math/BigIntegerToStringTest.java
index 8a4b0e4..bd0d0b1 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerToStringTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerToStringTest.java
@@ -21,10 +21,15 @@
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.BigInteger;
import junit.framework.TestCase;
-
+@TestTargetClass(BigInteger.class)
/**
* Class: java.math.BigInteger
* Method: toString(int radix)
@@ -33,6 +38,15 @@ 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}
+ )
+ })
public void testRadixOutOfRange() {
String value = "442429234853876401";
int radix = 10;
@@ -44,6 +58,15 @@ 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}
+ )
+ })
public void testRadix2Neg() {
String value = "-101001100010010001001010101110000101010110001010010101010101010101010101010101010101010101010010101";
int radix = 2;
@@ -55,6 +78,15 @@ 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}
+ )
+ })
public void testRadix2Pos() {
String value = "101000011111000000110101010101010101010001001010101010101010010101010101010000100010010";
int radix = 2;
@@ -66,6 +98,15 @@ 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}
+ )
+ })
public void testRadix10Neg() {
String value = "-2489756308572364789878394872984";
int radix = 16;
@@ -77,6 +118,15 @@ 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}
+ )
+ })
public void testRadix10Pos() {
String value = "2387627892347567398736473476";
int radix = 16;
@@ -88,6 +138,15 @@ 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}
+ )
+ })
public void testRadix16Neg() {
String value = "-287628a883451b800865c67e8d7ff20";
int radix = 16;
@@ -99,6 +158,15 @@ 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}
+ )
+ })
public void testRadix16Pos() {
String value = "287628a883451b800865c67e8d7ff20";
int radix = 16;
@@ -110,6 +178,15 @@ 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}
+ )
+ })
public void testRadix24Neg() {
String value = "-287628a88gmn3451b8ijk00865c67e8d7ff20";
int radix = 24;
@@ -121,6 +198,15 @@ 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}
+ )
+ })
public void testRadix24Pos() {
String value = "287628a883451bg80ijhk0865c67e8d7ff20";
int radix = 24;
@@ -132,6 +218,15 @@ 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}
+ )
+ })
public void testRadix36Neg() {
String value = "-uhguweut98iu4h3478tq3985pq98yeiuth33485yq4aiuhalai485yiaehasdkr8tywi5uhslei8";
int radix = 36;
@@ -143,6 +238,15 @@ 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}
+ )
+ })
public void testRadix36Pos() {
String value = "23895lt45y6vhgliuwhgi45y845htsuerhsi4586ysuerhtsio5y68peruhgsil4568ypeorihtse48y6";
int radix = 36;
@@ -156,6 +260,15 @@ 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 = {}
+ )
+ })
public void test_toString1() {
String s = "0000000000";
@@ -167,6 +280,15 @@ 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 = {}
+ )
+ })
public void test_toString2() {
String s = "1234567890987654321";
BigInteger bi = new BigInteger(s);
@@ -177,6 +299,15 @@ 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 = {}
+ )
+ })
public void test_toString3() {
String s = "-1234567890987654321";
BigInteger bi = new BigInteger(s);
@@ -187,6 +318,15 @@ 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 = {}
+ )
+ })
public void test_toString4() {
String s = "12345678901234";
long l = 12345678901234L;
@@ -198,6 +338,15 @@ 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 = {}
+ )
+ })
public void test_toString5() {
String s = "-12345678901234";
long l = -12345678901234L;
@@ -209,6 +358,15 @@ 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 = {}
+ )
+ })
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/tests/java/math/BigIntegerXorTest.java
index 1e87786..5098361 100644
--- a/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerXorTest.java
+++ b/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerXorTest.java
@@ -21,9 +21,15 @@
package org.apache.harmony.tests.java.math;
-import junit.framework.TestCase;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+
import java.math.BigInteger;
+import junit.framework.TestCase;
+@TestTargetClass(BigInteger.class)
/**
* Class: java.math.BigInteger
* Method: xor
@@ -32,10 +38,19 @@ 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}
+ )
+ })
public void testZeroPos() {
String numA = "0";
String numB = "27384627835298756289327365";
- String res = "27384627835298756289327365";
+ String res = "27384627835298756289327365";
BigInteger aNumber = new BigInteger(numA);
BigInteger bNumber = new BigInteger(numB);
BigInteger result = aNumber.xor(bNumber);
@@ -45,10 +60,19 @@ 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}
+ )
+ })
public void testZeroNeg() {
String numA = "0";
String numB = "-27384627835298756289327365";
- String res = "-27384627835298756289327365";
+ String res = "-27384627835298756289327365";
BigInteger aNumber = new BigInteger(numA);
BigInteger bNumber = new BigInteger(numB);
BigInteger result = aNumber.xor(bNumber);
@@ -58,6 +82,15 @@ 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}
+ )
+ })
public void testPosZero() {
String numA = "27384627835298756289327365";
String numB = "0";
@@ -71,6 +104,15 @@ 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}
+ )
+ })
public void testNegPos() {
String numA = "-27384627835298756289327365";
String numB = "0";
@@ -84,6 +126,15 @@ 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}
+ )
+ })
public void testZeroZero() {
String numA = "0";
String numB = "0";
@@ -97,6 +148,15 @@ 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}
+ )
+ })
public void testZeroOne() {
String numA = "0";
String numB = "1";
@@ -110,6 +170,15 @@ 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}
+ )
+ })
public void testOneOne() {
String numA = "1";
String numB = "1";
@@ -123,6 +192,15 @@ 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}
+ )
+ })
public void testPosPosSameLength() {
String numA = "283746278342837476784564875684767";
String numB = "293478573489347658763745839457637";
@@ -136,6 +214,15 @@ 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}
+ )
+ })
public void testPosPosFirstLonger() {
String numA = "2837462783428374767845648748973847593874837948575684767";
String numB = "293478573489347658763745839457637";
@@ -149,6 +236,15 @@ 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}
+ )
+ })
public void testPosPosFirstShorter() {
String numA = "293478573489347658763745839457637";
String numB = "2837462783428374767845648748973847593874837948575684767";
@@ -162,6 +258,15 @@ 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}
+ )
+ })
public void testNegNegSameLength() {
String numA = "-283746278342837476784564875684767";
String numB = "-293478573489347658763745839457637";
@@ -175,6 +280,15 @@ 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}
+ )
+ })
public void testNegNegFirstLonger() {
String numA = "-2837462783428374767845648748973847593874837948575684767";
String numB = "-293478573489347658763745839457637";
@@ -188,6 +302,15 @@ 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}
+ )
+ })
public void testNegNegFirstShorter() {
String numA = "293478573489347658763745839457637";
String numB = "2837462783428374767845648748973847593874837948575684767";
@@ -201,6 +324,15 @@ 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}
+ )
+ })
public void testPosNegSameLength() {
String numA = "283746278342837476784564875684767";
String numB = "-293478573489347658763745839457637";
@@ -214,6 +346,15 @@ 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}
+ )
+ })
public void testNegPosSameLength() {
String numA = "-283746278342837476784564875684767";
String numB = "293478573489347658763745839457637";
@@ -227,6 +368,15 @@ 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}
+ )
+ })
public void testNegPosFirstLonger() {
String numA = "-2837462783428374767845648748973847593874837948575684767";
String numB = "293478573489347658763745839457637";
@@ -240,6 +390,15 @@ 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}
+ )
+ })
public void testNegPosFirstShorter() {
String numA = "-293478573489347658763745839457637";
String numB = "2837462783428374767845648748973847593874837948575684767";
@@ -253,6 +412,15 @@ 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}
+ )
+ })
public void testPosNegFirstLonger() {
String numA = "2837462783428374767845648748973847593874837948575684767";
String numB = "-293478573489347658763745839457637";
@@ -266,6 +434,15 @@ 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}
+ )
+ })
public void testPosNegFirstShorter() {
String numA = "293478573489347658763745839457637";
String numB = "-2837462783428374767845648748973847593874837948575684767";
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 ac67ac9..76bdcba 100644
--- a/math/src/test/java/tests/api/java/math/BigDecimalTest.java
+++ b/math/src/test/java/tests/api/java/math/BigDecimalTest.java
@@ -17,6 +17,11 @@
package tests.api.java.math;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
@@ -26,7 +31,7 @@ import java.math.BigInteger;
import java.math.MathContext;
import java.math.RoundingMode;
-
+@TestTargetClass(BigDecimal.class)
public class BigDecimalTest extends junit.framework.TestCase {
BigInteger value = new BigInteger("12345908");
@@ -35,6 +40,15 @@ 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}
+ )
+ })
public void test_ConstructorLjava_math_BigInteger() {
BigDecimal big = new BigDecimal(value);
assertTrue("the BigDecimal value is not initialized properly", big
@@ -45,6 +59,15 @@ 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}
+ )
+ })
public void test_ConstructorLjava_math_BigIntegerI() {
BigDecimal big = new BigDecimal(value2, 5);
assertTrue("the BigDecimal value is not initialized properly", big
@@ -57,6 +80,15 @@ 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}
+ )
+ })
public void test_ConstructorD() {
BigDecimal big = new BigDecimal(123E04);
assertTrue(
@@ -90,6 +122,15 @@ 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}
+ )
+ })
public void test_ConstructorLjava_lang_String() throws NumberFormatException {
BigDecimal big = new BigDecimal("345.23499600293850");
assertTrue("the BigDecimal value is not initialized properly", big
@@ -110,6 +151,15 @@ 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}
+ )
+ })
public void test_constructor_String_plus_exp() {
/*
* BigDecimal does not support a + sign in the exponent when converting
@@ -122,6 +172,15 @@ 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}
+ )
+ })
public void test_constructor_String_empty() {
try {
new BigDecimal("");
@@ -133,6 +192,15 @@ 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}
+ )
+ })
public void test_constructor_String_plus_minus_exp() {
try {
new BigDecimal("+35e+-2");
@@ -150,6 +218,15 @@ 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}
+ )
+ })
public void test_constructor_CC_plus_minus_exp() {
try {
new BigDecimal("+35e+-2".toCharArray());
@@ -167,6 +244,15 @@ public class BigDecimalTest extends junit.framework.TestCase {
/**
* @tests java.math.BigDecimal#abs()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "abs",
+ methodArgs = {}
+ )
+ })
public void test_abs() {
BigDecimal big = new BigDecimal("-1234");
BigDecimal bigabs = big.abs();
@@ -181,6 +267,15 @@ 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}
+ )
+ })
public void test_addLjava_math_BigDecimal() {
BigDecimal add1 = new BigDecimal("23.456");
BigDecimal add2 = new BigDecimal("3849.235");
@@ -198,6 +293,15 @@ 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}
+ )
+ })
public void test_compareToLjava_math_BigDecimal() {
BigDecimal comp1 = new BigDecimal("1.00");
BigDecimal comp2 = new BigDecimal(1.000000D);
@@ -214,6 +318,15 @@ 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}
+ )
+ })
public void test_divideLjava_math_BigDecimalI() {
BigDecimal divd1 = new BigDecimal(value, 2);
BigDecimal divd2 = new BigDecimal("2.335");
@@ -241,6 +354,15 @@ 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}
+ )
+ })
public void test_divideLjava_math_BigDecimalII() {
BigDecimal divd1 = new BigDecimal(value2, 4);
BigDecimal divd2 = new BigDecimal("0.0023");
@@ -265,6 +387,15 @@ 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 = {}
+ )
+ })
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)
@@ -296,6 +427,15 @@ 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}
+ )
+ })
public void test_equalsLjava_lang_Object() {
BigDecimal equal1 = new BigDecimal(1.00D);
BigDecimal equal2 = new BigDecimal("1.0");
@@ -323,6 +463,15 @@ 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 = {}
+ )
+ })
public void test_floatValue() {
BigDecimal fl1 = new BigDecimal("234563782344567");
assertTrue("the float representation of bigDecimal 234563782344567",
@@ -350,6 +499,15 @@ public class BigDecimalTest extends junit.framework.TestCase {
/**
* @tests java.math.BigDecimal#hashCode()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "hashCode",
+ methodArgs = {}
+ )
+ })
public void test_hashCode() {
// anything that is equal must have the same hashCode
BigDecimal hash = new BigDecimal("1.00");
@@ -378,6 +536,15 @@ public class BigDecimalTest extends junit.framework.TestCase {
/**
* @tests java.math.BigDecimal#intValue()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "intValue",
+ methodArgs = {}
+ )
+ })
public void test_intValue() {
BigDecimal int1 = new BigDecimal(value, 3);
assertTrue("the int value of 12345.908 is not 12345",
@@ -396,6 +563,15 @@ public class BigDecimalTest extends junit.framework.TestCase {
/**
* @tests java.math.BigDecimal#longValue()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "longValue",
+ methodArgs = {}
+ )
+ })
public void test_longValue() {
BigDecimal long1 = new BigDecimal(value2.negate(), 0);
assertTrue("the long value of 12334560000 is not 12334560000", long1
@@ -414,6 +590,15 @@ 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}
+ )
+ })
public void test_maxLjava_math_BigDecimal() {
BigDecimal max1 = new BigDecimal(value2, 1);
BigDecimal max2 = new BigDecimal(value2, 4);
@@ -431,6 +616,15 @@ 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}
+ )
+ })
public void test_minLjava_math_BigDecimal() {
BigDecimal min1 = new BigDecimal(-12345.4D);
BigDecimal min2 = new BigDecimal(-12345.39D);
@@ -445,6 +639,15 @@ 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}
+ )
+ })
public void test_movePointLeftI() {
BigDecimal movePtLeft = new BigDecimal("123456265.34");
BigDecimal alreadyMoved = movePtLeft.movePointLeft(5);
@@ -474,6 +677,15 @@ 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}
+ )
+ })
public void test_movePointRightI() {
BigDecimal movePtRight = new BigDecimal("-1.58796521458");
BigDecimal alreadyMoved = movePtRight.movePointRight(8);
@@ -500,6 +712,15 @@ 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}
+ )
+ })
public void test_multiplyLjava_math_BigDecimal() {
BigDecimal multi1 = new BigDecimal(value, 5);
BigDecimal multi2 = new BigDecimal(2.345D);
@@ -535,6 +756,15 @@ public class BigDecimalTest extends junit.framework.TestCase {
/**
* @tests java.math.BigDecimal#negate()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "negate",
+ methodArgs = {}
+ )
+ })
public void test_negate() {
BigDecimal negate1 = new BigDecimal(value2, 7);
assertTrue("the negate of 1233.4560000 is not -1233.4560000", negate1
@@ -550,6 +780,15 @@ public class BigDecimalTest extends junit.framework.TestCase {
/**
* @tests java.math.BigDecimal#scale()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "scale",
+ methodArgs = {}
+ )
+ })
public void test_scale() {
BigDecimal scale1 = new BigDecimal(value2, 8);
assertTrue("the scale of the number 123.34560000 is wrong", scale1
@@ -573,6 +812,15 @@ 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}
+ )
+ })
public void test_setScaleI() {
// rounding mode defaults to zero
BigDecimal setScale1 = new BigDecimal(value, 3);
@@ -592,6 +840,15 @@ 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}
+ )
+ })
public void test_setScaleII() {
BigDecimal setScale1 = new BigDecimal(2.323E102);
BigDecimal setScale2 = setScale1.setScale(4);
@@ -726,6 +983,15 @@ public class BigDecimalTest extends junit.framework.TestCase {
/**
* @tests java.math.BigDecimal#signum()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "signum",
+ methodArgs = {}
+ )
+ })
public void test_signum() {
BigDecimal sign = new BigDecimal(123E-104);
assertTrue("123E-104 is not positive in signum()", sign.signum() == 1);
@@ -739,6 +1005,15 @@ 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}
+ )
+ })
public void test_subtractLjava_math_BigDecimal() {
BigDecimal sub1 = new BigDecimal("13948");
BigDecimal sub2 = new BigDecimal("2839.489");
@@ -771,6 +1046,15 @@ public class BigDecimalTest extends junit.framework.TestCase {
/**
* @tests java.math.BigDecimal#toBigInteger()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "toBigInteger",
+ methodArgs = {}
+ )
+ })
public void test_toBigInteger() {
BigDecimal sub1 = new BigDecimal("-29830.989");
BigInteger result = sub1.toBigInteger();
@@ -794,6 +1078,15 @@ public class BigDecimalTest extends junit.framework.TestCase {
/**
* @tests java.math.BigDecimal#toString()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "toString",
+ methodArgs = {}
+ )
+ })
public void test_toString() {
BigDecimal toString1 = new BigDecimal("1234.000");
assertTrue("the toString representation of 1234.000 is wrong",
@@ -812,6 +1105,15 @@ public class BigDecimalTest extends junit.framework.TestCase {
/**
* @tests java.math.BigDecimal#unscaledValue()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "unscaledValue",
+ methodArgs = {}
+ )
+ })
public void test_unscaledValue() {
BigDecimal unsVal = new BigDecimal("-2839485.000");
assertTrue("the unscaledValue of -2839485.000 is wrong", unsVal
@@ -832,6 +1134,15 @@ 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}
+ )
+ })
public void test_valueOfJ() {
BigDecimal valueOfL = BigDecimal.valueOf(9223372036854775806L);
assertTrue("the bigDecimal equivalent of 9223372036854775806 is wrong",
@@ -850,6 +1161,15 @@ 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}
+ )
+ })
public void test_valueOfJI() {
BigDecimal valueOfJI = BigDecimal.valueOf(9223372036854775806L, 5);
assertTrue(
@@ -879,6 +1199,15 @@ public class BigDecimalTest extends junit.framework.TestCase {
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Checks serialization",
+ targets = {
+ @TestTarget(
+ methodName = "!SerializationSelf",
+ methodArgs = {}
+ )
+ })
public void test_BigDecimal_serialization() throws Exception {
// Regression for HARMONY-1896
char[] in = { '1', '5', '6', '7', '8', '7', '.', '0', '0' };
@@ -896,31 +1225,40 @@ public class BigDecimalTest extends junit.framework.TestCase {
assertEquals(bd.doubleValue(), nbd.doubleValue(), 0.0);
assertEquals(bd.toString(), nbd.toString());
}
-
- /**
- * @tests java.math.BigDecimal#stripTrailingZero(long)
- */
- public void test_stripTrailingZero() {
- BigDecimal sixhundredtest = new BigDecimal("600.0");
- assertTrue("stripTrailingZero failed for 600.0",
- ((sixhundredtest.stripTrailingZeros()).scale() == -2)
- );
-
- /* Single digit, no trailing zero, odd number */
- BigDecimal notrailingzerotest = new BigDecimal("1");
- assertTrue("stripTrailingZero failed for 1",
- ((notrailingzerotest.stripTrailingZeros()).scale() == 0)
- );
-
- /* Zero */
+
+ /**
+ * @tests java.math.BigDecimal#stripTrailingZero(long)
+ */
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "stripTrailingZeros",
+ methodArgs = {}
+ )
+ })
+ public void test_stripTrailingZero() {
+ BigDecimal sixhundredtest = new BigDecimal("600.0");
+ assertTrue("stripTrailingZero failed for 600.0",
+ ((sixhundredtest.stripTrailingZeros()).scale() == -2)
+ );
+
+ /* Single digit, no trailing zero, odd number */
+ BigDecimal notrailingzerotest = new BigDecimal("1");
+ assertTrue("stripTrailingZero failed for 1",
+ ((notrailingzerotest.stripTrailingZeros()).scale() == 0)
+ );
+
+ /* 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)
- );
- }
+ BigDecimal zerotest = new BigDecimal("0.0000");
+ assertTrue("stripTrailingZero failed for 0.0000",
+ ((zerotest.stripTrailingZeros()).scale() == 0)
+ );
+ }
- public void testMathContextConstruction() {
+ public void testMathContextConstruction() {
String a = "-12380945E+61";
BigDecimal aNumber = new BigDecimal(a);
int precision = 6;
@@ -938,7 +1276,7 @@ public class BigDecimalTest extends junit.framework.TestCase {
mcStr);
assertEquals("Different MathContext are reported as Equal ",
- mcInt.equals(mcStr),
+ mcInt.equals(mcStr),
false);
assertEquals("Equal MathContexts have different hashcodes ",
@@ -948,6 +1286,6 @@ public class BigDecimalTest extends junit.framework.TestCase {
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 5a4fae7..16e2e50 100644
--- a/math/src/test/java/tests/api/java/math/BigIntegerTest.java
+++ b/math/src/test/java/tests/api/java/math/BigIntegerTest.java
@@ -17,9 +17,15 @@
package tests.api.java.math;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTarget;
+
import java.math.BigInteger;
import java.util.Random;
+@TestTargetClass(BigInteger.class)
public class BigIntegerTest extends junit.framework.TestCase {
BigInteger minusTwo = new BigInteger("-2", 10);
@@ -80,6 +86,15 @@ 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}
+ )
+ })
public void test_ConstructorILjava_util_Random() {
// regression test for HARMONY-1047
try {
@@ -132,6 +147,15 @@ public class BigIntegerTest extends junit.framework.TestCase {
/**
* @tests java.math.BigInteger#BigInteger(byte[])
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "NumberFormatException checking missed",
+ targets = {
+ @TestTarget(
+ methodName = "BigInteger",
+ methodArgs = {byte[].class}
+ )
+ })
public void test_Constructor$B() {
byte[] myByteArray;
myByteArray = new byte[] { (byte) 0x00, (byte) 0xFF, (byte) 0xFE };
@@ -146,6 +170,15 @@ 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}
+ )
+ })
public void test_ConstructorI$B() {
byte[] myByteArray;
myByteArray = new byte[] { (byte) 0xFF, (byte) 0xFE };
@@ -170,6 +203,15 @@ 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}
+ )
+ })
public void test_constructor_String_empty() {
try {
new BigInteger("");
@@ -181,6 +223,15 @@ public class BigIntegerTest extends junit.framework.TestCase {
/**
* @tests java.math.BigInteger#toByteArray()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "toByteArray",
+ methodArgs = {}
+ )
+ })
public void test_toByteArray() {
byte[] myByteArray, anotherByteArray;
myByteArray = new byte[] { 97, 33, 120, 124, 50, 2, 0, 0, 0, 12, 124,
@@ -197,6 +248,15 @@ public class BigIntegerTest extends junit.framework.TestCase {
/**
* @tests java.math.BigInteger#isProbablePrime(int)
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isProbablePrime",
+ methodArgs = {int.class}
+ )
+ })
public void test_isProbablePrimeI() {
int fails = 0;
bi = new BigInteger(20, 20, rand);
@@ -299,6 +359,15 @@ public class BigIntegerTest extends junit.framework.TestCase {
/**
* @tests java.math.BigInteger#equals(java.lang.Object)
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "equals",
+ methodArgs = {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(
@@ -314,6 +383,15 @@ 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}
+ )
+ })
public void test_compareToLjava_math_BigInteger() {
assertTrue("Smaller number returned >= 0", one.compareTo(two) < 0);
assertTrue("Larger number returned >= 0", two.compareTo(one) > 0);
@@ -325,6 +403,15 @@ public class BigIntegerTest extends junit.framework.TestCase {
/**
* @tests java.math.BigInteger#intValue()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "intValue",
+ methodArgs = {}
+ )
+ })
public void test_intValue() {
assertTrue("Incorrect intValue for 2**70",
twoToTheSeventy.intValue() == 0);
@@ -334,6 +421,15 @@ public class BigIntegerTest extends junit.framework.TestCase {
/**
* @tests java.math.BigInteger#longValue()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "longValue",
+ methodArgs = {}
+ )
+ })
public void test_longValue() {
assertTrue("Incorrect longValue for 2**70",
twoToTheSeventy.longValue() == 0);
@@ -343,6 +439,15 @@ 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}
+ )
+ })
public void test_valueOfJ() {
assertTrue("Incurred number returned for 2", BigInteger.valueOf(2L)
.equals(two));
@@ -353,6 +458,15 @@ 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}
+ )
+ })
public void test_addLjava_math_BigInteger() {
assertTrue("Incorrect sum--wanted a zillion", aZillion.add(aZillion)
.add(aZillion.negate()).equals(aZillion));
@@ -387,6 +501,15 @@ public class BigIntegerTest extends junit.framework.TestCase {
/**
* @tests java.math.BigInteger#negate()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "negate",
+ methodArgs = {}
+ )
+ })
public void test_negate() {
assertTrue("Single negation of zero did not result in zero", zero
.negate().equals(zero));
@@ -415,6 +538,15 @@ public class BigIntegerTest extends junit.framework.TestCase {
/**
* @tests java.math.BigInteger#signum()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "signum",
+ methodArgs = {}
+ )
+ })
public void test_signum() {
assertTrue("Wrong positive signum", two.signum() == 1);
assertTrue("Wrong zero signum", zero.signum() == 0);
@@ -425,6 +557,15 @@ public class BigIntegerTest extends junit.framework.TestCase {
/**
* @tests java.math.BigInteger#abs()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "abs",
+ methodArgs = {}
+ )
+ })
public void test_abs() {
assertTrue("Invalid number returned for zillion", aZillion.negate()
.abs().equals(aZillion.abs()));
@@ -438,6 +579,15 @@ 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}
+ )
+ })
public void test_powI() {
assertTrue("Incorrect exponent returned for 2**10", two.pow(10).equals(
twoToTheTen));
@@ -450,6 +600,15 @@ 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}
+ )
+ })
public void test_modInverseLjava_math_BigInteger() {
BigInteger a = zero, mod, inv;
for (int j = 3; j < 50; j++) {
@@ -499,6 +658,15 @@ 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}
+ )
+ })
public void test_shiftRightI() {
assertTrue("1 >> 0", BigInteger.valueOf(1).shiftRight(0).equals(
BigInteger.ONE));
@@ -556,6 +724,15 @@ 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}
+ )
+ })
public void test_shiftLeftI() {
assertTrue("1 << 0", one.shiftLeft(0).equals(one));
assertTrue("1 << 1", one.shiftLeft(1).equals(two));
@@ -597,6 +774,15 @@ 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}
+ )
+ })
public void test_multiplyLjava_math_BigInteger() {
assertTrue("Incorrect sum--wanted three zillion", aZillion
.add(aZillion).add(aZillion).equals(
@@ -623,6 +809,15 @@ 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}
+ )
+ })
public void test_divideLjava_math_BigInteger() {
testAllDivs(bi33, bi3);
testAllDivs(bi22, bi2);
@@ -681,6 +876,15 @@ 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}
+ )
+ })
public void test_remainderLjava_math_BigInteger() {
try {
largePos.remainder(zero);
@@ -710,6 +914,15 @@ 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}
+ )
+ })
public void test_modLjava_math_BigInteger() {
try {
largePos.mod(zero);
@@ -739,6 +952,15 @@ 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}
+ )
+ })
public void test_divideAndRemainderLjava_math_BigInteger() {
try {
largePos.divideAndRemainder(zero);
@@ -768,6 +990,15 @@ 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}
+ )
+ })
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)));
@@ -782,6 +1013,15 @@ 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}
+ )
+ })
public void test_ConstructorLjava_lang_StringI() {
assertTrue("new(0,16)", new BigInteger("0", 16).equals(BigInteger
.valueOf(0)));
@@ -806,6 +1046,15 @@ public class BigIntegerTest extends junit.framework.TestCase {
/**
* @tests java.math.BigInteger#toString()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "toString",
+ methodArgs = {}
+ )
+ })
public void test_toString() {
assertTrue("0.toString", "0".equals(BigInteger.valueOf(0).toString()));
assertTrue("1.toString", "1".equals(BigInteger.valueOf(1).toString()));
@@ -820,6 +1069,15 @@ 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}
+ )
+ })
public void test_toStringI() {
assertTrue("0.toString(16)", "0".equals(BigInteger.valueOf(0).toString(
16)));
@@ -838,6 +1096,15 @@ 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}
+ )
+ })
public void test_andLjava_math_BigInteger() {
for (BigInteger[] element : booleanPairs) {
BigInteger i1 = element[0], i2 = element[1];
@@ -854,6 +1121,15 @@ 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}
+ )
+ })
public void test_orLjava_math_BigInteger() {
for (BigInteger[] element : booleanPairs) {
BigInteger i1 = element[0], i2 = element[1];
@@ -870,6 +1146,15 @@ 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}
+ )
+ })
public void test_xorLjava_math_BigInteger() {
for (BigInteger[] element : booleanPairs) {
BigInteger i1 = element[0], i2 = element[1];
@@ -886,6 +1171,15 @@ public class BigIntegerTest extends junit.framework.TestCase {
/**
* @tests java.math.BigInteger#not()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "not",
+ methodArgs = {}
+ )
+ })
public void test_not() {
for (BigInteger[] element : booleanPairs) {
BigInteger i1 = element[0];
@@ -900,6 +1194,15 @@ 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}
+ )
+ })
public void test_andNotLjava_math_BigInteger() {
for (BigInteger[] element : booleanPairs) {
BigInteger i1 = element[0], i2 = element[1];
@@ -921,7 +1224,16 @@ public class BigIntegerTest extends junit.framework.TestCase {
}
- public void testClone() {
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Regression test",
+ targets = {
+ @TestTarget(
+ methodName = "clone",
+ methodArgs = {}
+ )
+ })
+ public void testClone() {
// Regression test for HARMONY-1770
MyBigInteger myBigInteger = new MyBigInteger("12345");
myBigInteger = (MyBigInteger) myBigInteger.clone();
diff --git a/math/src/test/java/tests/math/AllTests.java b/math/src/test/java/tests/math/AllTests.java
index 20664fd..9216f21 100644
--- a/math/src/test/java/tests/math/AllTests.java
+++ b/math/src/test/java/tests/math/AllTests.java
@@ -32,30 +32,8 @@ public class AllTests {
TestSuite suite = new TestSuite("All Math test suites");
suite.addTest(tests.api.java.math.AllTests.suite());
+ suite.addTest(org.apache.harmony.tests.java.math.AllTests.suite());
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigDecimalArithmeticTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigDecimalCompareTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigDecimalConstructorsTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigDecimalConvertTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigDecimalScaleOperationsTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerAddTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerAndTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerCompareTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerConstructorsTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerConvertTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerDivideTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerHashCodeTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerModPowTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerMultiplyTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerNotTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerOperateBitsTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerOrTest.class);
- // suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerProbablePrimeTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerSubtractTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerToStringTest.class);
- suite.addTestSuite(org.apache.harmony.tests.java.math.BigIntegerXorTest.class);
- // suite.addTestSuite(org.apache.harmony.tests.java.math.MathContextConstructorsTest.class);
- // suite.addTestSuite(org.apache.harmony.tests.java.math.MathContextMethodsTest.class);
return suite;
}
}