Home | History | Annotate | Download | only in mul_double_2addr
      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 
     17 package dot.junit.opcodes.mul_double_2addr;
     18 
     19 import dot.junit.DxTestCase;
     20 import dot.junit.DxUtil;
     21 import dot.junit.opcodes.mul_double_2addr.d.T_mul_double_2addr_1;
     22 import dot.junit.opcodes.mul_double_2addr.d.T_mul_double_2addr_4;
     23 
     24 public class Test_mul_double_2addr extends DxTestCase {
     25 
     26     /**
     27      * @title Arguments = 2.7d, 3.14d
     28      */
     29 
     30     public void testN1() {
     31         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
     32         assertEquals(8.478000000000002d, t.run(2.7d, 3.14d));
     33     }
     34 
     35     /**
     36      * @title Arguments = 0, -3.14d
     37      */
     38     public void testN2() {
     39         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
     40         assertEquals(-0d, t.run(0, -3.14d));
     41     }
     42 
     43     /**
     44      * @title Arguments = -2.7d, -3.14d
     45      */
     46     public void testN3() {
     47         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
     48         assertEquals(8.478000000000002d, t.run(-3.14d, -2.7d));
     49     }
     50 
     51     /**
     52      * @title Arguments = Double.MAX_VALUE, Double.NaN
     53      */
     54     public void testB1() {
     55         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
     56         assertEquals(Double.NaN, t.run(Double.MAX_VALUE, Double.NaN));
     57     }
     58 
     59     /**
     60      * @title Arguments = Double.POSITIVE_INFINITY, 0
     61      */
     62     public void testB2() {
     63         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
     64         assertEquals(Double.NaN, t.run(Double.POSITIVE_INFINITY, 0));
     65     }
     66 
     67     /**
     68      * @title Arguments = Double.POSITIVE_INFINITY, -2.7d
     69      */
     70     public void testB3() {
     71         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
     72         assertEquals(Double.NEGATIVE_INFINITY, t.run(Double.POSITIVE_INFINITY,
     73                 -2.7d));
     74     }
     75 
     76     /**
     77      * @title Arguments = Double.POSITIVE_INFINITY,
     78      * Double.NEGATIVE_INFINITY
     79      */
     80     public void testB4() {
     81         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
     82         assertEquals(Double.NEGATIVE_INFINITY, t.run(Double.POSITIVE_INFINITY,
     83                 Double.NEGATIVE_INFINITY));
     84     }
     85 
     86     /**
     87      * @title Arguments = +0, -0d
     88      */
     89     public void testB5() {
     90         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
     91         assertEquals(-0d, t.run(+0d, -0d));
     92     }
     93 
     94     /**
     95      * @title Arguments = -0d, -0d
     96      */
     97     public void testB6() {
     98         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
     99         assertEquals(+0d, t.run(-0d, -0d));
    100     }
    101 
    102     /**
    103      * @title Arguments = Double.MAX_VALUE, Double.MAX_VALUE
    104      */
    105     public void testB7() {
    106         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
    107         assertEquals(Double.POSITIVE_INFINITY, t.run(Double.MAX_VALUE,
    108                 Double.MAX_VALUE));
    109     }
    110 
    111     /**
    112      * @title Arguments = Double.MIN_VALUE, -1.4E-45f
    113      */
    114     public void testB8() {
    115         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
    116         assertEquals(-0d, t.run(Double.MIN_VALUE, -1.4E-45f));
    117     }
    118 
    119     /**
    120      * @constraint A24
    121      * @title number of registers
    122      */
    123     public void testVFE1() {
    124         try {
    125             Class.forName("dot.junit.opcodes.mul_double_2addr.d.T_mul_double_2addr_2");
    126             fail("expected a verification exception");
    127         } catch (Throwable t) {
    128             DxUtil.checkVerifyException(t);
    129         }
    130     }
    131 
    132 
    133 
    134     /**
    135      * @constraint B1
    136      * @title types of arguments - float, double
    137      */
    138     public void testVFE2() {
    139         try {
    140             Class.forName("dot.junit.opcodes.mul_double_2addr.d.T_mul_double_2addr_3");
    141             fail("expected a verification exception");
    142         } catch (Throwable t) {
    143             DxUtil.checkVerifyException(t);
    144         }
    145     }
    146 
    147     /**
    148      * @constraint B1
    149      * @title types of arguments - double, reference
    150      */
    151     public void testVFE3() {
    152         try {
    153             Class.forName("dot.junit.opcodes.mul_double_2addr.d.T_mul_double_2addr_5");
    154             fail("expected a verification exception");
    155         } catch (Throwable t) {
    156             DxUtil.checkVerifyException(t);
    157         }
    158     }
    159 
    160     /**
    161      * @constraint B1
    162      * @title Types of arguments - long, double. The verifier checks that longs
    163      * and doubles are not used interchangeably.
    164      */
    165     public void testVFE4() {
    166         try {
    167             Class.forName("dot.junit.opcodes.mul_double_2addr.d.T_mul_double_2addr_4");
    168             fail("expected a verification exception");
    169         } catch (Throwable t) {
    170             DxUtil.checkVerifyException(t);
    171         }
    172     }
    173 
    174 }
    175