tests/libjava-mauve/src/gnu/testlet/java/math/BigInteger/equals.java
branchjk_new_structure
changeset 1541 75c2e24dea9a
parent 1540 92ac284961c1
child 1542 be11db817bcf
equal deleted inserted replaced
1540:92ac284961c1 1541:75c2e24dea9a
     1 // Tags: JDK1.1
       
     2 
       
     3 // Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
       
     4 
       
     5 // Mauve is free software; you can redistribute it and/or modify
       
     6 // it under the terms of the GNU General Public License as published by
       
     7 // the Free Software Foundation; either version 2, or (at your option)
       
     8 // any later version.
       
     9 
       
    10 // Mauve is distributed in the hope that it will be useful,
       
    11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    13 // GNU General Public License for more details.
       
    14 
       
    15 // You should have received a copy of the GNU General Public License
       
    16 // along with Mauve; see the file COPYING.  If not, write to
       
    17 // the Free Software Foundation, 59 Temple Place - Suite 330,
       
    18 // Boston, MA 02111-1307, USA.  */
       
    19 
       
    20 package gnu.testlet.java.math.BigInteger;
       
    21 
       
    22 import gnu.testlet.TestHarness;
       
    23 import gnu.testlet.Testlet;
       
    24 
       
    25 import java.math.BigInteger;
       
    26 
       
    27 /**
       
    28  * Some checks for the equals() method in the {@link BigInteger} class.
       
    29  */
       
    30 public class equals implements Testlet 
       
    31 {
       
    32   /**
       
    33    * Runs the test using the specified harness.
       
    34    * 
       
    35    * @param harness  the test harness (<code>null</code> not permitted).
       
    36    */
       
    37   public void test(TestHarness harness)   
       
    38   {
       
    39     BigInteger a = new BigInteger("-987654321098765432109876543210");
       
    40     BigInteger b = new BigInteger("-1");
       
    41     BigInteger c = new BigInteger("0");
       
    42     BigInteger d = new BigInteger("1");
       
    43     BigInteger e = new BigInteger("987654321098765432109876543210");
       
    44  
       
    45     BigInteger aa = new BigInteger("-987654321098765432109876543210");
       
    46     BigInteger bb = new BigInteger("-1");
       
    47     BigInteger cc = new BigInteger("0");
       
    48     BigInteger dd = new BigInteger("1");
       
    49     BigInteger ee = new BigInteger("987654321098765432109876543210");
       
    50 
       
    51     harness.check(a.equals(aa));
       
    52     harness.check(!a.equals(bb));
       
    53     harness.check(!a.equals(cc));
       
    54     harness.check(!a.equals(dd));
       
    55     harness.check(!a.equals(ee));
       
    56     harness.check(!a.equals(null));
       
    57 
       
    58     harness.check(!b.equals(aa));
       
    59     harness.check(b.equals(bb));
       
    60     harness.check(!b.equals(cc));
       
    61     harness.check(!b.equals(dd));
       
    62     harness.check(!b.equals(ee));
       
    63     harness.check(!b.equals(null));
       
    64     harness.check(!b.equals(new Integer(-1)));
       
    65 
       
    66     harness.check(!c.equals(aa));
       
    67     harness.check(!c.equals(bb));
       
    68     harness.check(c.equals(cc));
       
    69     harness.check(!c.equals(dd));
       
    70     harness.check(!c.equals(ee));
       
    71     harness.check(!c.equals(null));
       
    72     harness.check(!c.equals(new Integer(0)));
       
    73 
       
    74     harness.check(!d.equals(aa));
       
    75     harness.check(!d.equals(bb));
       
    76     harness.check(!d.equals(cc));
       
    77     harness.check(d.equals(dd));
       
    78     harness.check(!d.equals(ee));
       
    79     harness.check(!d.equals(null));
       
    80     harness.check(!d.equals(new Integer(1)));
       
    81 
       
    82     harness.check(!e.equals(aa));
       
    83     harness.check(!e.equals(bb));
       
    84     harness.check(!e.equals(cc));
       
    85     harness.check(!e.equals(dd));
       
    86     harness.check(e.equals(ee));
       
    87     harness.check(!e.equals(null));
       
    88 
       
    89  
       
    90   }
       
    91 
       
    92 }