Home | History | Annotate | Download | only in shr_int_2addr
      1 package dot.junit.opcodes.shr_int_2addr;
      2 
      3 import dot.junit.DxTestCase;
      4 import dot.junit.DxUtil;
      5 import dot.junit.opcodes.shr_int_2addr.d.T_shr_int_2addr_1;
      6 import dot.junit.opcodes.shr_int_2addr.d.T_shr_int_2addr_6;
      7 
      8 public class Test_shr_int_2addr extends DxTestCase {
      9 
     10     /**
     11      * @title 15 >> 1
     12      */
     13     public void testN1() {
     14         T_shr_int_2addr_1 t = new T_shr_int_2addr_1();
     15         assertEquals(7, t.run(15, 1));
     16     }
     17 
     18     /**
     19      * @title 33 >> 2
     20      */
     21     public void testN2() {
     22         T_shr_int_2addr_1 t = new T_shr_int_2addr_1();
     23         assertEquals(8, t.run(33, 2));
     24     }
     25 
     26     /**
     27      * @title -15 >> 1
     28      */
     29     public void testN3() {
     30         T_shr_int_2addr_1 t = new T_shr_int_2addr_1();
     31         assertEquals(-8, t.run(-15, 1));
     32     }
     33 
     34     /**
     35      * @title Arguments = 1 & -1
     36      */
     37     public void testN4() {
     38         T_shr_int_2addr_1 t = new T_shr_int_2addr_1();
     39         assertEquals(0, t.run(1, -1));
     40     }
     41 
     42     /**
     43      * @title Verify that shift distance is actually in range 0 to 32.
     44      */
     45     public void testN5() {
     46         T_shr_int_2addr_1 t = new T_shr_int_2addr_1();
     47         assertEquals(16, t.run(33, 33));
     48     }
     49 
     50 
     51 
     52     /**
     53      * @title Arguments = 0 & -1
     54      */
     55     public void testB1() {
     56         T_shr_int_2addr_1 t = new T_shr_int_2addr_1();
     57         assertEquals(0, t.run(0, -1));
     58     }
     59 
     60     /**
     61      * @title Arguments = Integer.MAX_VALUE & 1
     62      */
     63     public void testB2() {
     64         T_shr_int_2addr_1 t = new T_shr_int_2addr_1();
     65         assertEquals(0x3FFFFFFF, t.run(Integer.MAX_VALUE, 1));
     66     }
     67 
     68     /**
     69      * @title Arguments = Integer.MIN_VALUE & 1
     70      */
     71     public void testB3() {
     72         T_shr_int_2addr_1 t = new T_shr_int_2addr_1();
     73         assertEquals(0xc0000000, t.run(Integer.MIN_VALUE, 1));
     74     }
     75 
     76     /**
     77      * @title Arguments = 1 & 0
     78      */
     79     public void testB4() {
     80         T_shr_int_2addr_1 t = new T_shr_int_2addr_1();
     81         assertEquals(1, t.run(1, 0));
     82     }
     83 
     84     /**
     85      * @constraint A23
     86      * @title number of registers
     87      */
     88     public void testVFE1() {
     89         load("dot.junit.opcodes.shr_int_2addr.d.T_shr_int_2addr_2", VerifyError.class);
     90     }
     91 
     92 
     93 
     94     /**
     95      * @constraint B1
     96      * @title types of arguments - double, int
     97      */
     98     public void testVFE2() {
     99         load("dot.junit.opcodes.shr_int_2addr.d.T_shr_int_2addr_3", VerifyError.class);
    100     }
    101 
    102     /**
    103      * @constraint B1
    104      * @title types of arguments - long, int
    105      */
    106     public void testVFE3() {
    107         load("dot.junit.opcodes.shr_int_2addr.d.T_shr_int_2addr_4", VerifyError.class);
    108     }
    109 
    110     /**
    111      * @constraint B1
    112      * @title types of arguments - reference, int
    113      */
    114     public void testVFE4() {
    115         load("dot.junit.opcodes.shr_int_2addr.d.T_shr_int_2addr_5", VerifyError.class);
    116     }
    117 
    118     /**
    119      * @constraint B1
    120      * @title Types of arguments - float, float. The verifier checks that ints
    121      * and floats are not used interchangeably.
    122      */
    123     public void testVFE5() {
    124         load("dot.junit.opcodes.shr_int_2addr.d.T_shr_int_2addr_6", VerifyError.class);
    125     }
    126 
    127 }
    128