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