Home | History | Annotate | Download | only in shr_int_lit8
      1 package dot.junit.opcodes.shr_int_lit8;
      2 
      3 import dot.junit.DxTestCase;
      4 import dot.junit.DxUtil;
      5 import dot.junit.opcodes.shr_int_lit8.d.T_shr_int_lit8_1;
      6 import dot.junit.opcodes.shr_int_lit8.d.T_shr_int_lit8_2;
      7 import dot.junit.opcodes.shr_int_lit8.d.T_shr_int_lit8_3;
      8 import dot.junit.opcodes.shr_int_lit8.d.T_shr_int_lit8_4;
      9 import dot.junit.opcodes.shr_int_lit8.d.T_shr_int_lit8_5;
     10 import dot.junit.opcodes.shr_int_lit8.d.T_shr_int_lit8_6;
     11 
     12 public class Test_shr_int_lit8 extends DxTestCase {
     13 
     14     /**
     15      * @title 15 >> 1
     16      */
     17     public void testN1() {
     18         T_shr_int_lit8_1 t = new T_shr_int_lit8_1();
     19         assertEquals(7, t.run(15));
     20     }
     21 
     22     /**
     23      * @title 33 >> 2
     24      */
     25     public void testN2() {
     26         T_shr_int_lit8_2 t = new T_shr_int_lit8_2();
     27         assertEquals(8, t.run(33));
     28     }
     29 
     30     /**
     31      * @title -15 >> 1
     32      */
     33     public void testN3() {
     34         T_shr_int_lit8_1 t = new T_shr_int_lit8_1();
     35         assertEquals(-8, t.run(-15));
     36     }
     37 
     38     /**
     39      * @title Arguments = 1 & -1
     40      */
     41     public void testN4() {
     42         T_shr_int_lit8_3 t = new T_shr_int_lit8_3();
     43         assertEquals(0, t.run(1));
     44     }
     45 
     46     /**
     47      * @title Verify that shift distance is actually in range 0 to 32.
     48      */
     49     public void testN5() {
     50         T_shr_int_lit8_4 t = new T_shr_int_lit8_4();
     51         assertEquals(16, t.run(33));
     52     }
     53 
     54 
     55     /**
     56      * @title Arguments = 0 & -1
     57      */
     58     public void testB1() {
     59         T_shr_int_lit8_3 t = new T_shr_int_lit8_3();
     60         assertEquals(0, t.run(0));
     61     }
     62 
     63     /**
     64      * @title Arguments = Integer.MAX_VALUE & 1
     65      */
     66     public void testB2() {
     67         T_shr_int_lit8_1 t = new T_shr_int_lit8_1();
     68         assertEquals(0x3FFFFFFF, t.run(Integer.MAX_VALUE));
     69     }
     70 
     71     /**
     72      * @title Arguments = Integer.MIN_VALUE & 1
     73      */
     74     public void testB3() {
     75         T_shr_int_lit8_1 t = new T_shr_int_lit8_1();
     76         assertEquals(0xc0000000, t.run(Integer.MIN_VALUE));
     77     }
     78 
     79     /**
     80      * @title Arguments = 1 & 0
     81      */
     82     public void testB4() {
     83         T_shr_int_lit8_5 t = new T_shr_int_lit8_5();
     84         assertEquals(1, t.run(1));
     85     }
     86 
     87     /**
     88      * @constraint A23
     89      * @title number of registers
     90      */
     91     public void testVFE1() {
     92         try {
     93             Class.forName("dot.junit.opcodes.shr_int_lit8.d.T_shr_int_lit8_7");
     94             fail("expected a verification exception");
     95         } catch (Throwable t) {
     96             DxUtil.checkVerifyException(t);
     97         }
     98     }
     99 
    100 
    101 
    102     /**
    103      * @constraint B1
    104      * @title types of arguments - double, int
    105      */
    106     public void testVFE2() {
    107         try {
    108             Class.forName("dot.junit.opcodes.shr_int_lit8.d.T_shr_int_lit8_8");
    109             fail("expected a verification exception");
    110         } catch (Throwable t) {
    111             DxUtil.checkVerifyException(t);
    112         }
    113     }
    114 
    115     /**
    116      * @constraint B1
    117      * @title types of arguments - long, int
    118      */
    119     public void testVFE3() {
    120         try {
    121             Class.forName("dot.junit.opcodes.shr_int_lit8.d.T_shr_int_lit8_9");
    122             fail("expected a verification exception");
    123         } catch (Throwable t) {
    124             DxUtil.checkVerifyException(t);
    125         }
    126     }
    127 
    128     /**
    129      * @constraint B1
    130      * @title types of arguments - reference, int
    131      */
    132     public void testVFE4() {
    133         try {
    134             Class.forName("dot.junit.opcodes.shr_int_lit8.d.T_shr_int_lit8_10");
    135             fail("expected a verification exception");
    136         } catch (Throwable t) {
    137             DxUtil.checkVerifyException(t);
    138         }
    139     }
    140 
    141     /**
    142      * @constraint B1
    143      * @title Types of arguments - float. The verifier checks that ints
    144      * and floats are not used interchangeably.
    145      */
    146     public void testVFE5() {
    147         try {
    148             Class.forName("dot.junit.opcodes.shr_int_lit8.d.T_shr_int_lit8_6");
    149             fail("expected a verification exception");
    150         } catch (Throwable t) {
    151             DxUtil.checkVerifyException(t);
    152         }
    153     }
    154 }
    155