harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r446491 [22/24] - in /incubator/harmony/enhanced/classlib/trunk/modules: luni-kernel/.settings/ luni-kernel/META-INF/ luni-kernel/make/ luni-kernel/src/main/java/java/lang/ luni-kernel/src/main/java/java/lang/ref/ luni-kernel/src/main/java/...
Date Fri, 15 Sep 2006 03:08:13 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerToStringTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerToStringTest.java?view=diff&rev=446491&r1=446490&r2=446491
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerToStringTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerToStringTest.java
Thu Sep 14 20:08:07 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$
- */
-
-package org.apache.harmony.tests.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$
+ */
+
+package org.apache.harmony.tests.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));
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerToStringTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerXorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerXorTest.java?view=diff&rev=446491&r1=446490&r2=446491
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerXorTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerXorTest.java
Thu Sep 14 20:08:07 2006
@@ -1,277 +1,277 @@
-/*
- *  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$
- */
-
-package org.apache.harmony.tests.java.math;
-
-import junit.framework.TestCase;
-import java.math.BigInteger;
-
-/**
- * Class:  java.math.BigInteger
- * Method: xor
- */
-public class BigIntegerXorTest extends TestCase {
-	/**
-     * Xor for zero and a positive number
-     */
-    public void testZeroPos() {
-        String numA = "0";
-        String numB = "27384627835298756289327365";
-        String res = "27384627835298756289327365";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for zero and a negative number
-     */
-    public void testZeroNeg() {
-        String numA = "0";
-        String numB = "-27384627835298756289327365";
-        String res = "-27384627835298756289327365";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for a positive number and zero 
-     */
-    public void testPosZero() {
-        String numA = "27384627835298756289327365";
-        String numB = "0";
-        String res = "27384627835298756289327365";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for a negative number and zero  
-     */
-    public void testNegPos() {
-        String numA = "-27384627835298756289327365";
-        String numB = "0";
-        String res = "-27384627835298756289327365";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for zero and zero
-     */
-    public void testZeroZero() {
-        String numA = "0";
-        String numB = "0";
-        String res = "0";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for zero and one
-     */
-    public void testZeroOne() {
-        String numA = "0";
-        String numB = "1";
-        String res = "1";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for one and one
-     */
-    public void testOneOne() {
-        String numA = "1";
-        String numB = "1";
-        String res = "0";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for two positive numbers of the same length
-     */
-    public void testPosPosSameLength() {
-        String numA = "283746278342837476784564875684767";
-        String numB = "293478573489347658763745839457637";
-        String res = "71412358434940908477702819237626";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for two positive numbers; the first is longer
-     */
-    public void testPosPosFirstLonger() {
-        String numA = "2837462783428374767845648748973847593874837948575684767";
-        String numB = "293478573489347658763745839457637";
-        String res = "2837462783428374767845615168483972194300564226167553530";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for two positive numbers; the first is shorter
-     */
-    public void testPosPosFirstShorter() {
-        String numA = "293478573489347658763745839457637";
-        String numB = "2837462783428374767845648748973847593874837948575684767";
-        String res = "2837462783428374767845615168483972194300564226167553530";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for two negative numbers of the same length
-     */
-    public void testNegNegSameLength() {
-        String numA = "-283746278342837476784564875684767";
-        String numB = "-293478573489347658763745839457637";
-        String res = "71412358434940908477702819237626";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for two negative numbers; the first is longer
-     */
-    public void testNegNegFirstLonger() {
-        String numA = "-2837462783428374767845648748973847593874837948575684767";
-        String numB = "-293478573489347658763745839457637";
-        String res = "2837462783428374767845615168483972194300564226167553530";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for two negative numbers; the first is shorter
-     */
-    public void testNegNegFirstShorter() {
-        String numA = "293478573489347658763745839457637";
-        String numB = "2837462783428374767845648748973847593874837948575684767";
-        String res = "2837462783428374767845615168483972194300564226167553530";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for two numbers of different signs and the same length
-     */
-    public void testPosNegSameLength() {
-        String numA = "283746278342837476784564875684767";
-        String numB = "-293478573489347658763745839457637";
-        String res = "-71412358434940908477702819237628";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for two numbers of different signs and the same length
-     */
-    public void testNegPosSameLength() {
-        String numA = "-283746278342837476784564875684767";
-        String numB = "293478573489347658763745839457637";
-        String res = "-71412358434940908477702819237628";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for a negative and a positive numbers; the first is longer
-     */
-    public void testNegPosFirstLonger() {
-        String numA = "-2837462783428374767845648748973847593874837948575684767";
-        String numB = "293478573489347658763745839457637";
-        String res = "-2837462783428374767845615168483972194300564226167553532";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for two negative numbers; the first is shorter
-     */
-    public void testNegPosFirstShorter() {
-        String numA = "-293478573489347658763745839457637";
-        String numB = "2837462783428374767845648748973847593874837948575684767";
-        String res = "-2837462783428374767845615168483972194300564226167553532";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for a positive and a negative numbers; the first is longer
-     */
-    public void testPosNegFirstLonger() {
-        String numA = "2837462783428374767845648748973847593874837948575684767";
-        String numB = "-293478573489347658763745839457637";
-        String res = "-2837462783428374767845615168483972194300564226167553532";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-
-    /**
-     * Xor for a positive and a negative number; the first is shorter
-     */
-    public void testPosNegFirstShorter() {
-        String numA = "293478573489347658763745839457637";
-        String numB = "-2837462783428374767845648748973847593874837948575684767";
-        String res = "-2837462783428374767845615168483972194300564226167553532";
-        BigInteger aNumber = new BigInteger(numA);
-        BigInteger bNumber = new BigInteger(numB);
-        BigInteger result = aNumber.xor(bNumber);
-        assertTrue(res.equals(result.toString()));
-    }
-}
+/*
+ *  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$
+ */
+
+package org.apache.harmony.tests.java.math;
+
+import junit.framework.TestCase;
+import java.math.BigInteger;
+
+/**
+ * Class:  java.math.BigInteger
+ * Method: xor
+ */
+public class BigIntegerXorTest extends TestCase {
+	/**
+     * Xor for zero and a positive number
+     */
+    public void testZeroPos() {
+        String numA = "0";
+        String numB = "27384627835298756289327365";
+        String res = "27384627835298756289327365";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for zero and a negative number
+     */
+    public void testZeroNeg() {
+        String numA = "0";
+        String numB = "-27384627835298756289327365";
+        String res = "-27384627835298756289327365";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for a positive number and zero 
+     */
+    public void testPosZero() {
+        String numA = "27384627835298756289327365";
+        String numB = "0";
+        String res = "27384627835298756289327365";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for a negative number and zero  
+     */
+    public void testNegPos() {
+        String numA = "-27384627835298756289327365";
+        String numB = "0";
+        String res = "-27384627835298756289327365";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for zero and zero
+     */
+    public void testZeroZero() {
+        String numA = "0";
+        String numB = "0";
+        String res = "0";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for zero and one
+     */
+    public void testZeroOne() {
+        String numA = "0";
+        String numB = "1";
+        String res = "1";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for one and one
+     */
+    public void testOneOne() {
+        String numA = "1";
+        String numB = "1";
+        String res = "0";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for two positive numbers of the same length
+     */
+    public void testPosPosSameLength() {
+        String numA = "283746278342837476784564875684767";
+        String numB = "293478573489347658763745839457637";
+        String res = "71412358434940908477702819237626";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for two positive numbers; the first is longer
+     */
+    public void testPosPosFirstLonger() {
+        String numA = "2837462783428374767845648748973847593874837948575684767";
+        String numB = "293478573489347658763745839457637";
+        String res = "2837462783428374767845615168483972194300564226167553530";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for two positive numbers; the first is shorter
+     */
+    public void testPosPosFirstShorter() {
+        String numA = "293478573489347658763745839457637";
+        String numB = "2837462783428374767845648748973847593874837948575684767";
+        String res = "2837462783428374767845615168483972194300564226167553530";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for two negative numbers of the same length
+     */
+    public void testNegNegSameLength() {
+        String numA = "-283746278342837476784564875684767";
+        String numB = "-293478573489347658763745839457637";
+        String res = "71412358434940908477702819237626";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for two negative numbers; the first is longer
+     */
+    public void testNegNegFirstLonger() {
+        String numA = "-2837462783428374767845648748973847593874837948575684767";
+        String numB = "-293478573489347658763745839457637";
+        String res = "2837462783428374767845615168483972194300564226167553530";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for two negative numbers; the first is shorter
+     */
+    public void testNegNegFirstShorter() {
+        String numA = "293478573489347658763745839457637";
+        String numB = "2837462783428374767845648748973847593874837948575684767";
+        String res = "2837462783428374767845615168483972194300564226167553530";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for two numbers of different signs and the same length
+     */
+    public void testPosNegSameLength() {
+        String numA = "283746278342837476784564875684767";
+        String numB = "-293478573489347658763745839457637";
+        String res = "-71412358434940908477702819237628";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for two numbers of different signs and the same length
+     */
+    public void testNegPosSameLength() {
+        String numA = "-283746278342837476784564875684767";
+        String numB = "293478573489347658763745839457637";
+        String res = "-71412358434940908477702819237628";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for a negative and a positive numbers; the first is longer
+     */
+    public void testNegPosFirstLonger() {
+        String numA = "-2837462783428374767845648748973847593874837948575684767";
+        String numB = "293478573489347658763745839457637";
+        String res = "-2837462783428374767845615168483972194300564226167553532";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for two negative numbers; the first is shorter
+     */
+    public void testNegPosFirstShorter() {
+        String numA = "-293478573489347658763745839457637";
+        String numB = "2837462783428374767845648748973847593874837948575684767";
+        String res = "-2837462783428374767845615168483972194300564226167553532";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for a positive and a negative numbers; the first is longer
+     */
+    public void testPosNegFirstLonger() {
+        String numA = "2837462783428374767845648748973847593874837948575684767";
+        String numB = "-293478573489347658763745839457637";
+        String res = "-2837462783428374767845615168483972194300564226167553532";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+
+    /**
+     * Xor for a positive and a negative number; the first is shorter
+     */
+    public void testPosNegFirstShorter() {
+        String numA = "293478573489347658763745839457637";
+        String numB = "-2837462783428374767845648748973847593874837948575684767";
+        String res = "-2837462783428374767845615168483972194300564226167553532";
+        BigInteger aNumber = new BigInteger(numA);
+        BigInteger bNumber = new BigInteger(numB);
+        BigInteger result = aNumber.xor(bNumber);
+        assertTrue(res.equals(result.toString()));
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerXorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/tests/api/java/math/AllTests.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/tests/api/java/math/AllTests.java?view=diff&rev=446491&r1=446490&r2=446491
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/tests/api/java/math/AllTests.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/tests/api/java/math/AllTests.java
Thu Sep 14 20:08:07 2006
@@ -1,38 +1,38 @@
-/* Copyright 2004 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.
- */
-
-package tests.api.java.math;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Test suite that includes all tests for the Math project.
- */
-public class AllTests {
-
-	public static void main(String[] args) {
-		junit.textui.TestRunner.run(suite());
-	}
-
-	public static Test suite() {
-		TestSuite suite = new TestSuite("Tests for java.math");
-		// $JUnit-BEGIN$
-		suite.addTestSuite(BigDecimalTest.class);
-		suite.addTestSuite(BigIntegerTest.class);
-		// $JUnit-END$
-		return suite;
-	}
-}
+/* Copyright 2004 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.
+ */
+
+package tests.api.java.math;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Test suite that includes all tests for the Math project.
+ */
+public class AllTests {
+
+	public static void main(String[] args) {
+		junit.textui.TestRunner.run(suite());
+	}
+
+	public static Test suite() {
+		TestSuite suite = new TestSuite("Tests for java.math");
+		// $JUnit-BEGIN$
+		suite.addTestSuite(BigDecimalTest.class);
+		suite.addTestSuite(BigIntegerTest.class);
+		// $JUnit-END$
+		return suite;
+	}
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/math/src/test/java/tests/api/java/math/AllTests.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message