Home | History | Annotate | Download | only in math
      1 /*
      2  *  Licensed to the Apache Software Foundation (ASF) under one or more
      3  *  contributor license agreements.  See the NOTICE file distributed with
      4  *  this work for additional information regarding copyright ownership.
      5  *  The ASF licenses this file to You under the Apache License, Version 2.0
      6  *  (the "License"); you may not use this file except in compliance with
      7  *  the License.  You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  */
     17 /**
     18  * @author Elena Semukhina
     19  * @version $Revision$
     20  */
     21 
     22 package org.apache.harmony.math.tests.java.math;
     23 
     24 import dalvik.annotation.BrokenTest;
     25 import dalvik.annotation.TestTargetClass;
     26 import dalvik.annotation.TestTargets;
     27 import dalvik.annotation.TestLevel;
     28 import dalvik.annotation.TestTargetNew;
     29 
     30 import java.math.BigInteger;
     31 
     32 import junit.framework.TestCase;
     33 @TestTargetClass(BigInteger.class)
     34 /**
     35  * Class:  java.math.BigInteger
     36  * Method: or
     37  */
     38 public class BigIntegerOrTest extends TestCase {
     39     /**
     40      * Or for zero and a positive number
     41      */
     42     @TestTargetNew(
     43         level = TestLevel.PARTIAL_COMPLETE,
     44         notes = "This is a complete subset of tests for or operation",
     45         method = "or",
     46         args = {java.math.BigInteger.class}
     47     )
     48     public void testZeroPos() {
     49         byte aBytes[] = {0};
     50         byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
     51         int aSign = 0;
     52         int bSign = 1;
     53         byte rBytes[] = {0, -2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
     54         BigInteger aNumber = new BigInteger(aSign, aBytes);
     55         BigInteger bNumber = new BigInteger(bSign, bBytes);
     56         BigInteger result = aNumber.or(bNumber);
     57         byte resBytes[] = new byte[rBytes.length];
     58         resBytes = result.toByteArray();
     59         for(int i = 0; i < resBytes.length; i++) {
     60             assertTrue(resBytes[i] == rBytes[i]);
     61         }
     62         assertEquals("incorrect sign", 1, result.signum());
     63     }
     64 
     65     /**
     66      * Or for zero and a negative number
     67      */
     68     @TestTargetNew(
     69         level = TestLevel.PARTIAL_COMPLETE,
     70         notes = "This is a complete subset of tests for or operation",
     71         method = "or",
     72         args = {java.math.BigInteger.class}
     73     )
     74     public void testZeroNeg() {
     75         byte aBytes[] = {0};
     76         byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
     77         int aSign = 0;
     78         int bSign = -1;
     79         byte rBytes[] = {-1, 1, 2, 3, 3, -6, -15, -24, -40, -49, -58, -67, -6, -15, -23};
     80         BigInteger aNumber = new BigInteger(aSign, aBytes);
     81         BigInteger bNumber = new BigInteger(bSign, bBytes);
     82         BigInteger result = aNumber.or(bNumber);
     83         byte resBytes[] = new byte[rBytes.length];
     84         resBytes = result.toByteArray();
     85         for(int i = 0; i < resBytes.length; i++) {
     86             assertTrue(resBytes[i] == rBytes[i]);
     87         }
     88         assertEquals("incorrect sign", -1, result.signum());
     89     }
     90 
     91     /**
     92      * Or for a positive number and zero
     93      */
     94     @TestTargetNew(
     95         level = TestLevel.PARTIAL_COMPLETE,
     96         notes = "This is a complete subset of tests for or operation",
     97         method = "or",
     98         args = {java.math.BigInteger.class}
     99     )
    100     public void testPosZero() {
    101         byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
    102         byte bBytes[] = {0};
    103         int aSign = 1;
    104         int bSign = 0;
    105         byte rBytes[] = {0, -2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
    106         BigInteger aNumber = new BigInteger(aSign, aBytes);
    107         BigInteger bNumber = new BigInteger(bSign, bBytes);
    108         BigInteger result = aNumber.or(bNumber);
    109         byte resBytes[] = new byte[rBytes.length];
    110         resBytes = result.toByteArray();
    111         for(int i = 0; i < resBytes.length; i++) {
    112             assertTrue(resBytes[i] == rBytes[i]);
    113         }
    114         assertEquals("incorrect sign", 1, result.signum());
    115     }
    116 
    117     /**
    118      * Or for a negative number and zero
    119      */
    120     @TestTargetNew(
    121         level = TestLevel.PARTIAL_COMPLETE,
    122         notes = "This is a complete subset of tests for or operation",
    123         method = "or",
    124         args = {java.math.BigInteger.class}
    125     )
    126     public void testNegPos() {
    127         byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
    128         byte bBytes[] = {0};
    129         int aSign = -1;
    130         int bSign = 0;
    131         byte rBytes[] = {-1, 1, 2, 3, 3, -6, -15, -24, -40, -49, -58, -67, -6, -15, -23};
    132         BigInteger aNumber = new BigInteger(aSign, aBytes);
    133         BigInteger bNumber = new BigInteger(bSign, bBytes);
    134         BigInteger result = aNumber.or(bNumber);
    135         byte resBytes[] = new byte[rBytes.length];
    136         resBytes = result.toByteArray();
    137         for(int i = 0; i < resBytes.length; i++) {
    138             assertTrue(resBytes[i] == rBytes[i]);
    139         }
    140         assertEquals("incorrect sign", -1, result.signum());
    141     }
    142 
    143     /**
    144      * Or for zero and zero
    145      */
    146     @TestTargetNew(
    147         level = TestLevel.PARTIAL_COMPLETE,
    148         notes = "This is a complete subset of tests for or operation",
    149         method = "or",
    150         args = {java.math.BigInteger.class}
    151     )
    152     public void testZeroZero() {
    153         byte aBytes[] = {0};
    154         byte bBytes[] = {0};
    155         int aSign = 0;
    156         int bSign = 0;
    157         byte rBytes[] = {0};
    158         BigInteger aNumber = new BigInteger(aSign, aBytes);
    159         BigInteger bNumber = new BigInteger(bSign, bBytes);
    160         BigInteger result = aNumber.or(bNumber);
    161         byte resBytes[] = new byte[rBytes.length];
    162         resBytes = result.toByteArray();
    163         for(int i = 0; i < resBytes.length; i++) {
    164             assertTrue(resBytes[i] == rBytes[i]);
    165         }
    166         assertEquals("incorrect sign", 0, result.signum());
    167     }
    168 
    169     /**
    170      * Or for zero and one
    171      */
    172     @TestTargetNew(
    173         level = TestLevel.PARTIAL_COMPLETE,
    174         notes = "This is a complete subset of tests for or operation",
    175         method = "or",
    176         args = {java.math.BigInteger.class}
    177     )
    178     public void testZeroOne() {
    179         byte aBytes[] = {0};
    180         byte bBytes[] = {1};
    181         int aSign = 0;
    182         int bSign = 1;
    183         byte rBytes[] = {1};
    184         BigInteger aNumber = new BigInteger(aSign, aBytes);
    185         BigInteger bNumber = new BigInteger(bSign, bBytes);
    186         BigInteger result = aNumber.or(bNumber);
    187         byte resBytes[] = new byte[rBytes.length];
    188         resBytes = result.toByteArray();
    189         for(int i = 0; i < resBytes.length; i++) {
    190             assertTrue(resBytes[i] == rBytes[i]);
    191         }
    192         assertEquals("incorrect sign", 1, result.signum());
    193     }
    194 
    195     /**
    196      * Or for one and one
    197      */
    198     @TestTargetNew(
    199         level = TestLevel.PARTIAL_COMPLETE,
    200         notes = "This is a complete subset of tests for or operation",
    201         method = "or",
    202         args = {java.math.BigInteger.class}
    203     )
    204     public void testOneOne() {
    205         byte aBytes[] = {1};
    206         byte bBytes[] = {1};
    207         int aSign = 1;
    208         int bSign = 1;
    209         byte rBytes[] = {1};
    210         BigInteger aNumber = new BigInteger(aSign, aBytes);
    211         BigInteger bNumber = new BigInteger(bSign, bBytes);
    212         BigInteger result = aNumber.or(bNumber);
    213         byte resBytes[] = new byte[rBytes.length];
    214         resBytes = result.toByteArray();
    215         for(int i = 0; i < resBytes.length; i++) {
    216             assertTrue(resBytes[i] == rBytes[i]);
    217         }
    218         assertEquals("incorrect sign", 1, result.signum());
    219     }
    220 
    221     /**
    222      * Or for two positive numbers of the same length
    223      */
    224     @TestTargetNew(
    225         level = TestLevel.PARTIAL_COMPLETE,
    226         notes = "This is a complete subset of tests for or operation",
    227         method = "or",
    228         args = {java.math.BigInteger.class}
    229     )
    230     public void testPosPosSameLength() {
    231         byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117};
    232         byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
    233         int aSign = 1;
    234         int bSign = 1;
    235         byte rBytes[] = {0, -2, -3, -4, -4, -1, -66, 95, 47, 123, 59, -13, 39, 30, -97};
    236         BigInteger aNumber = new BigInteger(aSign, aBytes);
    237         BigInteger bNumber = new BigInteger(bSign, bBytes);
    238         BigInteger result = aNumber.or(bNumber);
    239         byte resBytes[] = new byte[rBytes.length];
    240         resBytes = result.toByteArray();
    241         for(int i = 0; i < resBytes.length; i++) {
    242             assertTrue(resBytes[i] == rBytes[i]);
    243         }
    244         assertEquals("incorrect sign", 1, result.signum());
    245     }
    246 
    247     /**
    248      * Or for two positive numbers; the first is longer
    249      */
    250     @TestTargetNew(
    251         level = TestLevel.PARTIAL_COMPLETE,
    252         notes = "This is a complete subset of tests for or operation",
    253         method = "or",
    254         args = {java.math.BigInteger.class}
    255     )
    256     public void testPosPosFirstLonger() {
    257         byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75};
    258         byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
    259         int aSign = 1;
    260         int bSign = 1;
    261         byte rBytes[] = {0, -128, 9, 56, 100, -2, -3, -3, -3, 95, 15, -9, 39, 58, -69, 87, 87, -17, -73};
    262         BigInteger aNumber = new BigInteger(aSign, aBytes);
    263         BigInteger bNumber = new BigInteger(bSign, bBytes);
    264         BigInteger result = aNumber.or(bNumber);
    265         byte resBytes[] = new byte[rBytes.length];
    266         resBytes = result.toByteArray();
    267         for(int i = 0; i < resBytes.length; i++) {
    268             assertTrue(resBytes[i] == rBytes[i]);
    269         }
    270         assertEquals("incorrect sign", 1, result.signum());
    271     }
    272 
    273     /**
    274      * Or for two positive numbers; the first is shorter
    275      */
    276     @TestTargetNew(
    277         level = TestLevel.PARTIAL_COMPLETE,
    278         notes = "This is a complete subset of tests for or operation",
    279         method = "or",
    280         args = {java.math.BigInteger.class}
    281     )
    282     public void testPosPosFirstShorter() {
    283         byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
    284         byte bBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75};
    285         int aSign = 1;
    286         int bSign = 1;
    287         byte rBytes[] = {0, -128, 9, 56, 100, -2, -3, -3, -3, 95, 15, -9, 39, 58, -69, 87, 87, -17, -73};
    288         BigInteger aNumber = new BigInteger(aSign, aBytes);
    289         BigInteger bNumber = new BigInteger(bSign, bBytes);
    290         BigInteger result = aNumber.or(bNumber);
    291         byte resBytes[] = new byte[rBytes.length];
    292         resBytes = result.toByteArray();
    293         for(int i = 0; i < resBytes.length; i++) {
    294             assertTrue(resBytes[i] == rBytes[i]);
    295         }
    296         assertEquals("incorrect sign", 1, result.signum());
    297     }
    298 
    299     /**
    300      * Or for two negative numbers of the same length
    301      */
    302     @TestTargetNew(
    303         level = TestLevel.PARTIAL_COMPLETE,
    304         notes = "This is a complete subset of tests for or operation",
    305         method = "or",
    306         args = {java.math.BigInteger.class}
    307     )
    308     public void testNegNegSameLength() {
    309         byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117};
    310         byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
    311         int aSign = -1;
    312         int bSign = -1;
    313         byte rBytes[] = {-1, 127, -57, -101, -5, -5, -18, -38, -17, -2, -65, -2, -11, -3};
    314         BigInteger aNumber = new BigInteger(aSign, aBytes);
    315         BigInteger bNumber = new BigInteger(bSign, bBytes);
    316         BigInteger result = aNumber.or(bNumber);
    317         byte resBytes[] = new byte[rBytes.length];
    318         resBytes = result.toByteArray();
    319         for(int i = 0; i < resBytes.length; i++) {
    320             assertTrue(resBytes[i] == rBytes[i]);
    321         }
    322         assertEquals("incorrect sign", -1, result.signum());
    323     }
    324 
    325     /**
    326      * Or for two negative numbers; the first is longer
    327      */
    328     @TestTargetNew(
    329         level = TestLevel.PARTIAL_COMPLETE,
    330         notes = "This is a complete subset of tests for or operation",
    331         method = "or",
    332         args = {java.math.BigInteger.class}
    333     )
    334     public void testNegNegFirstLonger() {
    335         byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75};
    336         byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
    337         int aSign = -1;
    338         int bSign = -1;
    339         byte rBytes[] = {-1, 1, 75, -89, -45, -2, -3, -18, -36, -17, -10, -3, -6, -7, -21};
    340         BigInteger aNumber = new BigInteger(aSign, aBytes);
    341         BigInteger bNumber = new BigInteger(bSign, bBytes);
    342         BigInteger result = aNumber.or(bNumber);
    343         byte resBytes[] = new byte[rBytes.length];
    344         resBytes = result.toByteArray();
    345         for(int i = 0; i < resBytes.length; i++) {
    346             assertTrue(resBytes[i] == rBytes[i]);
    347         }
    348         assertEquals("incorrect sign", -1, result.signum());
    349     }
    350 
    351     /**
    352      * Or for two negative numbers; the first is shorter
    353      */
    354     @TestTargetNew(
    355         level = TestLevel.PARTIAL_COMPLETE,
    356         notes = "This is a complete subset of tests for or operation",
    357         method = "or",
    358         args = {java.math.BigInteger.class}
    359     )
    360     public void testNegNegFirstShorter() {
    361         byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
    362         byte bBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75};
    363         int aSign = -1;
    364         int bSign = -1;
    365         byte rBytes[] = {-1, 1, 75, -89, -45, -2, -3, -18, -36, -17, -10, -3, -6, -7, -21};
    366         BigInteger aNumber = new BigInteger(aSign, aBytes);
    367         BigInteger bNumber = new BigInteger(bSign, bBytes);
    368         BigInteger result = aNumber.or(bNumber);
    369         byte resBytes[] = new byte[rBytes.length];
    370         resBytes = result.toByteArray();
    371         for(int i = 0; i < resBytes.length; i++) {
    372             assertTrue(resBytes[i] == rBytes[i]);
    373         }
    374         assertEquals("incorrect sign", -1, result.signum());
    375     }
    376 
    377     /**
    378      * Or for two numbers of different signs and the same length
    379      */
    380     @TestTargetNew(
    381         level = TestLevel.PARTIAL_COMPLETE,
    382         notes = "This is a complete subset of tests for or operation",
    383         method = "or",
    384         args = {java.math.BigInteger.class}
    385     )
    386     public void testPosNegSameLength() {
    387         byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117};
    388         byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
    389         int aSign = 1;
    390         int bSign = -1;
    391         byte rBytes[] = {-1, 1, -126, 59, 103, -2, -11, -7, -3, -33, -57, -3, -5, -5, -21};
    392         BigInteger aNumber = new BigInteger(aSign, aBytes);
    393         BigInteger bNumber = new BigInteger(bSign, bBytes);
    394         BigInteger result = aNumber.or(bNumber);
    395         byte resBytes[] = new byte[rBytes.length];
    396         resBytes = result.toByteArray();
    397         for(int i = 0; i < resBytes.length; i++) {
    398             assertTrue(resBytes[i] == rBytes[i]);
    399         }
    400         assertEquals("incorrect sign", -1, result.signum());
    401     }
    402 
    403     /**
    404      * Or for two numbers of different signs and the same length
    405      */
    406     @TestTargetNew(
    407         level = TestLevel.PARTIAL_COMPLETE,
    408         notes = "This is a complete subset of tests for or operation",
    409         method = "or",
    410         args = {java.math.BigInteger.class}
    411     )
    412     public void testNegPosSameLength() {
    413         byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117};
    414         byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
    415         int aSign = -1;
    416         int bSign = 1;
    417         byte rBytes[] = {-1, 5, 79, -73, -9, -76, -3, 78, -35, -17, 119};
    418         BigInteger aNumber = new BigInteger(aSign, aBytes);
    419         BigInteger bNumber = new BigInteger(bSign, bBytes);
    420         BigInteger result = aNumber.or(bNumber);
    421         byte resBytes[] = new byte[rBytes.length];
    422         resBytes = result.toByteArray();
    423         for(int i = 0; i < resBytes.length; i++) {
    424             assertTrue(resBytes[i] == rBytes[i]);
    425         }
    426         assertEquals("incorrect sign", -1, result.signum());
    427     }
    428 
    429     /**
    430      * Or for a negative and a positive numbers; the first is longer
    431      */
    432     @TestTargetNew(
    433         level = TestLevel.PARTIAL_COMPLETE,
    434         notes = "This is a complete subset of tests for or operation",
    435         method = "or",
    436         args = {java.math.BigInteger.class}
    437     )
    438     public void testNegPosFirstLonger() {
    439         byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75};
    440         byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
    441         int aSign = -1;
    442         int bSign = 1;
    443         byte rBytes[] = {-1, 127, -10, -57, -101, -1, -1, -2, -2, -91, -2, 31, -1, -11, 125, -22, -83, 30, 95};
    444         BigInteger aNumber = new BigInteger(aSign, aBytes);
    445         BigInteger bNumber = new BigInteger(bSign, bBytes);
    446         BigInteger result = aNumber.or(bNumber);
    447         byte resBytes[] = new byte[rBytes.length];
    448         resBytes = result.toByteArray();
    449         for(int i = 0; i < resBytes.length; i++) {
    450             assertTrue(resBytes[i] == rBytes[i]);
    451         }
    452         assertEquals("incorrect sign", -1, result.signum());
    453     }
    454 
    455     /**
    456      * Or for two negative numbers; the first is shorter
    457      */
    458     @TestTargetNew(
    459         level = TestLevel.PARTIAL_COMPLETE,
    460         notes = "This is a complete subset of tests for or operation",
    461         method = "or",
    462         args = {java.math.BigInteger.class}
    463     )
    464     public void testNegPosFirstShorter() {
    465         byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
    466         byte bBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75};
    467         int aSign = -1;
    468         int bSign = 1;
    469         byte rBytes[] = {-74, 91, 47, -5, -13, -7, -5, -33, -49, -65, -1, -9, -3};
    470         BigInteger aNumber = new BigInteger(aSign, aBytes);
    471         BigInteger bNumber = new BigInteger(bSign, bBytes);
    472         BigInteger result = aNumber.or(bNumber);
    473         byte resBytes[] = new byte[rBytes.length];
    474         resBytes = result.toByteArray();
    475         for(int i = 0; i < resBytes.length; i++) {
    476             assertTrue(resBytes[i] == rBytes[i]);
    477         }
    478         assertEquals("incorrect sign", -1, result.signum());
    479     }
    480 
    481     /**
    482      * Or for a positive and a negative numbers; the first is longer
    483      */
    484     @TestTargetNew(
    485         level = TestLevel.PARTIAL_COMPLETE,
    486         notes = "This is a complete subset of tests for or operation",
    487         method = "or",
    488         args = {java.math.BigInteger.class}
    489     )
    490     public void testPosNegFirstLonger() {
    491         byte aBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75};
    492         byte bBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
    493         int aSign = 1;
    494         int bSign = -1;
    495         byte rBytes[] = {-74, 91, 47, -5, -13, -7, -5, -33, -49, -65, -1, -9, -3};
    496         BigInteger aNumber = new BigInteger(aSign, aBytes);
    497         BigInteger bNumber = new BigInteger(bSign, bBytes);
    498         BigInteger result = aNumber.or(bNumber);
    499         byte resBytes[] = new byte[rBytes.length];
    500         resBytes = result.toByteArray();
    501         for(int i = 0; i < resBytes.length; i++) {
    502             assertTrue(resBytes[i] == rBytes[i]);
    503         }
    504         assertEquals("incorrect sign", -1, result.signum());
    505     }
    506 
    507     /**
    508      * Or for a positive and a negative number; the first is shorter
    509      */
    510     @TestTargetNew(
    511         level = TestLevel.PARTIAL_COMPLETE,
    512         notes = "This is a complete subset of tests for or operation",
    513         method = "or",
    514         args = {java.math.BigInteger.class}
    515     )
    516     public void testPosNegFirstShorter() {
    517         byte aBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
    518         byte bBytes[] = {-128, 9, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, -117, 23, 87, -25, -75};
    519         int aSign = 1;
    520         int bSign = -1;
    521         byte rBytes[] = {-1, 127, -10, -57, -101, -1, -1, -2, -2, -91, -2, 31, -1, -11, 125, -22, -83, 30, 95};
    522         BigInteger aNumber = new BigInteger(aSign, aBytes);
    523         BigInteger bNumber = new BigInteger(bSign, bBytes);
    524         BigInteger result = aNumber.or(bNumber);
    525         byte resBytes[] = new byte[rBytes.length];
    526         resBytes = result.toByteArray();
    527         for(int i = 0; i < resBytes.length; i++) {
    528             assertTrue(resBytes[i] == rBytes[i]);
    529         }
    530         assertEquals("incorrect sign", -1, result.signum());
    531     }
    532 
    533     @TestTargetNew(
    534         level = TestLevel.PARTIAL_COMPLETE,
    535         notes = "This is a complete subset of tests for or operation",
    536         method = "or",
    537         args = {java.math.BigInteger.class}
    538     )
    539     @BrokenTest("Fails in CTS environment, but passes in CoreTestRunner")
    540     public void testRegression() {
    541         // Regression test for HARMONY-1996
    542         BigInteger x = new BigInteger("-1023");
    543         BigInteger r1 = x.and((BigInteger.ZERO.not()).shiftLeft(32));
    544         BigInteger r3 = x.and((BigInteger.ZERO.not().shiftLeft(32) ).not());
    545         BigInteger result = r1.or(r3);
    546         assertEquals(x, result);
    547     }
    548 }
    549