Home | History | Annotate | Download | only in ushr_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.ushr_int_lit8;
     18 
     19 import dot.junit.DxTestCase;
     20 import dot.junit.DxUtil;
     21 import dot.junit.opcodes.ushr_int_lit8.d.T_ushr_int_lit8_1;
     22 import dot.junit.opcodes.ushr_int_lit8.d.T_ushr_int_lit8_13;
     23 import dot.junit.opcodes.ushr_int_lit8.d.T_ushr_int_lit8_2;
     24 import dot.junit.opcodes.ushr_int_lit8.d.T_ushr_int_lit8_3;
     25 import dot.junit.opcodes.ushr_int_lit8.d.T_ushr_int_lit8_4;
     26 import dot.junit.opcodes.ushr_int_lit8.d.T_ushr_int_lit8_5;
     27 import dot.junit.opcodes.ushr_int_lit8.d.T_ushr_int_lit8_6;
     28 import dot.junit.opcodes.ushr_int_lit8.d.T_ushr_int_lit8_7;
     29 import dot.junit.opcodes.ushr_int_lit8.d.T_ushr_int_lit8_8;
     30 import dot.junit.opcodes.ushr_int_lit8.d.T_ushr_int_lit8_9;
     31 
     32 
     33 public class Test_ushr_int_lit8 extends DxTestCase {
     34     /**
     35      * @title 15 >> 1
     36      */
     37     public void testN1() {
     38         T_ushr_int_lit8_1 t = new T_ushr_int_lit8_1();
     39         assertEquals(7, t.run());
     40     }
     41 
     42     /**
     43      * @title 33 >> 2
     44      */
     45     public void testN2() {
     46         T_ushr_int_lit8_2 t = new T_ushr_int_lit8_2();
     47         assertEquals(8, t.run());
     48     }
     49 
     50     /**
     51      * @title -15 >> 1
     52      */
     53     public void testN3() {
     54         T_ushr_int_lit8_3 t = new T_ushr_int_lit8_3();
     55         assertEquals(0x7FFFFFF8, t.run());
     56     }
     57 
     58     /**
     59      * @title Arguments = 1 & -1
     60      */
     61     public void testN4() {
     62         T_ushr_int_lit8_4 t = new T_ushr_int_lit8_4();
     63         assertEquals(0, t.run());
     64     }
     65 
     66     /**
     67      * @title Verify that shift distance is actually in range 0 to 32.
     68      */
     69     public void testN5() {
     70         T_ushr_int_lit8_5 t = new T_ushr_int_lit8_5();
     71         assertEquals(16, t.run());
     72     }
     73 
     74 
     75     /**
     76      * @title Arguments = 0 & -1
     77      */
     78     public void testB1() {
     79         T_ushr_int_lit8_6 t = new T_ushr_int_lit8_6();
     80         assertEquals(0, t.run());
     81     }
     82 
     83     /**
     84      * @title Arguments = Integer.MAX_VALUE & 1
     85      */
     86     public void testB2() {
     87         T_ushr_int_lit8_7 t = new T_ushr_int_lit8_7();
     88         assertEquals(0x3FFFFFFF, t.run());
     89     }
     90 
     91     /**
     92      * @title Arguments = Integer.MIN_VALUE & 1
     93      */
     94     public void testB3() {
     95         T_ushr_int_lit8_8 t = new T_ushr_int_lit8_8();
     96         assertEquals(0x40000000, t.run());
     97     }
     98 
     99     /**
    100      * @title Arguments = 1 & 0
    101      */
    102     public void testB4() {
    103         T_ushr_int_lit8_9 t = new T_ushr_int_lit8_9();
    104         assertEquals(1, t.run());
    105     }
    106 
    107 
    108 
    109     /**
    110      * @constraint B1
    111      * @title types of arguments - double, int
    112      */
    113     public void testVFE1() {
    114         load("dot.junit.opcodes.ushr_int_lit8.d.T_ushr_int_lit8_10", VerifyError.class);
    115     }
    116 
    117     /**
    118      * @constraint B1
    119      * @title types of arguments - long, int
    120      */
    121     public void testVFE2() {
    122         load("dot.junit.opcodes.ushr_int_lit8.d.T_ushr_int_lit8_11", VerifyError.class);
    123     }
    124 
    125     /**
    126      * @constraint B1
    127      * @title types of arguments - reference, int
    128      */
    129     public void testVFE3() {
    130         load("dot.junit.opcodes.ushr_int_lit8.d.T_ushr_int_lit8_12", VerifyError.class);
    131     }
    132 
    133     /**
    134      * @constraint A23
    135      * @title number of registers
    136      */
    137     public void testVFE4() {
    138         load("dot.junit.opcodes.ushr_int_lit8.d.T_ushr_int_lit8_14", VerifyError.class);
    139     }
    140 
    141     /**
    142      * @constraint B1
    143      * @title Type of argument - float. The verifier checks that ints
    144      * and floats are not used interchangeably.
    145      */
    146     public void testVFE5() {
    147         load("dot.junit.opcodes.ushr_int_lit8.d.T_ushr_int_lit8_13", VerifyError.class);
    148     }
    149 
    150 }
    151