Home | History | Annotate | Download | only in add_double
      1 /*
      2  * Copyright (C) 2008 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package android.vm.cts.opcodes.add_double;
     17 
     18 import junit.framework.TestCase;
     19 
     20 public class AddDoubleTest extends TestCase {
     21 
     22     /**
     23      * @title Arguments = 2.7d, 3.14d
     24      */
     25     public void testN1() {
     26         AddDouble_1 t = new AddDouble_1();
     27         assertEquals(5.84d, t.run(2.7d, 3.14d));
     28     }
     29 
     30     /**
     31      * @title Arguments = 0, -3.14d
     32      */
     33     public void testN2() {
     34         AddDouble_1 t = new AddDouble_1();
     35         assertEquals(-3.14d, t.run(0, -3.14d));
     36     }
     37 
     38     /**
     39      * @title Arguments = -3.14d, -2.7d
     40      */
     41     public void testN3() {
     42         AddDouble_1 t = new AddDouble_1();
     43         assertEquals(-5.84d, t.run(-3.14d, -2.7d));
     44     }
     45 
     46     /**
     47      * @title Arguments = Double.MAX_VALUE, Double.NaN
     48      */
     49     public void testB1() {
     50         AddDouble_1 t = new AddDouble_1();
     51         assertEquals(Double.NaN, t.run(Double.MAX_VALUE, Double.NaN));
     52     }
     53 
     54     /**
     55      * @title Arguments = Double.POSITIVE_INFINITY,
     56      * Double.NEGATIVE_INFINITY
     57      */
     58     public void testB2() {
     59         AddDouble_1 t = new AddDouble_1();
     60         assertEquals(Double.NaN, t.run(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY));
     61     }
     62 
     63     /**
     64      * @title Arguments = Double.POSITIVE_INFINITY,
     65      * Double.POSITIVE_INFINITY
     66      */
     67     public void testB3() {
     68         AddDouble_1 t = new AddDouble_1();
     69         assertEquals(Double.POSITIVE_INFINITY, t.run(Double.POSITIVE_INFINITY,
     70                 Double.POSITIVE_INFINITY));
     71     }
     72 
     73     /**
     74      * @title Arguments = Double.POSITIVE_INFINITY, -2.7d
     75      */
     76     public void testB4() {
     77         AddDouble_1 t = new AddDouble_1();
     78         assertEquals(Double.POSITIVE_INFINITY, t.run(Double.POSITIVE_INFINITY, -2.7d));
     79     }
     80 
     81     /**
     82      * @title Arguments = +0, -0
     83      */
     84     public void testB5() {
     85         AddDouble_1 t = new AddDouble_1();
     86         assertEquals(+0d, t.run(+0d, -0d));
     87     }
     88 
     89     /**
     90      * @title Arguments = -0d, -0d
     91      */
     92     public void testB6() {
     93         AddDouble_1 t = new AddDouble_1();
     94         assertEquals(-0d, t.run(-0d, -0d));
     95     }
     96 
     97     /**
     98      * @title Arguments = -2.7d, 2.7d
     99      */
    100     public void testB7() {
    101         AddDouble_1 t = new AddDouble_1();
    102         assertEquals(+0d, t.run(-2.7d, 2.7d));
    103     }
    104 
    105     /**
    106      * @title Arguments = Double.MAX_VALUE, Double.MAX_VALUE
    107      */
    108     public void testB8() {
    109         AddDouble_1 t = new AddDouble_1();
    110         assertEquals(Double.POSITIVE_INFINITY, t.run(Double.MAX_VALUE, Double.MAX_VALUE));
    111     }
    112 
    113     /**
    114      * @title Arguments = Double.MIN_VALUE, -4.9E-324
    115      */
    116     public void testB9() {
    117         AddDouble_1 t = new AddDouble_1();
    118         assertEquals(0d, t.run(Double.MIN_VALUE, -4.9E-324));
    119     }
    120 
    121 }
    122