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