harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r389715 [11/12] - in /incubator/harmony/enhanced/classlib/trunk: make/ modules/math/META-INF/ modules/math/make/ modules/math/make/common/ modules/math/src/main/java/java/math/ modules/math/src/test/java/org/ modules/math/src/test/java/org/...
Date Wed, 29 Mar 2006 09:01:07 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/math/BigIntegerOrTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/math/BigIntegerOrTest.java?rev=389715&r1=389571&r2=389715&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/math/BigIntegerOrTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/math/BigIntegerOrTest.java Wed Mar 29 01:01:04 2006
@@ -1,410 +1,410 @@
-/*
- *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- *  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.
- */
-/**
- * @author Elena Semukhina
- * @version $Revision: 1.4.6.2 $
- */
-
-package java.math;
-
-import junit.framework.TestCase;
-import java.math.BigInteger;
-
-/**
- * Class:  java.math.BigInteger
- * Method: or 
- */
-public class BigIntegerOrTest extends TestCase {
-    /**
-     * Or for zero and a positive number
-     */
-    public void testZeroPos() {
-        byte aBytes[] = {0};
-        byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
-        int aSign = 0;
-        int bSign = 1;        
-        byte rBytes[] = {0, -2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == 1);
-    }
-
-    /**
-     * Or for zero and a negative number
-     */
-    public void testZeroNeg() {
-        byte aBytes[] = {0};
-        byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
-        int aSign = 0;
-        int bSign = -1;        
-        byte rBytes[] = {-1, 1, 2, 3, 3, -6, -15, -24, -40, -49, -58, -67, -6, -15, -23};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == -1);
-    }
-
-    /**
-     * Or for a positive number and zero 
-     */
-    public void testPosZero() {
-        byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
-        byte bBytes[] = {0};
-        int aSign = 1;
-        int bSign = 0;        
-        byte rBytes[] = {0, -2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == 1);
-    }
-
-    /**
-     * Or for a negative number and zero  
-     */
-    public void testNegPos() {
-        byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
-        byte bBytes[] = {0};
-        int aSign = -1;
-        int bSign = 0;        
-        byte rBytes[] = {-1, 1, 2, 3, 3, -6, -15, -24, -40, -49, -58, -67, -6, -15, -23};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == -1);
-    }
-
-    /**
-     * Or for zero and zero
-     */
-    public void testZeroZero() {
-        byte aBytes[] = {0};
-        byte bBytes[] = {0};
-        int aSign = 0;
-        int bSign = 0;        
-        byte rBytes[] = {0};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == 0);
-    }
-
-    /**
-     * Or for zero and one
-     */
-    public void testZeroOne() {
-        byte aBytes[] = {0};
-        byte bBytes[] = {1};
-        int aSign = 0;
-        int bSign = 1;        
-        byte rBytes[] = {1};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == 1);
-    }
-
-    /**
-     * Or for one and one
-     */
-    public void testOneOne() {
-        byte aBytes[] = {1};
-        byte bBytes[] = {1};
-        int aSign = 1;
-        int bSign = 1;        
-        byte rBytes[] = {1};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == 1);
-    }
-
-    /**
-     * Or for two positive numbers of the same length
-     */
-    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};
-        int aSign = 1;
-        int bSign = 1;        
-        byte rBytes[] = {0, -2, -3, -4, -4, -1, -66, 95, 47, 123, 59, -13, 39, 30, -97};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == 1);
-    }
-
-    /**
-     * Or for two positive numbers; the first is longer
-     */
-    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};
-        int aSign = 1;
-        int bSign = 1;        
-        byte rBytes[] = {0, -128, 9, 56, 100, -2, -3, -3, -3, 95, 15, -9, 39, 58, -69, 87, 87, -17, -73};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == 1);
-    }
-
-    /**
-     * Or for two positive numbers; the first is shorter
-     */
-    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};
-        int aSign = 1;
-        int bSign = 1;        
-        byte rBytes[] = {0, -128, 9, 56, 100, -2, -3, -3, -3, 95, 15, -9, 39, 58, -69, 87, 87, -17, -73};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == 1);
-    }
-
-    /**
-     * Or for two negative numbers of the same length
-     */
-    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};
-        int aSign = -1;
-        int bSign = -1;        
-        byte rBytes[] = {-1, 127, -57, -101, -5, -5, -18, -38, -17, -2, -65, -2, -11, -3};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == -1);
-    }
-
-    /**
-     * Or for two negative numbers; the first is longer
-     */
-    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};
-        int aSign = -1;
-        int bSign = -1;        
-        byte rBytes[] = {-1, 1, 75, -89, -45, -2, -3, -18, -36, -17, -10, -3, -6, -7, -21};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == -1);
-    }
-
-    /**
-     * Or for two negative numbers; the first is shorter
-     */
-    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};
-        int aSign = -1;
-        int bSign = -1;        
-        byte rBytes[] = {-1, 1, 75, -89, -45, -2, -3, -18, -36, -17, -10, -3, -6, -7, -21};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == -1);
-    }
-
-    /**
-     * Or for two numbers of different signs and the same length
-     */
-    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};
-        int aSign = 1;
-        int bSign = -1;        
-        byte rBytes[] = {-1, 1, -126, 59, 103, -2, -11, -7, -3, -33, -57, -3, -5, -5, -21};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == -1);
-    }
-
-    /**
-     * Or for two numbers of different signs and the same length
-     */
-    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};
-        int aSign = -1;
-        int bSign = 1;        
-        byte rBytes[] = {-1, 5, 79, -73, -9, -76, -3, 78, -35, -17, 119};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == -1);
-    }
-
-    /**
-     * Or for a negative and a positive numbers; the first is longer
-     */
-    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};
-        int aSign = -1;
-        int bSign = 1;        
-        byte rBytes[] = {-1, 127, -10, -57, -101, -1, -1, -2, -2, -91, -2, 31, -1, -11, 125, -22, -83, 30, 95};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == -1);
-    }
-
-    /**
-     * Or for two negative numbers; the first is shorter
-     */
-    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};
-        int aSign = -1;
-        int bSign = 1;        
-        byte rBytes[] = {-74, 91, 47, -5, -13, -7, -5, -33, -49, -65, -1, -9, -3};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == -1);
-    }
-
-    /**
-     * Or for a positive and a negative numbers; the first is longer
-     */
-    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};
-        int aSign = 1;
-        int bSign = -1;        
-        byte rBytes[] = {-74, 91, 47, -5, -13, -7, -5, -33, -49, -65, -1, -9, -3};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == -1);
-    }
-
-    /**
-     * Or for a positive and a negative number; the first is shorter
-     */
-    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};
-        int aSign = 1;
-        int bSign = -1;        
-        byte rBytes[] = {-1, 127, -10, -57, -101, -1, -1, -2, -2, -91, -2, 31, -1, -11, 125, -22, -83, 30, 95};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.or(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue("incorrect sign", result.signum() == -1);
-    }
-}
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+/**
+ * @author Elena Semukhina
+ * @version $Revision: 1.4.6.2 $
+ */
+
+package org.apache.harmony.tests.math;
+
+import junit.framework.TestCase;
+import java.math.BigInteger;
+
+/**
+ * Class:  java.math.BigInteger
+ * Method: or 
+ */
+public class BigIntegerOrTest extends TestCase {
+    /**
+     * Or for zero and a positive number
+     */
+    public void testZeroPos() {
+        byte aBytes[] = {0};
+        byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
+        int aSign = 0;
+        int bSign = 1;        
+        byte rBytes[] = {0, -2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == 1);
+    }
+
+    /**
+     * Or for zero and a negative number
+     */
+    public void testZeroNeg() {
+        byte aBytes[] = {0};
+        byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
+        int aSign = 0;
+        int bSign = -1;        
+        byte rBytes[] = {-1, 1, 2, 3, 3, -6, -15, -24, -40, -49, -58, -67, -6, -15, -23};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == -1);
+    }
+
+    /**
+     * Or for a positive number and zero 
+     */
+    public void testPosZero() {
+        byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
+        byte bBytes[] = {0};
+        int aSign = 1;
+        int bSign = 0;        
+        byte rBytes[] = {0, -2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == 1);
+    }
+
+    /**
+     * Or for a negative number and zero  
+     */
+    public void testNegPos() {
+        byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
+        byte bBytes[] = {0};
+        int aSign = -1;
+        int bSign = 0;        
+        byte rBytes[] = {-1, 1, 2, 3, 3, -6, -15, -24, -40, -49, -58, -67, -6, -15, -23};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == -1);
+    }
+
+    /**
+     * Or for zero and zero
+     */
+    public void testZeroZero() {
+        byte aBytes[] = {0};
+        byte bBytes[] = {0};
+        int aSign = 0;
+        int bSign = 0;        
+        byte rBytes[] = {0};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == 0);
+    }
+
+    /**
+     * Or for zero and one
+     */
+    public void testZeroOne() {
+        byte aBytes[] = {0};
+        byte bBytes[] = {1};
+        int aSign = 0;
+        int bSign = 1;        
+        byte rBytes[] = {1};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == 1);
+    }
+
+    /**
+     * Or for one and one
+     */
+    public void testOneOne() {
+        byte aBytes[] = {1};
+        byte bBytes[] = {1};
+        int aSign = 1;
+        int bSign = 1;        
+        byte rBytes[] = {1};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == 1);
+    }
+
+    /**
+     * Or for two positive numbers of the same length
+     */
+    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};
+        int aSign = 1;
+        int bSign = 1;        
+        byte rBytes[] = {0, -2, -3, -4, -4, -1, -66, 95, 47, 123, 59, -13, 39, 30, -97};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == 1);
+    }
+
+    /**
+     * Or for two positive numbers; the first is longer
+     */
+    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};
+        int aSign = 1;
+        int bSign = 1;        
+        byte rBytes[] = {0, -128, 9, 56, 100, -2, -3, -3, -3, 95, 15, -9, 39, 58, -69, 87, 87, -17, -73};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == 1);
+    }
+
+    /**
+     * Or for two positive numbers; the first is shorter
+     */
+    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};
+        int aSign = 1;
+        int bSign = 1;        
+        byte rBytes[] = {0, -128, 9, 56, 100, -2, -3, -3, -3, 95, 15, -9, 39, 58, -69, 87, 87, -17, -73};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == 1);
+    }
+
+    /**
+     * Or for two negative numbers of the same length
+     */
+    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};
+        int aSign = -1;
+        int bSign = -1;        
+        byte rBytes[] = {-1, 127, -57, -101, -5, -5, -18, -38, -17, -2, -65, -2, -11, -3};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == -1);
+    }
+
+    /**
+     * Or for two negative numbers; the first is longer
+     */
+    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};
+        int aSign = -1;
+        int bSign = -1;        
+        byte rBytes[] = {-1, 1, 75, -89, -45, -2, -3, -18, -36, -17, -10, -3, -6, -7, -21};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == -1);
+    }
+
+    /**
+     * Or for two negative numbers; the first is shorter
+     */
+    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};
+        int aSign = -1;
+        int bSign = -1;        
+        byte rBytes[] = {-1, 1, 75, -89, -45, -2, -3, -18, -36, -17, -10, -3, -6, -7, -21};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == -1);
+    }
+
+    /**
+     * Or for two numbers of different signs and the same length
+     */
+    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};
+        int aSign = 1;
+        int bSign = -1;        
+        byte rBytes[] = {-1, 1, -126, 59, 103, -2, -11, -7, -3, -33, -57, -3, -5, -5, -21};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == -1);
+    }
+
+    /**
+     * Or for two numbers of different signs and the same length
+     */
+    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};
+        int aSign = -1;
+        int bSign = 1;        
+        byte rBytes[] = {-1, 5, 79, -73, -9, -76, -3, 78, -35, -17, 119};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == -1);
+    }
+
+    /**
+     * Or for a negative and a positive numbers; the first is longer
+     */
+    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};
+        int aSign = -1;
+        int bSign = 1;        
+        byte rBytes[] = {-1, 127, -10, -57, -101, -1, -1, -2, -2, -91, -2, 31, -1, -11, 125, -22, -83, 30, 95};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == -1);
+    }
+
+    /**
+     * Or for two negative numbers; the first is shorter
+     */
+    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};
+        int aSign = -1;
+        int bSign = 1;        
+        byte rBytes[] = {-74, 91, 47, -5, -13, -7, -5, -33, -49, -65, -1, -9, -3};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == -1);
+    }
+
+    /**
+     * Or for a positive and a negative numbers; the first is longer
+     */
+    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};
+        int aSign = 1;
+        int bSign = -1;        
+        byte rBytes[] = {-74, 91, 47, -5, -13, -7, -5, -33, -49, -65, -1, -9, -3};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == -1);
+    }
+
+    /**
+     * Or for a positive and a negative number; the first is shorter
+     */
+    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};
+        int aSign = 1;
+        int bSign = -1;        
+        byte rBytes[] = {-1, 127, -10, -57, -101, -1, -1, -2, -2, -91, -2, 31, -1, -11, 125, -22, -83, 30, 95};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.or(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue("incorrect sign", result.signum() == -1);
+    }
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/math/BigIntegerSubtractTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/math/BigIntegerSubtractTest.java?rev=389715&r1=389571&r2=389715&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/math/BigIntegerSubtractTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/math/BigIntegerSubtractTest.java Wed Mar 29 01:01:04 2006
@@ -1,547 +1,547 @@
-/*
- *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- *  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.
- */
-/**
- * @author Elena Semukhina
- * @version $Revision: 1.4.6.2 $
- */
-
-package java.math;
-
-import junit.framework.TestCase;
-import java.math.BigInteger;
-
-/**
- * Class:  java.math.BigInteger
- * Method: subtract 
- */
-public class BigIntegerSubtractTest extends TestCase {
-    /**
-     * Subtract two positive numbers of the same length.
-     * The first is greater.
-     */
-    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};
-        int aSign = 1;
-        int bSign = 1;        
-        byte rBytes[] = {9, 18, 27, 36, 45, 54, 63, 9, 18, 27};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 1);
-    }
-
-    /**
-     * Subtract two positive numbers of the same length.
-     * The second is greater.
-     */
-    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};
-        int aSign = 1;
-        int bSign = 1;        
-        byte rBytes[] = {-10, -19, -28, -37, -46, -55, -64, -10, -19, -27};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == -1);
-    }
-
-    /**
-     * Subtract two numbers of the same length and different signs.
-     * The first is positive.
-     * The first is greater in absolute value.
-     */
-    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};
-        int aSign = 1;
-        int bSign = -1;        
-        byte rBytes[] = {11, 22, 33, 44, 55, 66, 77, 11, 22, 33};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 1);
-    }
-
-    /**
-     * Subtract two numbers of the same length and different signs.
-     * The first is positive.
-     * The second is greater in absolute value.
-     */
-    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};
-        int aSign = 1;
-        int bSign = -1;        
-        byte rBytes[] = {11, 22, 33, 44, 55, 66, 77, 11, 22, 33};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 1);
-    }
-
-    /**
-     * Subtract two negative numbers of the same length.
-     * The first is greater in absolute value.
-     */
-    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};
-        int aSign = -1;
-        int bSign = -1;        
-        byte rBytes[] = {-10, -19, -28, -37, -46, -55, -64, -10, -19, -27};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == -1);
-    }
-
-    /**
-     * Subtract two negative numbers of the same length.
-     * The second is greater in absolute value.
-     */
-    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};
-        int aSign = -1;
-        int bSign = -1;        
-        byte rBytes[] = {9, 18, 27, 36, 45, 54, 63, 9, 18, 27};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 1);
-    }
-
-    /**
-     * Subtract two numbers of the same length and different signs.
-     * The first is negative.
-     * The first is greater in absolute value.
-     */
-    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};
-        int aSign = -1;
-        int bSign = 1;        
-        byte rBytes[] = {-12, -23, -34, -45, -56, -67, -78, -12, -23, -33};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == -1);
-    }
-
-    /**
-     * Subtract two numbers of the same length and different signs.
-     * The first is negative.
-     * The second is greater in absolute value.
-     */
-    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};
-        int aSign = -1;
-        int bSign = 1;        
-        byte rBytes[] = {-12, -23, -34, -45, -56, -67, -78, -12, -23, -33};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == -1);
-    }
-    
-    /**
-     * Subtract two positive numbers of different length.
-     * The first is longer.
-     */
-    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};
-        int aSign = 1;
-        int bSign = 1;        
-        byte rBytes[] = {1, 2, 3, 3, -6, -15, -24, -40, -49, -58, -67, -6, -15, -23};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 1);
-    }
-    
-    /**
-     * Subtract two positive numbers of different length.
-     * The second is longer.
-     */
-    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};
-        int aSign = 1;
-        int bSign = 1;        
-        byte rBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == -1);
-    }
-
-    /**
-     * Subtract two numbers of different length and different signs.
-     * The first is positive.
-     * The first is greater in absolute value.
-     */
-    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};
-        int aSign = 1;
-        int bSign = -1;        
-        byte rBytes[] = {1, 2, 3, 4, 15, 26, 37, 41, 52, 63, 74, 15, 26, 37};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 1);
-    }
-
-    /**
-     * Subtract two numbers of the same length and different signs.
-     * The first is positive.
-     * The second is greater in absolute value.
-     */
-    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};
-        int aSign = 1;
-        int bSign = -1;        
-        byte rBytes[] = {1, 2, 3, 4, 15, 26, 37, 41, 52, 63, 74, 15, 26, 37};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 1);
-    }
-    
-    /**
-     * Subtract two numbers of different length and different signs.
-     * The first is negative.
-     * The first is longer.
-     */
-    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};
-        int aSign = -1;
-        int bSign = 1;        
-        byte rBytes[] = {-2, -3, -4, -5, -16, -27, -38, -42, -53, -64, -75, -16, -27, -37};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == -1);
-    }
-
-    /**
-     * Subtract two numbers of the same length and different signs.
-     * The first is negative.
-     * The second is longer.
-     */
-    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};
-        int aSign = -1;
-        int bSign = 1;        
-        byte rBytes[] = {-2, -3, -4, -5, -16, -27, -38, -42, -53, -64, -75, -16, -27, -37};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == -1);
-    }
-
-    /**
-     * Subtract two negative numbers of different length.
-     * The first is longer.
-     */
-    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};
-        int aSign = -1;
-        int bSign = -1;        
-        byte rBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == -1);
-}
-    
-    /**
-     * Subtract two negative numbers of different length.
-     * The second is longer.
-     */
-    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};
-        int aSign = -1;
-        int bSign = -1;        
-        byte rBytes[] = {1, 2, 3, 3, -6, -15, -24, -40, -49, -58, -67, -6, -15, -23};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 1);
-    }
-    
-    /**
-     * Subtract two positive equal in absolute value numbers.
-     */
-    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};
-        byte rBytes[] = {0};
-        int aSign = 1;
-        int bSign = 1;
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 0);
-    }
-
-    /**
-     * Subtract zero from a number.
-     * The number is positive.
-     */
-    public void testCase18() {
-        byte aBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3};
-        byte bBytes[] = {0};
-        byte rBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3};
-        int aSign = 1;
-        int bSign = 0;
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 1);
-    }
-
-    /**
-     * Subtract a number from zero.
-     * The number is negative.
-     */
-    public void testCase19() {
-        byte aBytes[] = {0};
-        byte bBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3};
-        byte rBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3};
-        int aSign = 0;
-        int bSign = -1;
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 1);
-    }
-
-    /**
-     * Subtract zero from zero.
-     */
-    public void testCase20() {
-        byte aBytes[] = {0};
-        byte bBytes[] = {0};
-        byte rBytes[] = {0};
-        int aSign = 0;
-        int bSign = 0;
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 0);
-    }
-    
-    /**
-     * Subtract ZERO from a number.
-     * The number is positive.
-     */
-    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};
-        int aSign = 1;
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = BigInteger.ZERO;
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 1);
-    }
-
-    /**
-     * Subtract a number from ZERO.
-     * The number is negative.
-     */
-    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};
-        int bSign = -1;
-        BigInteger aNumber = BigInteger.ZERO;
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 1);
-    }
-
-    /**
-     * Subtract ZERO from ZERO.
-     */
-    public void testCase23() {
-        byte rBytes[] = {0};
-        BigInteger aNumber = BigInteger.ZERO;
-        BigInteger bNumber = BigInteger.ZERO;
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 0);
-    }
-
-    /**
-     * Subtract ONE from ONE.
-     */
-    public void testCase24() {
-        byte rBytes[] = {0};
-        BigInteger aNumber = BigInteger.ONE;
-        BigInteger bNumber = BigInteger.ONE;
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == 0);
-    }
-
-    /**
-     * Subtract two numbers so that borrow is 1.
-     */
-    public void testCase25() {
-        byte aBytes[] = {-1, -1, -1, -1, -1, -1, -1, -1};
-        byte bBytes[] = {-128, -128, -128, -128, -128, -128, -128, -128, -128};
-        int aSign = 1;
-        int bSign = 1;        
-        byte rBytes[] = {-128, 127, 127, 127, 127, 127, 127, 127, 127};
-        BigInteger aNumber = new BigInteger(aSign, aBytes);
-        BigInteger bNumber = new BigInteger(bSign, bBytes);
-        BigInteger result = aNumber.subtract(bNumber);
-        byte resBytes[] = new byte[rBytes.length];
-        resBytes = result.toByteArray();
-        for(int i = 0; i < resBytes.length; i++) {
-            assertTrue(resBytes[i] == rBytes[i]);
-        }
-        assertTrue(result.signum() == -1);
-    }
-}
-
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+/**
+ * @author Elena Semukhina
+ * @version $Revision: 1.4.6.2 $
+ */
+
+package org.apache.harmony.tests.math;
+
+import junit.framework.TestCase;
+import java.math.BigInteger;
+
+/**
+ * Class:  java.math.BigInteger
+ * Method: subtract 
+ */
+public class BigIntegerSubtractTest extends TestCase {
+    /**
+     * Subtract two positive numbers of the same length.
+     * The first is greater.
+     */
+    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};
+        int aSign = 1;
+        int bSign = 1;        
+        byte rBytes[] = {9, 18, 27, 36, 45, 54, 63, 9, 18, 27};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 1);
+    }
+
+    /**
+     * Subtract two positive numbers of the same length.
+     * The second is greater.
+     */
+    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};
+        int aSign = 1;
+        int bSign = 1;        
+        byte rBytes[] = {-10, -19, -28, -37, -46, -55, -64, -10, -19, -27};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == -1);
+    }
+
+    /**
+     * Subtract two numbers of the same length and different signs.
+     * The first is positive.
+     * The first is greater in absolute value.
+     */
+    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};
+        int aSign = 1;
+        int bSign = -1;        
+        byte rBytes[] = {11, 22, 33, 44, 55, 66, 77, 11, 22, 33};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 1);
+    }
+
+    /**
+     * Subtract two numbers of the same length and different signs.
+     * The first is positive.
+     * The second is greater in absolute value.
+     */
+    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};
+        int aSign = 1;
+        int bSign = -1;        
+        byte rBytes[] = {11, 22, 33, 44, 55, 66, 77, 11, 22, 33};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 1);
+    }
+
+    /**
+     * Subtract two negative numbers of the same length.
+     * The first is greater in absolute value.
+     */
+    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};
+        int aSign = -1;
+        int bSign = -1;        
+        byte rBytes[] = {-10, -19, -28, -37, -46, -55, -64, -10, -19, -27};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == -1);
+    }
+
+    /**
+     * Subtract two negative numbers of the same length.
+     * The second is greater in absolute value.
+     */
+    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};
+        int aSign = -1;
+        int bSign = -1;        
+        byte rBytes[] = {9, 18, 27, 36, 45, 54, 63, 9, 18, 27};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 1);
+    }
+
+    /**
+     * Subtract two numbers of the same length and different signs.
+     * The first is negative.
+     * The first is greater in absolute value.
+     */
+    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};
+        int aSign = -1;
+        int bSign = 1;        
+        byte rBytes[] = {-12, -23, -34, -45, -56, -67, -78, -12, -23, -33};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == -1);
+    }
+
+    /**
+     * Subtract two numbers of the same length and different signs.
+     * The first is negative.
+     * The second is greater in absolute value.
+     */
+    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};
+        int aSign = -1;
+        int bSign = 1;        
+        byte rBytes[] = {-12, -23, -34, -45, -56, -67, -78, -12, -23, -33};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == -1);
+    }
+    
+    /**
+     * Subtract two positive numbers of different length.
+     * The first is longer.
+     */
+    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};
+        int aSign = 1;
+        int bSign = 1;        
+        byte rBytes[] = {1, 2, 3, 3, -6, -15, -24, -40, -49, -58, -67, -6, -15, -23};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 1);
+    }
+    
+    /**
+     * Subtract two positive numbers of different length.
+     * The second is longer.
+     */
+    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};
+        int aSign = 1;
+        int bSign = 1;        
+        byte rBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == -1);
+    }
+
+    /**
+     * Subtract two numbers of different length and different signs.
+     * The first is positive.
+     * The first is greater in absolute value.
+     */
+    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};
+        int aSign = 1;
+        int bSign = -1;        
+        byte rBytes[] = {1, 2, 3, 4, 15, 26, 37, 41, 52, 63, 74, 15, 26, 37};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 1);
+    }
+
+    /**
+     * Subtract two numbers of the same length and different signs.
+     * The first is positive.
+     * The second is greater in absolute value.
+     */
+    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};
+        int aSign = 1;
+        int bSign = -1;        
+        byte rBytes[] = {1, 2, 3, 4, 15, 26, 37, 41, 52, 63, 74, 15, 26, 37};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 1);
+    }
+    
+    /**
+     * Subtract two numbers of different length and different signs.
+     * The first is negative.
+     * The first is longer.
+     */
+    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};
+        int aSign = -1;
+        int bSign = 1;        
+        byte rBytes[] = {-2, -3, -4, -5, -16, -27, -38, -42, -53, -64, -75, -16, -27, -37};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == -1);
+    }
+
+    /**
+     * Subtract two numbers of the same length and different signs.
+     * The first is negative.
+     * The second is longer.
+     */
+    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};
+        int aSign = -1;
+        int bSign = 1;        
+        byte rBytes[] = {-2, -3, -4, -5, -16, -27, -38, -42, -53, -64, -75, -16, -27, -37};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == -1);
+    }
+
+    /**
+     * Subtract two negative numbers of different length.
+     * The first is longer.
+     */
+    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};
+        int aSign = -1;
+        int bSign = -1;        
+        byte rBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == -1);
+}
+    
+    /**
+     * Subtract two negative numbers of different length.
+     * The second is longer.
+     */
+    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};
+        int aSign = -1;
+        int bSign = -1;        
+        byte rBytes[] = {1, 2, 3, 3, -6, -15, -24, -40, -49, -58, -67, -6, -15, -23};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 1);
+    }
+    
+    /**
+     * Subtract two positive equal in absolute value numbers.
+     */
+    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};
+        byte rBytes[] = {0};
+        int aSign = 1;
+        int bSign = 1;
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 0);
+    }
+
+    /**
+     * Subtract zero from a number.
+     * The number is positive.
+     */
+    public void testCase18() {
+        byte aBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3};
+        byte bBytes[] = {0};
+        byte rBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3};
+        int aSign = 1;
+        int bSign = 0;
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 1);
+    }
+
+    /**
+     * Subtract a number from zero.
+     * The number is negative.
+     */
+    public void testCase19() {
+        byte aBytes[] = {0};
+        byte bBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3};
+        byte rBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3};
+        int aSign = 0;
+        int bSign = -1;
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 1);
+    }
+
+    /**
+     * Subtract zero from zero.
+     */
+    public void testCase20() {
+        byte aBytes[] = {0};
+        byte bBytes[] = {0};
+        byte rBytes[] = {0};
+        int aSign = 0;
+        int bSign = 0;
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 0);
+    }
+    
+    /**
+     * Subtract ZERO from a number.
+     * The number is positive.
+     */
+    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};
+        int aSign = 1;
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = BigInteger.ZERO;
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 1);
+    }
+
+    /**
+     * Subtract a number from ZERO.
+     * The number is negative.
+     */
+    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};
+        int bSign = -1;
+        BigInteger aNumber = BigInteger.ZERO;
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 1);
+    }
+
+    /**
+     * Subtract ZERO from ZERO.
+     */
+    public void testCase23() {
+        byte rBytes[] = {0};
+        BigInteger aNumber = BigInteger.ZERO;
+        BigInteger bNumber = BigInteger.ZERO;
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 0);
+    }
+
+    /**
+     * Subtract ONE from ONE.
+     */
+    public void testCase24() {
+        byte rBytes[] = {0};
+        BigInteger aNumber = BigInteger.ONE;
+        BigInteger bNumber = BigInteger.ONE;
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == 0);
+    }
+
+    /**
+     * Subtract two numbers so that borrow is 1.
+     */
+    public void testCase25() {
+        byte aBytes[] = {-1, -1, -1, -1, -1, -1, -1, -1};
+        byte bBytes[] = {-128, -128, -128, -128, -128, -128, -128, -128, -128};
+        int aSign = 1;
+        int bSign = 1;        
+        byte rBytes[] = {-128, 127, 127, 127, 127, 127, 127, 127, 127};
+        BigInteger aNumber = new BigInteger(aSign, aBytes);
+        BigInteger bNumber = new BigInteger(bSign, bBytes);
+        BigInteger result = aNumber.subtract(bNumber);
+        byte resBytes[] = new byte[rBytes.length];
+        resBytes = result.toByteArray();
+        for(int i = 0; i < resBytes.length; i++) {
+            assertTrue(resBytes[i] == rBytes[i]);
+        }
+        assertTrue(result.signum() == -1);
+    }
+}
+

Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/math/BigIntegerToStringTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/math/BigIntegerToStringTest.java?rev=389715&r1=389571&r2=389715&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/math/BigIntegerToStringTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/math/BigIntegerToStringTest.java Wed Mar 29 01:01:04 2006
@@ -1,152 +1,152 @@
-/*
- *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- *  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.
- */
-/**
- * @author Elena Semukhina
- * @version $Revision: 1.3.6.2 $
- */
-
-package java.math;
-
-import java.math.BigInteger;
-
-import junit.framework.TestCase;
-
-/**
- * Class:   java.math.BigInteger
- * Method: toString(int radix)
- */
-public class BigIntegerToStringTest extends TestCase {
-    /**
-     * If 36 < radix < 2 it should be set to 10
-     */
-    public void testRadixOutOfRange() {
-        String value = "442429234853876401";
-        int radix = 10;
-        BigInteger aNumber = new BigInteger(value, radix);
-        String result = aNumber.toString(45);
-        assertTrue(result.equals(value));
-    }
-
-    /**
-     * test negative number of radix 2
-     */
-    public void testRadix2Neg() {
-        String value = "-101001100010010001001010101110000101010110001010010101010101010101010101010101010101010101010010101";
-        int radix = 2;
-        BigInteger aNumber = new BigInteger(value, radix);
-        String result = aNumber.toString(radix);
-        assertTrue(result.equals(value));
-    }
-
-    /**
-     * test positive number of radix 2
-     */
-    public void testRadix2Pos() {
-        String value = "101000011111000000110101010101010101010001001010101010101010010101010101010000100010010";
-        int radix = 2;
-        BigInteger aNumber = new BigInteger(value, radix);
-        String result = aNumber.toString(radix);
-        assertTrue(result.equals(value));
-    }
-
-    /**
-     * test negative number of radix 10
-     */
-    public void testRadix10Neg() {
-        String value = "-2489756308572364789878394872984";
-        int radix = 16;
-        BigInteger aNumber = new BigInteger(value, radix);
-        String result = aNumber.toString(radix);
-        assertTrue(result.equals(value));
-    }
-
-    /**
-     * test positive number of radix 10
-     */
-    public void testRadix10Pos() {
-        String value = "2387627892347567398736473476";
-        int radix = 16;
-        BigInteger aNumber = new BigInteger(value, radix);
-        String result = aNumber.toString(radix);
-        assertTrue(result.equals(value));
-    }
-
-    /**
-     * test negative number of radix 16
-     */
-    public void testRadix16Neg() {
-        String value = "-287628a883451b800865c67e8d7ff20";
-        int radix = 16;
-        BigInteger aNumber = new BigInteger(value, radix);
-        String result = aNumber.toString(radix);
-        assertTrue(result.equals(value));
-    }
-
-    /**
-     * test positive number of radix 16
-     */
-    public void testRadix16Pos() {
-        String value = "287628a883451b800865c67e8d7ff20";
-        int radix = 16;
-        BigInteger aNumber = new BigInteger(value, radix);
-        String result = aNumber.toString(radix);
-        assertTrue(result.equals(value));
-    }
-
-    /**
-     * test negative number of radix 24
-     */
-    public void testRadix24Neg() {
-        String value = "-287628a88gmn3451b8ijk00865c67e8d7ff20";
-        int radix = 24;
-        BigInteger aNumber = new BigInteger(value, radix);
-        String result = aNumber.toString(radix);
-        assertTrue(result.equals(value));
-    }
-
-    /**
-     * test positive number of radix 24
-     */
-    public void testRadix24Pos() {
-        String value = "287628a883451bg80ijhk0865c67e8d7ff20";
-        int radix = 24;
-        BigInteger aNumber = new BigInteger(value, radix);
-        String result = aNumber.toString(radix);
-        assertTrue(result.equals(value));
-    }
-
-    /**
-     * test negative number of radix 24
-     */
-    public void testRadix36Neg() {
-        String value = "-uhguweut98iu4h3478tq3985pq98yeiuth33485yq4aiuhalai485yiaehasdkr8tywi5uhslei8";
-        int radix = 36;
-        BigInteger aNumber = new BigInteger(value, radix);
-        String result = aNumber.toString(radix);
-        assertTrue(result.equals(value));
-    }
-
-    /**
-     * test positive number of radix 24
-     */
-    public void testRadix36Pos() {
-        String value = "23895lt45y6vhgliuwhgi45y845htsuerhsi4586ysuerhtsio5y68peruhgsil4568ypeorihtse48y6";
-        int radix = 36;
-        BigInteger aNumber = new BigInteger(value, radix);
-        String result = aNumber.toString(radix);
-        assertTrue(result.equals(value));
-    }
-}
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+/**
+ * @author Elena Semukhina
+ * @version $Revision: 1.3.6.2 $
+ */
+
+package org.apache.harmony.tests.math;
+
+import java.math.BigInteger;
+
+import junit.framework.TestCase;
+
+/**
+ * Class:   java.math.BigInteger
+ * Method: toString(int radix)
+ */
+public class BigIntegerToStringTest extends TestCase {
+    /**
+     * If 36 < radix < 2 it should be set to 10
+     */
+    public void testRadixOutOfRange() {
+        String value = "442429234853876401";
+        int radix = 10;
+        BigInteger aNumber = new BigInteger(value, radix);
+        String result = aNumber.toString(45);
+        assertTrue(result.equals(value));
+    }
+
+    /**
+     * test negative number of radix 2
+     */
+    public void testRadix2Neg() {
+        String value = "-101001100010010001001010101110000101010110001010010101010101010101010101010101010101010101010010101";
+        int radix = 2;
+        BigInteger aNumber = new BigInteger(value, radix);
+        String result = aNumber.toString(radix);
+        assertTrue(result.equals(value));
+    }
+
+    /**
+     * test positive number of radix 2
+     */
+    public void testRadix2Pos() {
+        String value = "101000011111000000110101010101010101010001001010101010101010010101010101010000100010010";
+        int radix = 2;
+        BigInteger aNumber = new BigInteger(value, radix);
+        String result = aNumber.toString(radix);
+        assertTrue(result.equals(value));
+    }
+
+    /**
+     * test negative number of radix 10
+     */
+    public void testRadix10Neg() {
+        String value = "-2489756308572364789878394872984";
+        int radix = 16;
+        BigInteger aNumber = new BigInteger(value, radix);
+        String result = aNumber.toString(radix);
+        assertTrue(result.equals(value));
+    }
+
+    /**
+     * test positive number of radix 10
+     */
+    public void testRadix10Pos() {
+        String value = "2387627892347567398736473476";
+        int radix = 16;
+        BigInteger aNumber = new BigInteger(value, radix);
+        String result = aNumber.toString(radix);
+        assertTrue(result.equals(value));
+    }
+
+    /**
+     * test negative number of radix 16
+     */
+    public void testRadix16Neg() {
+        String value = "-287628a883451b800865c67e8d7ff20";
+        int radix = 16;
+        BigInteger aNumber = new BigInteger(value, radix);
+        String result = aNumber.toString(radix);
+        assertTrue(result.equals(value));
+    }
+
+    /**
+     * test positive number of radix 16
+     */
+    public void testRadix16Pos() {
+        String value = "287628a883451b800865c67e8d7ff20";
+        int radix = 16;
+        BigInteger aNumber = new BigInteger(value, radix);
+        String result = aNumber.toString(radix);
+        assertTrue(result.equals(value));
+    }
+
+    /**
+     * test negative number of radix 24
+     */
+    public void testRadix24Neg() {
+        String value = "-287628a88gmn3451b8ijk00865c67e8d7ff20";
+        int radix = 24;
+        BigInteger aNumber = new BigInteger(value, radix);
+        String result = aNumber.toString(radix);
+        assertTrue(result.equals(value));
+    }
+
+    /**
+     * test positive number of radix 24
+     */
+    public void testRadix24Pos() {
+        String value = "287628a883451bg80ijhk0865c67e8d7ff20";
+        int radix = 24;
+        BigInteger aNumber = new BigInteger(value, radix);
+        String result = aNumber.toString(radix);
+        assertTrue(result.equals(value));
+    }
+
+    /**
+     * test negative number of radix 24
+     */
+    public void testRadix36Neg() {
+        String value = "-uhguweut98iu4h3478tq3985pq98yeiuth33485yq4aiuhalai485yiaehasdkr8tywi5uhslei8";
+        int radix = 36;
+        BigInteger aNumber = new BigInteger(value, radix);
+        String result = aNumber.toString(radix);
+        assertTrue(result.equals(value));
+    }
+
+    /**
+     * test positive number of radix 24
+     */
+    public void testRadix36Pos() {
+        String value = "23895lt45y6vhgliuwhgi45y845htsuerhsi4586ysuerhtsio5y68peruhgsil4568ypeorihtse48y6";
+        int radix = 36;
+        BigInteger aNumber = new BigInteger(value, radix);
+        String result = aNumber.toString(radix);
+        assertTrue(result.equals(value));
+    }
+}



Mime
View raw message